Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/xlint/xlint lint: arrange options in the usage messages



details:   https://anonhg.NetBSD.org/src/rev/d61b1a94acf6
branches:  trunk
changeset: 961286:d61b1a94acf6
user:      rillig <rillig%NetBSD.org@localhost>
date:      Wed Apr 14 19:25:48 2021 +0000

description:
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

diffstat:

 usr.bin/xlint/xlint/xlint.c |  26 +++++++++++++++-----------
 1 files changed, 15 insertions(+), 11 deletions(-)

diffs (50 lines):

diff -r 0e11f8ce3492 -r d61b1a94acf6 usr.bin/xlint/xlint/xlint.c
--- a/usr.bin/xlint/xlint/xlint.c       Wed Apr 14 18:38:06 2021 +0000
+++ b/usr.bin/xlint/xlint/xlint.c       Wed Apr 14 19:25:48 2021 +0000
@@ -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 @@
 static void
 usage(void)
 {
+       const char *name;
+       int indent;
 
-       (void)fprintf(stderr,
-           "Usage: %s [-abceghprvwxzHFST] [-s|-t] [-i|-nu] [-Dname[=def]]"
-           " [-Uname] [-X <id>[,<id>]... [-Z <cpparg>]\n", getprogname());
+       name = getprogname();
+       indent = (int)(strlen("usage: ") + strlen(name));
        (void)fprintf(stderr,
-           "\t[-Idirectory] [-Ldirectory] [-llibrary] [-ooutputfile]"
-           " file...\n");
+           "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,
-           "       %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);
 }
 



Home | Main Index | Thread Index | Old Index