Module Name:    src
Committed By:   rillig
Date:           Wed Apr 14 19:25:48 UTC 2021

Modified Files:
        src/usr.bin/xlint/xlint: xlint.c

Log Message:
lint: arrange options in the usage messages

* lowercase the word 'usage'
* group the preprocessor flags on a line of their own
* add missing closing ']' for '-X'
* properly indent the lines


To generate a diff of this commit:
cvs rdiff -u -r1.58 -r1.59 src/usr.bin/xlint/xlint/xlint.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.bin/xlint/xlint/xlint.c
diff -u src/usr.bin/xlint/xlint/xlint.c:1.58 src/usr.bin/xlint/xlint/xlint.c:1.59
--- src/usr.bin/xlint/xlint/xlint.c:1.58	Fri Apr  2 12:16:50 2021
+++ src/usr.bin/xlint/xlint/xlint.c	Wed Apr 14 19:25:48 2021
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.58 2021/04/02 12:16:50 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.59 2021/04/14 19:25:48 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID) && !defined(lint)
-__RCSID("$NetBSD: xlint.c,v 1.58 2021/04/02 12:16:50 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.59 2021/04/14 19:25:48 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -288,18 +288,22 @@ appdef(char ***lstp, const char *def)
 static void
 usage(void)
 {
+	const char *name;
+	int indent;
 
+	name = getprogname();
+	indent = (int)(strlen("usage: ") + strlen(name));
 	(void)fprintf(stderr,
-	    "Usage: %s [-abceghprvwxzHFST] [-s|-t] [-i|-nu] [-Dname[=def]]"
-	    " [-Uname] [-X <id>[,<id>]... [-Z <cpparg>]\n", getprogname());
+	    "usage: %s [-abceghprvwxzHFST] [-s|-t] [-i|-nu]\n"
+	    "%*s [-Dname[=def]] [-Uname] [-Idirectory] [-Z <cpparg>]\n"
+	    "%*s [-Ldirectory] [-llibrary] [-ooutputfile]\n"
+	    "%*s [-X <id>[,<id>]...] file...\n",
+	    name, indent, "", indent, "", indent, "");
 	(void)fprintf(stderr,
-	    "\t[-Idirectory] [-Ldirectory] [-llibrary] [-ooutputfile]"
-	    " file...\n");
-	(void)fprintf(stderr,
-	    "       %s [-abceghprvwzHFST] [|-s|-t] -Clibrary [-Dname[=def]]\n"
-	    " [-X <id>[,<id>]... [-Z <cpparg>]\n", getprogname());
-	(void)fprintf(stderr, "\t[-Idirectory] [-Uname] [-Bpath] [-R old=new]"
-	    " file ...\n");
+	    "       %s [-abceghprvwzHFST] [-s|-t] -Clibrary\n"
+	    "%*s [-Dname[=def]] [-Uname] [-Idirectory] [-Z <cpparg>]\n"
+	    "%*s [-Bpath] [-X <id>[,<id>]...] [-R old=new] file ...\n",
+	    name, indent, "", indent, "");
 	terminate(-1);
 }
 

Reply via email to