Source-Changes-HG archive

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

[src/trunk]: src/usr.bin/flock Sort options and their descriptions. Sync usag...



details:   https://anonhg.NetBSD.org/src/rev/d0c2e846f8e3
branches:  trunk
changeset: 782405:d0c2e846f8e3
user:      wiz <wiz%NetBSD.org@localhost>
date:      Fri Nov 02 02:03:18 2012 +0000

description:
Sort options and their descriptions. Sync usage with man page.

diffstat:

 usr.bin/flock/flock.1 |  43 +++++++++++++++++++++----------------------
 usr.bin/flock/flock.c |  11 +++++------
 2 files changed, 26 insertions(+), 28 deletions(-)

diffs (140 lines):

diff -r 01865762e457 -r d0c2e846f8e3 usr.bin/flock/flock.1
--- a/usr.bin/flock/flock.1     Fri Nov 02 01:30:46 2012 +0000
+++ b/usr.bin/flock/flock.1     Fri Nov 02 02:03:18 2012 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: flock.1,v 1.3 2012/11/02 01:30:46 christos Exp $
+.\"    $NetBSD: flock.1,v 1.4 2012/11/02 02:03:18 wiz Exp $
 .\"
 .\" Copyright (c) 2012 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -29,21 +29,20 @@
 .\"
 .\"
 .Dd November 1, 2012
-.Dt flock 1
+.Dt FLOCK 1
 .Os
 .Sh NAME
 .Nm flock
 .Nd Provide locking API for shell scripts
 .Sh SYNOPSIS
 .Nm
-.Op Fl dnosxv
+.Op Fl dnosvx
 .Op Fl w Ar timeout
 .Ar lockfile|lockdir
-.Op Fl c Ar command
-|
+.Op Fl c
 .Op Ar command ...
 .Nm
-.Op Fl dnusxv
+.Op Fl dnsuvx
 .Op Fl w Ar timeout
 .Ar lockfd
 .Sh DESCRIPTION
@@ -57,44 +56,44 @@
 .Pp
 The second form can use an arbitrary file descriptor that is provided from a
 shell script for example:
-.nf
+.Bd -literal
 (
        flock -s 100
        # commands to be executed under the lock
 ) 100> /path/to/lockfile
-.if
+.Ed
 .Pp
 The following options are available:
 .Bl -tag -width "XXXXXXXXXXXXXXXXX"
 .It Fl c Ar command
 Pass a command to a the shell.
-.It Fl d Fl Fl debug
+.It Fl d , Fl Fl debug
 Provide debugging output.
-.It Fl s Fl Fl shared
+.It Fl n , Fl Fl nb , Fl Fl nonblock
+Don't block and fail immediately if the lock could not be obtained.
+.It Fl o , Fl Fl close
+Close the file before executing the command.
+This is useful if the child forks and should not be holding the lock.
+.It Fl s , Fl Fl shared
 Obtain a shared lock.
-.It Fl e Fl x Fl Fl exclusive
-Obtain an exclusive lock.
-.It Fl u Fl Fl unlock
+.It Fl u , Fl Fl unlock
 Unlock an existing lock.
 This is available only for a file descriptor.
-.It Fl n Fl Fl nb Fl Fl nonblock
-Don't block and fail immediately if the lock could not be obtained.
-.If Fl v Fl Fl verbose
+.It Fl v , Fl Fl verbose
 On error print an explanation of the failure.
-.It Fl w Fl Fl wait Fl Fl timeout Ar seconds
+.It Fl w , Fl Fl wait , Fl Fl timeout Ar seconds
 Fail if the lock could not be obtained after
 .Ar seconds .
 Seconds are truncated to integer values.
-.It Fl o Fl Fl close
-Close the file before executing the command.
-This is useful if the child forks and should not be holding the lock.
+.It Fl x , Fl Fl exclusive
+Obtain an exclusive lock.
 .El
 .Sh EXIT STATUS
 .Ex -std
 .Sh SEE ALSO
 .Xr flock 2
 .Sh HISTORY
-A
+An
 .Nm
 utility appeared in
-.Nx 7
+.Nx 7.0 .
diff -r 01865762e457 -r d0c2e846f8e3 usr.bin/flock/flock.c
--- a/usr.bin/flock/flock.c     Fri Nov 02 01:30:46 2012 +0000
+++ b/usr.bin/flock/flock.c     Fri Nov 02 02:03:18 2012 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: flock.c,v 1.2 2012/11/02 01:30:46 christos Exp $       */
+/*     $NetBSD: flock.c,v 1.3 2012/11/02 02:03:18 wiz Exp $    */
 
 /*-
  * Copyright (c) 2012 The NetBSD Foundation, Inc.
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__RCSID("$NetBSD: flock.c,v 1.2 2012/11/02 01:30:46 christos Exp $");
+__RCSID("$NetBSD: flock.c,v 1.3 2012/11/02 02:03:18 wiz Exp $");
 
 #include <stdio.h>
 #include <string.h>
@@ -65,8 +65,8 @@
 
 static __dead void usage(void) 
 {
-       fprintf(stderr, "Usage: %s [-dnosxv] [-w <timeout>] file|directory [-c] "
-           "<command>\n\t%s [-dnusxv] [-w <timeout>] fd\n", getprogname(),
+       fprintf(stderr, "Usage: %s [-dnosvx] [-w timeout] lockfile|lockdir [-c] "
+           "command\n\t%s [-dnsuvx] [-w timeout] lockfd\n", getprogname(),
            getprogname());
        exit(EXIT_FAILURE);
 }
@@ -121,13 +121,12 @@
 
        setprogname(argv[0]);
 
-       while ((c = getopt_long(argc, argv, "+dnosxuw:", flock_longopts, NULL))
+       while ((c = getopt_long(argc, argv, "+dnosuw:x", flock_longopts, NULL))
            != -1)
                switch (c) {
                case 'd':
                        debug++;
                        break;
-               case 'e':
                case 'x':
                        lock = LOCK_EX | (lock & ~LOCK_NB);
                        break;



Home | Main Index | Thread Index | Old Index