summaryrefslogtreecommitdiff
path: root/env
diff options
context:
space:
mode:
Diffstat (limited to 'env')
-rw-r--r--env/Makefile1
-rw-r--r--env/fw_env_main.c14
2 files changed, 15 insertions, 0 deletions
diff --git a/env/Makefile b/env/Makefile
index 2004a39..9158bee 100644
--- a/env/Makefile
+++ b/env/Makefile
@@ -13,6 +13,7 @@ romfs:
test -e $(ROMFSDIR)/etc/fw_env.config || $(ROMFSINST) -d /etc/fw_env.config
$(ROMFSINST) -s fw_env /bin/fw_printenv
$(ROMFSINST) -s fw_env /bin/fw_setenv
+ $(ROMFSINST) -s fw_env /bin/fw_getenv
clean:
-rm -f *.o fw_env *.gdb
diff --git a/env/fw_env_main.c b/env/fw_env_main.c
index 7f631c4..3e022ed 100644
--- a/env/fw_env_main.c
+++ b/env/fw_env_main.c
@@ -46,6 +46,7 @@
#define CMD_PRINTENV "fw_printenv"
#define CMD_SETENV "fw_setenv"
+#define CMD_GETENV "fw_getenv"
int
main(int argc, char *argv[])
@@ -71,6 +72,19 @@ main(int argc, char *argv[])
return (EXIT_SUCCESS);
+ } else if (strcmp(cmdname, CMD_GETENV) == 0) {
+
+ if (argc > 1) {
+ while (--argc) {
+ char *val = fw_getenv(argv[argc]);
+
+ if (val)
+ printf("%s\n", val);
+ else
+ fprintf(stderr, "%s: no such variable in environment\n", argv[argc]);
+ }
+ }
+ return (EXIT_SUCCESS);
}
fprintf (stderr,