diff mbox series

[v2] Add description of the fw_setenv script syntax

Message ID YYAuEMB4PdLHyhrd@q1
State Accepted
Headers show
Series [v2] Add description of the fw_setenv script syntax | expand

Commit Message

Domenico Andreoli Nov. 1, 2021, 6:12 p.m. UTC
Add description of the fw_setenv script syntax

v2:
 * mention that lines without '=' are ignored
 * remove the incompatibily note
 * aligned README.md with the usage help of fw_setenv
 * mention that part of the original U-Boot syntax is not supporte
 * add --help and --version in the usage help messages

Signed-off-by: Domenico Andreoli <domenico.andreoli@linux.com>

---
 README.md         |   15 +++++++++++++--
 src/fw_printenv.c |   16 ++++++++++++++--
 2 files changed, 27 insertions(+), 4 deletions(-)
diff mbox series

Patch

Index: b/src/fw_printenv.c
===================================================================
--- a/src/fw_printenv.c
+++ b/src/fw_printenv.c
@@ -38,10 +38,10 @@  static void usage(char *program, bool se
 	fprintf(stdout, "Usage %s [OPTION]\n",
 			program);
 	fprintf(stdout,
-		" -h,                              : print this help\n"
+		" -h, --help                       : print this help\n"
 		" -c, --config <filename>          : configuration file (old fw_env.config)\n"
 		" -f, --defenv <filename>          : default environment if no one found\n"
-		" -V,                              : print version and exit\n"
+		" -V, --version                    : print version and exit\n"
 	);
 	if (!setprogram)
 		fprintf(stdout,
@@ -50,6 +50,18 @@  static void usage(char *program, bool se
 	else
 		fprintf(stdout,
 		" -s, --script <filename>          : read variables to be set from a script\n"
+		"\n"
+		"Script Syntax:\n"
+		" key=value\n"
+		" lines starting with '#' are treated as comment\n"
+		" lines without '=' are ignored\n"
+		"\n"
+		"Script Example:\n"
+		" netdev=eth0\n"
+		" kernel_addr=400000\n"
+		" foo=empty empty empty    empty empty empty\n"
+		" bar\n"
+		"\n"
 		);
 }
 	
Index: b/README.md
===================================================================
--- a/README.md
+++ b/README.md
@@ -17,8 +17,8 @@  Replacement old tools
 
 Part of the library are the replacement of the "fw_printenv / fw_setenv" tools that
 can be used with any board - they accept as parameter a file as initial environment if none is found
-on the persistent storage. The syntax for the file and for the data configuration file
-is the same as the one described in the U-Boot project.
+on the persistent storage. The syntax for the data configuration file is the same as the one
+described in the U-Boot project whilst the syntax of the script file is a subset of the original one.
 
 ::
 
@@ -36,6 +36,17 @@  is the same as the one described in the
          -V,                              : print version and exit
          -s, --script <filename>          : read variables to be set from a script
 
+        Script Syntax:
+         key=value
+         lines starting with '#' are treated as comment
+         lines without '=' are ignored
+
+        Script Example:
+         netdev=eth0
+         kernel_addr=400000
+         foo=empty empty empty    empty empty empty
+         bar
+
 License
 -------