improve usage messages (thanks henesy)

Fix inconsistencies between programs and their usage
messages,  correct instances where information seems
to be missing or lost. This  includes missing arguments,
making usage consistent with manuals, and so on.
This commit is contained in:
Ori Bernstein 2020-03-10 10:09:34 -07:00
parent 06ea44c895
commit 5bc9b0c3ca
34 changed files with 47 additions and 38 deletions

View file

@ -1,6 +1,6 @@
#!/bin/rc
if(! ~ $#* 3){
echo usage: approx ratio min max
echo usage: approx ratio min max >[1=2]
exit usage
}
echo $1 $2 $3 | awk '

View file

@ -3,7 +3,7 @@
rfork en
if(! ~ $#* 0 1) {
echo 'Usage: doc2txt [file.doc]' >[1=2]
echo 'usage: doc2txt [file.doc]' >[1=2]
exit usage
}

View file

@ -1,6 +1,11 @@
#!/bin/rc
# doctype: synthesize proper command line for troff
if(~ $#* 0){
echo 'usage: doctype [ -n ] [ -T dev ] [ file ] ...' >[1=2]
exit usage
}
troff=troff
eqn=eqn
prefer=prefer

View file

@ -26,7 +26,7 @@ while(! ~ $#* 0) {
sname=$2
shift
case -*
echo Usage: classical [-d level] [-t] [-h srvhost]
echo usage: juke [-d level] [-tw] [-s srv] [-h srvhost] >[1=2]
exit usage
}
shift

View file

