[Linux-cachefs] [PATCH] cachefilesd: fix the usage description and the version string

Wang Sheng-Hui shhuiw at gmail.com
Mon Jan 14 15:28:37 UTC 2013


This patch fix the usage descrption and update the version string:
	* Make the output more neat
	* Make the -f description to the right place.
	* Fix typo
	* Update the version string
	* Add the '-h' parse

Signed-off-by: Wang Sheng-Hui <shhuiw at gmail.com>
---
  cachefilesd.c |   22 +++++++++++++++-------
  1 files changed, 15 insertions(+), 7 deletions(-)

diff --git a/cachefilesd.c b/cachefilesd.c
index 7059876..f5c04ec 100644
--- a/cachefilesd.c
+++ b/cachefilesd.c
@@ -9,7 +9,7 @@
   * 2 of the License, or (at your option) any later version.
   *
   *
- * Configuration file goes in /etc/cachefiles.conf and is of the form:
+ * Configuration file goes in /etc/cachefilesd.conf and is of the form:
   *
   *	dir /var/cache/fscache
   *	tag mycache
@@ -27,7 +27,7 @@
   * NUL characters are cause for error
   */

-#define CACHEFILESD_VERSION "0.10.2"
+#define CACHEFILESD_VERSION "0.10.5"

  #define _GNU_SOURCE
  #include <stdarg.h>
@@ -126,17 +126,21 @@ void help(void)
  	fprintf(stderr,
  		"Format:\n"
  		"  /sbin/cachefilesd [-d]* [-s] [-n] [-p <pidfile>] [-f <configfile>]\n"
-		"  /sbin/cachefilesd -v\n"
+		"  /sbin/cachefilesd -v|--version\n"
+		"  /sbin/cachefilesd -h|--help\n"
  		"\n"
  		"Options:\n"
  		"  -d\tIncrease debugging level (cumulative)\n"
  		"  -n\tDon't daemonise the process\n"
  		"  -s\tMessage output to stderr instead of syslog\n"
-		"  -p <pidfile>\tWrite the PID into the file\n"
+		"  -p <pidfile>\n"
+		"\tWrite PID into the specified pidfile instead of the default"
+		" /var/run/cachefilesd.pid\n"
  		"  -f <configfile>\n"
+		"\tRead the specified configuration file instead of the default"
+		" /etc/cachefilesd.conf\n"
  		"  -v\tPrint version and exit\n"
-		"\tRead the specified configuration file instead of"
-		" /etc/cachefiles.conf\n");
+		"  -h\tPrint usage and exit\n");

  	exit(2);
  }
@@ -286,7 +290,7 @@ int main(int argc, char *argv[])
  		version();

  	/* parse the arguments */
-	while (opt = getopt(argc, argv, "dsnf:p:v"),
+	while (opt = getopt(argc, argv, "dsnf:p:vh"),
  	       opt != EOF
  	       ) {
  		switch (opt) {
@@ -319,6 +323,10 @@ int main(int argc, char *argv[])
  			/* print the version and exit */
  			version();

+		case 'h':
+			/* print the usage and exit */
+			help();
+
  		default:
  			opterror("Unknown commandline option '%c'", optopt);
  		}
-- 
1.6.0.2




More information about the Linux-cachefs mailing list