- use {g,s}etprogname()
- fix usage
This commit is contained in:
parent
2690e9488f
commit
968ce182a5
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: chown.c,v 1.6 2012/10/22 18:02:26 christos Exp $ */
|
||||
/* $NetBSD: chown.c,v 1.7 2012/10/23 17:55:46 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1993, 1994, 2003
|
||||
@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1988, 1993, 1994, 2003\
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)chown.c 8.8 (Berkeley) 4/4/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: chown.c,v 1.6 2012/10/22 18:02:26 christos Exp $");
|
||||
__RCSID("$NetBSD: chown.c,v 1.7 2012/10/23 17:55:46 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -68,7 +68,7 @@ __dead static void usage(void);
|
||||
static uid_t uid;
|
||||
static gid_t gid;
|
||||
static int ischown;
|
||||
static char *myname;
|
||||
static const char *myname;
|
||||
|
||||
struct option chown_longopts[] = {
|
||||
{ "reference", required_argument, 0,
|
||||
@ -86,9 +86,11 @@ main(int argc, char **argv)
|
||||
char *cp, *reference;
|
||||
int (*change_owner)(const char *, uid_t, gid_t);
|
||||
|
||||
setprogname(*argv);
|
||||
|
||||
(void)setlocale(LC_ALL, "");
|
||||
|
||||
myname = (cp = strrchr(*argv, '/')) ? cp + 1 : *argv;
|
||||
myname = getprogname();
|
||||
ischown = (myname[2] == 'o');
|
||||
reference = NULL;
|
||||
|
||||
@ -292,7 +294,9 @@ usage(void)
|
||||
{
|
||||
|
||||
(void)fprintf(stderr,
|
||||
"usage: %s [-R [-H | -L | -P]] [-fhv] %s file ...\n",
|
||||
myname, ischown ? "[owner][:group]" : "group");
|
||||
"Usage: %s [-R [-H | -L | -P]] [-fhv] %s file ...\n"
|
||||
"\t%s [-R [-H | -L | -P]] [-fhv] --reference=rfile file ...\n",
|
||||
myname, ischown ? "owner:group|owner|:group" : "group",
|
||||
myname);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user