Module Name: src
Committed By: rillig
Date: Mon Jul 3 11:16:32 UTC 2023
Modified Files:
src/usr.bin/xlint/lint1: main1.c
src/usr.bin/xlint/lint2: main2.c
src/usr.bin/xlint/xlint: lint.1 xlint.c
Log Message:
lint: sync usage messages with reality
To generate a diff of this commit:
cvs rdiff -u -r1.70 -r1.71 src/usr.bin/xlint/lint1/main1.c
cvs rdiff -u -r1.30 -r1.31 src/usr.bin/xlint/lint2/main2.c
cvs rdiff -u -r1.61 -r1.62 src/usr.bin/xlint/xlint/lint.1
cvs rdiff -u -r1.112 -r1.113 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/lint1/main1.c
diff -u src/usr.bin/xlint/lint1/main1.c:1.70 src/usr.bin/xlint/lint1/main1.c:1.71
--- src/usr.bin/xlint/lint1/main1.c:1.70 Mon Jul 3 10:23:12 2023
+++ src/usr.bin/xlint/lint1/main1.c Mon Jul 3 11:16:32 2023
@@ -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);
}
Index: src/usr.bin/xlint/lint2/main2.c
diff -u src/usr.bin/xlint/lint2/main2.c:1.30 src/usr.bin/xlint/lint2/main2.c:1.31
--- src/usr.bin/xlint/lint2/main2.c:1.30 Mon Jul 3 10:23:12 2023
+++ src/usr.bin/xlint/lint2/main2.c Mon Jul 3 11:16:32 2023
@@ -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);
}
Index: src/usr.bin/xlint/xlint/lint.1
diff -u src/usr.bin/xlint/xlint/lint.1:1.61 src/usr.bin/xlint/xlint/lint.1:1.62
--- src/usr.bin/xlint/xlint/lint.1:1.61 Mon Jul 3 10:14:31 2023
+++ src/usr.bin/xlint/xlint/lint.1 Mon Jul 3 11:16:32 2023
@@ -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 .
Index: src/usr.bin/xlint/xlint/xlint.c
diff -u src/usr.bin/xlint/xlint/xlint.c:1.112 src/usr.bin/xlint/xlint/xlint.c:1.113
--- src/usr.bin/xlint/xlint/xlint.c:1.112 Wed Jun 28 13:50:47 2023
+++ src/usr.bin/xlint/xlint/xlint.c Mon Jul 3 11:16:32 2023
@@ -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);
}