@ -16,7 +16,7 @@ fn sigint sighup sigterm {
*=`{echo $*|tr A-Z a-z|tr -dc 'a-z0-9_. \012'} # fold case, delete funny chars
if(~ $#* 0){
echo Usage: lookman key ... >/fd/2
echo usage: lookman key ... >/fd/2
exit usage
}
look $1 $index | sed 's/.* //' | sort -u >$t1

View file

@ -93,7 +93,7 @@ flagfmt='D,H,L,Q,R,r,q,M mach,c copies,d printer,f font.size,i src,k jobnos,l li
argv0=lp
if(! ifs=() eval `{aux/getflags $*}) {
echo $USAGE
echo $USAGE >[1=2]
exit usage
}
if(~ $flagd '?'){

View file

@ -59,8 +59,8 @@ fn page {
search=yes
while(~ $d 0) {
if(~ $#* 0) {
echo 'Usage: man [-bntpPSw] [0-9] [0-9] ... name1 name2 ...' >[1=2]
exit
echo 'usage: man [-bntpPSw] [0-9] [0-9] ... name1 name2 ...' >[1=2]
exit usage
}
if(test -d $S/$1){
sec=($sec $1)

View file

@ -10,8 +10,8 @@ case -v
switch($#*){
case 0 1
echo usage: $0 telephone-number recipient '[files]'
exit 0
echo usage: $0 telephone-number recipient '[files]' >[1=2]
exit usage
case 2
stdin=yes
}

View file

@ -15,6 +15,6 @@ case 0
case 1
ps $flags | sed -n '/^'$1' /p'
case *
echo Usage: psu '[ps-flags] [ user ]' >[1=2]
echo usage: psu '[ps-flags] [ user ]' >[1=2]
exit usage
}

View file

@ -5,8 +5,8 @@
*=`{echo $*|tr A-Z a-z|tr -dc 'a-z0-9_ \012'} # fold case, delete funny chars
if(~ $#* 0){
echo Usage: sig function ... >/fd/2
exit 1
echo usage: sig function ... >/fd/2
exit usage
}
for (i) {

View file

@ -4,7 +4,8 @@ rfork e
flagfmt='n,e script,f sfile'
args='[ file ... ]'
fn usage { echo $0 '[ -n ] [ -e script ] [ -f sfile ] [ file ... ]' >[1=2] }
argv0=$0
fn usage { echo usage: $argv0 '[ -n ] [ -e script ] [ -f sfile ] [ file ... ]' >[1=2] }
if(! ifs=() eval `{aux/getflags $*}){
usage
exit usage

View file

@ -2,7 +2,7 @@
rfork e
if(~ $#* 0){
echo 'Usage: ' $0 '[ pid ... ]' >[1=2]
echo 'usage:' $0 '[ pid ... ]' >[1=2]
exit usage
}

View file

@ -4,7 +4,7 @@ mothra \- retrieve and display World-Wide Web files
.SH SYNOPSIS
.B mothra
[
.B -va
.B -dvak
]
[
.B -m
@ -71,6 +71,9 @@ The default is
.B -v
Verbose mode. Causes HTML errors to be printed
on file-descriptor 2.
.TP
.B -d
Enables debug mode.
.PP
The display contains the last message from
.I mothra,

View file

@ -65,7 +65,7 @@ static void timerproc(void *);
static void
usage(void)
{
fprint(2, "Usage: %s [-cd] [-m maxto] dialstring|netdir\n", argv0);
fprint(2, "usage: %s [-cd] [-m maxto] dialstring|netdir\n", argv0);
exits("usage");
}

View file

@ -5,7 +5,7 @@
void
usage(void)
{
fprint(2, "Usage:\n\t%s user pass\n\t%s authorization\n", argv0, argv0);
fprint(2, "usage:\n\t%s user pass\n\t%s authorization\n", argv0, argv0);
exits("usage");
}

View file

@ -62,7 +62,7 @@ void main(int argc, char *argv[])
cmdname = argv[0];
if (argc == 1) {
Bprint(&stderr, "Usage: %s [-F fieldsep] [-mf n] [-mr n] [-v var=value] [-f programfile | 'program'] [file ...]\n", cmdname);
Bprint(&stderr, "usage: %s [-F fieldsep] [-d] [-mf n] [-mr n] [-safe] [-v var=value] [-f programfile | 'program'] [file ...]\n", cmdname);
exits("usage");
}

View file

@ -956,7 +956,7 @@ main(int argc, char **argv)
sflag++;
break;
default:
fprint(2, "Usage: bc [-cdls] [file ...]\n");
fprint(2, "usage: bc [-cdls] [file ...]\n");
exits("usage");
}
argc--;

View file

@ -102,7 +102,7 @@ main(int argc, char *argv[])
if(argc){
Usage:
fprint(2, "Usage: %s [-rx]\n", argv0);
fprint(2, "usage: %s [-rx]\n", argv0);
exits("usage");
}

View file

@ -112,9 +112,9 @@ code_int getcode();
Usage()
{
#ifdef DEBUG
fprintf(stderr,"Usage: compress [-cdfDV] [-b maxbits] [file ...]\n");
fprintf(stderr,"usage: compress [-cdfDV] [-b maxbits] [file ...]\n");
#else
fprintf(stderr,"Usage: compress [-cdfvV] [-b maxbits] [file ...]\n");
fprintf(stderr,"usage: compress [-cdfvV] [-b maxbits] [file ...]\n");
#endif /* DEBUG */
}

View file

@ -93,7 +93,7 @@ main(int argc, char **argv)
sprint(b2, "/proc/%s/mem", argv[0]);
corfil = b2;
} else if (argc > 0) {
fprint(2, "Usage: db [-kw] [-m machine] [-I dir] [symfile] [pid]\n");
fprint(2, "usage: db [-kw] [-m machine] [-I dir] [symfile] [pid]\n");
exits("usage");
}
if (!symfil)

View file

@ -1,8 +1,8 @@
# turn output of mkindex into form needed by dict
BEGIN {
if(ARGC != 2) {
print "Usage: awk -F' ' -f canonind.awk rawindex > index"
exit 1
print "usage: awk -F' ' -f canonind.awk rawindex > index"
exit usage
}
file = ARGV[1]
ARGV[1] = ""

View file

@ -160,7 +160,7 @@ usage(void)
int i;
char *a, *b;
Bprint(bout, "Usage: %s [-d dict] [-k] [-c cmd] [word]\n", argv0);
Bprint(bout, "usage: %s [-k] [-d dict] [-c cmd] [pattern]\n", argv0);
Bprint(bout, "dictionaries (brackets mark dictionaries not present on this system):\n");
for(i = 0; dicts[i].name; i++){
a = b = "";

View file

@ -131,7 +131,7 @@ main(int argc, char *argv[])
int fd, id;
if(argc>2){
fprint(2, "Usage: %s colormap\n", argv[0]);
fprint(2, "usage: %s colormap\n", argv[0]);
exits("usage");
}
map = "rgbv";

View file

@ -236,7 +236,7 @@ void
badusage(void)
{
fprint(2, "Usage: mk [-f file] [-n] [-a] [-e] [-t] [-k] [-i] [-d[egp]] [targets ...]\n");
fprint(2, "usage: mk [-f file] [-n] [-a] [-e] [-t] [-k] [-i] [-d[egp]] [targets ...]\n");
Exit();
}

View file

@ -331,7 +331,7 @@ void main(int argc, char *argv[]){
switch(argc){
default:
Usage:
fprint(2, "Usage: %s [-dvak] [-m mtpt] [url]\n", argv0);
fprint(2, "usage: %s [-dvak] [-m mtpt] [url]\n", argv0);
exits("usage");
case 0:
url=getenv("url");

View file

@ -156,7 +156,7 @@ writer(int lastpid)
void
usage(void)
{
fprint(2, "Usage: ratrace [-c cmd [arg...]] | [pid]\n");
fprint(2, "usage: ratrace [-c cmd [arg...]] | [pid]\n");
threadexits("usage");
}

View file

@ -10,7 +10,7 @@ static char exitstr[ERRMAX];
void
usage(void)
{
fprint(2, "Usage: %s [-r5] [files]\n", argv0);
fprint(2, "usage: %s [-5r] [file ...]\n", argv0);
exits("usage");
}

View file

@ -12,7 +12,7 @@ main(int argc, char **argv)
} ARGEND;
if(argc != 1){
fprint(2, "Usage: swap file\n");
fprint(2, "usage: swap file\n");
exits("usage");
}

View file

@ -82,6 +82,6 @@ main(int argc, char **argv)
static void
usage(void)
{
fprint(2, "Usage: %s [-s] from to\n", argv0);
fprint(2, "usage: %s [-s] from to\n", argv0);
exits("usage");
}

View file

@ -65,7 +65,7 @@ bitblt(&screen, screen.r.min, b, b->r, S); bflush();sleep(5000);
static void
usage(void)
{
fprint(2, "Usage: %s file ...\n", argv0);
fprint(2, "usage: %s file ...\n", argv0);
exits("usage");
}

View file

@ -96,7 +96,7 @@ main(int argc, char **argv)
void
usage(void)
{
fprint(2, "Usage: %s [-slv] [-f cs] [-t cs] [file ...]\n", argv0);
fprint(2, "usage: %s [-slcv] [-f ics] [-t ocs] [file ...]\n", argv0);
verbose = 1;
list();
exits("usage");

View file

@ -124,7 +124,7 @@ char*profdev = "/proc/trace";
static void
usage(void)
{
fprint(2, "Usage: %s [-d profdev] [-w] [-v] [-t triggerproc] [processes]\n", argv0);
fprint(2, "usage: %s [-d profdev] [-w] [-v] [-t triggerproc] [pid ...]\n", argv0);
exits(nil);
}

View file

@ -26,7 +26,7 @@ hexdigit(int c)
void
usage(void)
{
fprint(2, "Usage: %s [ -d ] [ file ]\n", argv0);
fprint(2, "usage: %s [ -d ] [ file ]\n", argv0);
exits("usage");
}

View file

@ -28,7 +28,7 @@ main(int argc, char *argv[])
case 'b': pbadr++; break;
case 'c': pchar++; break;
default:
fprint(2, "Usage: %s [-lwrbc] [file ...]\n", argv0);
fprint(2, "usage: %s [-lwrbc] [file ...]\n", argv0);
exits("usage");
} ARGEND
if(pline+pword+prune+pbadr+pchar == 0) {