Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/xlint lint: sync usage messages with reality



details:   https://anonhg.NetBSD.org/src/rev/6dfa77ef90e8
branches:  trunk
changeset: 377251:6dfa77ef90e8
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Jul 03 11:16:32 2023 +0000

description:
lint: sync usage messages with reality

diffstat:

 usr.bin/xlint/lint1/main1.c |   9 +++++----
 usr.bin/xlint/lint2/main2.c |   8 ++++----
 usr.bin/xlint/xlint/lint.1  |  12 ++++++------
 usr.bin/xlint/xlint/xlint.c |  27 ++++++++++++---------------
 4 files changed, 27 insertions(+), 29 deletions(-)

diffs (173 lines):

diff -r aba06e26a539 -r 6dfa77ef90e8 usr.bin/xlint/lint1/main1.c
--- a/usr.bin/xlint/lint1/main1.c       Mon Jul 03 10:23:12 2023 +0000
+++ b/usr.bin/xlint/lint1/main1.c       Mon Jul 03 11:16:32 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main1.c,v 1.70 2023/07/03 10:23:12 rillig Exp $        */
+/*     $NetBSD: main1.c,v 1.71 2023/07/03 11:16:32 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: main1.c,v 1.70 2023/07/03 10:23:12 rillig Exp $");
+__RCSID("$NetBSD: main1.c,v 1.71 2023/07/03 11:16:32 rillig Exp $");
 #endif
 
 #include <sys/types.h>
@@ -265,8 +265,9 @@ static void __attribute__((noreturn))
 usage(void)
 {
        (void)fprintf(stderr,
-           "usage: %s [-abceghmprstuvwyzFPST] [-Ac11] [-R old=new]\n"
-           "       %*s [-X <id>[,<id>]...] src dest\n",
+           "usage: %s [-abceghmprstuvwyzFPST] [-Alevel] [-ddirectory] "
+           "[-R old=new]\n"
+           "       %*s [-X id,...] [-q id,...] src dest\n",
            getprogname(), (int)strlen(getprogname()), "");
        exit(1);
 }
diff -r aba06e26a539 -r 6dfa77ef90e8 usr.bin/xlint/lint2/main2.c
--- a/usr.bin/xlint/lint2/main2.c       Mon Jul 03 10:23:12 2023 +0000
+++ b/usr.bin/xlint/lint2/main2.c       Mon Jul 03 11:16:32 2023 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: main2.c,v 1.30 2023/07/03 10:23:12 rillig Exp $        */
+/*     $NetBSD: main2.c,v 1.31 2023/07/03 11:16:32 rillig Exp $        */
 
 /*
  * Copyright (c) 1994, 1995 Jochen Pohl
@@ -37,7 +37,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: main2.c,v 1.30 2023/07/03 10:23:12 rillig Exp $");
+__RCSID("$NetBSD: main2.c,v 1.31 2023/07/03 11:16:32 rillig Exp $");
 #endif
 
 #include <stdio.h>
@@ -100,7 +100,7 @@ main(int argc, char *argv[])
        libs = xcalloc(1, sizeof(*libs));
 
        opterr = 0;
-       while ((c = getopt(argc, argv, "hstxuC:HFl:")) != -1) {
+       while ((c = getopt(argc, argv, "hl:stuxC:HF")) != -1) {
                switch (c) {
                case 's':
                        sflag = true;
@@ -178,6 +178,6 @@ static void
 usage(void)
 {
        (void)fprintf(stderr,
-                     "usage: lint2 -hpstxuHFT -Clib -l lib ... src1 ...\n");
+           "usage: %s [-hstuxHF] -Clib -l lib ... src1 ...\n", getprogname());
        exit(1);
 }
diff -r aba06e26a539 -r 6dfa77ef90e8 usr.bin/xlint/xlint/lint.1
--- a/usr.bin/xlint/xlint/lint.1        Mon Jul 03 10:23:12 2023 +0000
+++ b/usr.bin/xlint/xlint/lint.1        Mon Jul 03 11:16:32 2023 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: lint.1,v 1.61 2023/07/03 10:14:31 rillig Exp $
+.\" $NetBSD: lint.1,v 1.62 2023/07/03 11:16:32 rillig Exp $
 .\"
 .\" Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
 .\" Copyright (c) 1994, 1995 Jochen Pohl
@@ -49,10 +49,10 @@
 .Op Fl MD
 .Op Fl l Ar library
 .Op Fl o Ar outputfile
-.Op Fl q Ar id Ns Op ,id ...
+.Op Fl q Ar id Ns Oo Ic , Ns Ar id Oc Ns ...
 .Op Fl U Ar name
 .Op Fl W Ar cppwarnarg
-.Op Fl X Ar id Ns Op ,id ...
+.Op Fl X Ar id Ns Oo Ic , Ns Ar id Oc Ns ...
 .Op Fl Z Ar cpparg
 .Ar
 .Nm lint
@@ -67,7 +67,7 @@
 .Op Fl R Ar old=new
 .Op Fl U Ar name
 .Op Fl W Ar cppwarnarg
-.Op Fl X Ar id Ns Op ,id ...
+.Op Fl X Ar id Ns Oo Ic , Ns Ar id Oc Ns ...
 .Op Fl Z Ar cpparg
 .Ar
 .Sh DESCRIPTION
@@ -345,7 +345,7 @@ when assigning to wider integer types, o
 to wider types.
 .It Fl p
 Attempt to check portability of code to other platforms of C.
-.It Fl q Ar id Ns Op ,id ...
+.It Fl q Ar id Ns Oo Ic , Ns Ar id Oc Ns ...
 In addition to the usual warnings and errors, run the selected queries,
 which are listed in
 .Xr lint 7 Ns .
@@ -426,7 +426,7 @@ Pass the warning directive to
 .Xr cpp 1 .
 .It Fl w
 Treat warnings as errors.
-.It Fl X Ar id Ns Op ,id ...
+.It Fl X Ar id Ns Oo Ic , Ns Ar id Oc Ns ...
 Suppress error messages identified by the list of ids.
 A list of messages and ids can be found in
 .Xr lint 7 .
diff -r aba06e26a539 -r 6dfa77ef90e8 usr.bin/xlint/xlint/xlint.c
--- a/usr.bin/xlint/xlint/xlint.c       Mon Jul 03 10:23:12 2023 +0000
+++ b/usr.bin/xlint/xlint/xlint.c       Mon Jul 03 11:16:32 2023 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: xlint.c,v 1.112 2023/06/28 13:50:47 rillig Exp $ */
+/* $NetBSD: xlint.c,v 1.113 2023/07/03 11:16:32 rillig Exp $ */
 
 /*
  * Copyright (c) 1996 Christopher G. Demetriou.  All Rights Reserved.
@@ -38,7 +38,7 @@
 
 #include <sys/cdefs.h>
 #if defined(__RCSID)
-__RCSID("$NetBSD: xlint.c,v 1.112 2023/06/28 13:50:47 rillig Exp $");
+__RCSID("$NetBSD: xlint.c,v 1.113 2023/07/03 11:16:32 rillig Exp $");
 #endif
 
 #include <sys/param.h>
@@ -238,30 +238,27 @@ terminate(int signo)
 static void __attribute__((__noreturn__, __format__(__printf__, 1, 2)))
 usage(const char *fmt, ...)
 {
-       const char *name;
-       int indent;
        va_list ap;
 
-       name = getprogname();
-       (void)fprintf(stderr, "%s: ", name);
        va_start(ap, fmt);
        (void)vfprintf(stderr, fmt, ap);
        va_end(ap);
        if (fmt[0] != '\0')
                (void)fprintf(stderr, "\n");
 
-       indent = (int)(strlen("usage: ") + strlen(name));
+       const char *name = getprogname();
+       int indent = (int)(strlen("usage: ") + strlen(name));
        (void)fprintf(stderr,
-           "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>]...] [-Ac11] file ...\n",
+           "usage: %s [-abceghprstvwxzFHPSTV] [-Alevel] [-i|-nu]\n"
+           "%*s [-Dname[=def]] [-Uname] [-Idirectory] "
+           "[-M...] [-W...] [-Z ...]\n"
+           "%*s [-ddirectory] [-Ldirectory] [-llibrary] [-ooutputfile]\n"
+           "%*s [-Bpath] [-X id,...] [-q id,...] [-R old=new] file ...\n",
            name, indent, "", indent, "", indent, "");
        (void)fprintf(stderr,
-           "       %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, "");
+           "       %s [-abceghprstvwzFHPSTV] [-Alevel] -Clibrary\n"
+           "%*s [-Bpath] [-R old=new] file ...\n",
+           name, indent, "");
        terminate(-1);
 }
 



Home | Main Index | Thread Index | Old Index