Subject: bin/26256: missing bracket in the usage of shlock(1)
To: None <gnats-bugs@gnats.NetBSD.org>
From: None <hira@po6.nsk.ne.jp>
List: netbsd-bugs
Date: 07/12/2004 12:01:25
>Number: 26256
>Category: bin
>Synopsis: missing bracket in the usage of shlock(1)
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: doc-bug
>Submitter-Id: net
>Arrival-Date: Mon Jul 12 03:04:00 UTC 2004
>Closed-Date:
>Last-Modified:
>Originator: Kouichirou Hiratsuka
>Release: NetBSD 2.0G
>Organization:
>Environment:
System: NetBSD firefly.localdomain 2.0G NetBSD 2.0G (FIREFLY.MP) #21: Sat Jul 10 21:10:28 JST 2004 root@firefly.localdomain:/usr/src/sys/arch/i386/compile/FIREFLY.MP i386
Architecture: i386
Machine: i386
>Description:
A bracket is missing for -p.
% shlock
shlock: USAGE: shlock -f file -p pid [-d][-u]
>How-To-Repeat:
shlock
>Fix:
* add [] to -p
* sort options
* call bad_usage() if unknown option is given
Index: shlock.1
===================================================================
RCS file: /cvs/cvsroot/src/usr.bin/shlock/shlock.1,v
retrieving revision 1.7
diff -u -r1.7 shlock.1
--- shlock.1 2 Oct 2002 10:02:01 -0000 1.7
+++ shlock.1 11 Jul 2004 22:51:16 -0000
@@ -8,11 +8,10 @@
.Nd create or verify a lock file for shell scripts
.Sh SYNOPSIS
.Nm
+.Op Fl du
+.Op Fl p Ar PID
.Fl f
.Ar lockfile
-.Op Fl p Ar PID
-.Op Fl u
-.Op Fl d
.Sh DESCRIPTION
The
.Nm
@@ -46,18 +45,10 @@
holds the lock.
.Pp
The
-.Fl f
-argument with
-.Ar lockfile
-is always required.
-.Pp
-The
-.Fl p
-option with
-.Ar PID
-is given when the program is to create a lock file; when absent,
+.Fl d
+option causes
.Nm
-will simply check for the validity of the lock file.
+to be verbose about what it is doing.
.Pp
The
.Fl u
@@ -67,10 +58,18 @@
to be compatible with the locks created by UUCP.
.Pp
The
-.Fl d
-option causes
+.Fl p
+option with
+.Ar PID
+is given when the program is to create a lock file; when absent,
.Nm
-to be verbose about what it is doing.
+will simply check for the validity of the lock file.
+.Pp
+The
+.Fl f
+argument with
+.Ar lockfile
+is always required.
.Sh EXIT STATUS
A zero exit code indicates a valid lock file.
.Sh EXAMPLES
Index: shlock.c
===================================================================
RCS file: /cvs/cvsroot/src/usr.bin/shlock/shlock.c,v
retrieving revision 1.7
diff -u -r1.7 shlock.c
--- shlock.c 23 Jun 2003 13:05:52 -0000 1.7
+++ shlock.c 11 Jul 2004 23:28:31 -0000
@@ -61,7 +61,7 @@
int Debug = FALSE;
char *Pname;
-const char USAGE[] = "%s: USAGE: shlock -f file -p pid [-d][-u]\n";
+const char USAGE[] = "%s: USAGE: %s [-du] [-p PID] -f lockfile\n";
const char E_unlk[] = "%s: unlink(%s): %s\n";
const char E_open[] = "%s: open(%s): %s\n";
@@ -272,7 +272,7 @@
void
bad_usage(void)
{
- fprintf(stderr, USAGE, Pname);
+ fprintf(stderr, USAGE, Pname, Pname);
exit(LOCK_FAIL);
}
@@ -318,8 +318,7 @@
}
break;
default:
- fprintf(stderr, USAGE, Pname);
- exit(LOCK_FAIL);
+ bad_usage();
}
}
}
>Release-Note:
>Audit-Trail:
>Unformatted: