Skip to contentSkip to conversation

commands: add lodvar - load variable from file content

PATCH In review Sebastian Block 2 participants 4 messages Sep 6, 2014

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 commands: add lodvar - load variable from file content

This adds a command to load a variable from file content. It is a work-a-round for "var=$(cat file)".

---
 commands/Kconfig   |  7 +++++
 commands/Makefile  |  1 +
 commands/loadvar.c | 90 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 98 insertions(+)
 create mode 100644 commands/loadvar.c
commands/Kconfig +7 -0
index 3a49baf..c6b4e03 100644
@@ -752,6 +752,13 @@ config CMD_SAVEENV
 	  /dev/env0. Note that envfs can only handle files, directories are being
 	  skipped silently.
 
+config CMD_LOADVAR
+	tristate
+	prompt "loadvar"
+	help
+	  Load variables from file contents.
+	  Usage: loadvar VAR FILE
+
 # end Environment commands
 endmenu
 
commands/Makefile +1 -0
index 52b6137..6553154 100644
@@ -103,3 +103,4 @@ obj-$(CONFIG_CMD_LSPCI)		+= lspci.o
 obj-$(CONFIG_CMD_IMD)		+= imd.o
 obj-$(CONFIG_CMD_HWCLOCK)	+= hwclock.o
 obj-$(CONFIG_CMD_USBGADGET)	+= usbgadget.o
+obj-$(CONFIG_CMD_LOADVAR)	+= loadvar.o
commands/loadvar.c new file +90 -0

90 lines not on this page · raw message

Signature · 6 lines
1.9.1

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox
#3 lore raw
Quoted 12 lines · Sebastian Block

Hi Alex,

Quoted 7 lines · Sebastian Block
Quoted 3 lines

This adds a command to load a variable from file content. It is a work-a-round for "var=$(cat file)".

doesn't commands/readf.c do similar things?

you are right. Please forget this patch.

Please don't interpret this as negative comment, you are always welcome to introduce new commands. :-)

- Alex

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox