sbase

suckless unix tools
git clone git://git.2f30.org/sbase.git
Log | Files | Refs | README | LICENSE

commit aa6ac30b815adf52b1c3c705120bad59081ba697
parent 16719ea6e1ef29d6a570de27917aec881622fd8c
Author: sin <sin@2f30.org>
Date:   Tue Feb 17 16:41:58 +0000

chown: Update program usage and manpage

Diffstat:
chown.1 | 23++++++++++++++++-------
chown.c | 14+++++++-------
2 files changed, 23 insertions(+), 14 deletions(-)
diff --git a/chown.1 b/chown.1 @@ -1,4 +1,4 @@ -.Dd January 30, 2015 +.Dd Feburary 17, 2015 .Dt CHOWN 1 .Os sbase .Sh NAME @@ -6,10 +6,11 @@ .Nd change file ownership .Sh SYNOPSIS .Nm -.Op Fl Rr -.Op Fl H -.Op Fl L -.Op Fl P +.Op Fl h +.Oo +.Fl R +.Op Fl H | L | P +.Oc .Op Ar owner Op Ar :group .Op Ar file ... .Sh DESCRIPTION @@ -18,9 +19,11 @@ changes the user or group ownership for the given .Ar files . .Sh OPTIONS .Bl -tag -width Ds +.It Fl h +Change the user ID and/or group ID of the symlink itself. This flag cannot be used +with +.Op Fl R . .It Fl R -Equivalent to \-r. -.It Fl r Change directory ownership recursively. .It Fl H Only dereference symbolic links that are passed as command line arguments when @@ -32,3 +35,9 @@ Don't dereference symbolic links (default). .El .Sh SEE ALSO .Xr chown 2 +.Sh STANDARDS +The +.Nm +utility is compliant with the +.St -p1003.1-2008 +specification. diff --git a/chown.c b/chown.c @@ -9,7 +9,7 @@ #include "util.h" static int rflag = 0; -static int fflag = 'P'; +static int HLPflag = 'P'; static uid_t uid = -1; static gid_t gid = -1; static int ret = 0; @@ -17,20 +17,20 @@ static char *chown_f_name = "chown"; static int (*chown_f)(const char *, uid_t, gid_t) = chown; static void -chownpwgr(const char *path, int fflag) +chownpwgr(const char *path, int HLPflag) { if (chown_f(path, uid, gid) < 0) { weprintf("%s %s:", chown_f_name, path); ret = 1; } if (rflag) - recurse(path, chownpwgr, fflag); + recurse(path, chownpwgr, HLPflag); } static void usage(void) { - eprintf("usage: %s [-hRr] [owner][:[group]] file...\n", argv0); + eprintf("usage: %s [-h] [-R [-H | -L | -P]] [owner][:[group]] file...\n", argv0); } int @@ -45,14 +45,14 @@ main(int argc, char *argv[]) chown_f_name = "lchown"; chown_f = lchown; break; - case 'R': case 'r': + case 'R': rflag = 1; break; case 'H': case 'L': case 'P': - fflag = ARGC(); + HLPflag = ARGC(); break; default: usage(); @@ -94,7 +94,7 @@ main(int argc, char *argv[]) } } for (; argc > 0; argc--, argv++) - chownpwgr(argv[0], fflag); + chownpwgr(argv[0], HLPflag); return ret; }