From 06a885f378573fb30cd55792407f220c85a43ae5 Mon Sep 17 00:00:00 2001 From: Apple Date: Tue, 18 Feb 2014 20:44:21 +0000 Subject: [PATCH] shell_cmds-179.tar.gz --- hexdump/conv.c | 14 +++++------- hexdump/hexdump.1 | 6 ++++-- id/id.1 | 5 +++++ id/id.c | 32 ++++++++++++++++++++++++---- killall/killall.1 | 10 ++++----- shell_cmds.xcodeproj/project.pbxproj | 12 +++++------ time/time.1 | 17 ++++++--------- uname/uname.c | 4 ++-- 8 files changed, 61 insertions(+), 39 deletions(-) diff --git a/hexdump/conv.c b/hexdump/conv.c index a10baf3..9eebc51 100644 --- a/hexdump/conv.c +++ b/hexdump/conv.c @@ -10,10 +10,6 @@ * 2. Redistributions in binary form must reproduce the above copyright * notice, this list of conditions and the following disclaimer in the * documentation and/or other materials provided with the distribution. - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgement: - * This product includes software developed by the University of - * California, Berkeley and its contributors. * 4. Neither the name of the University nor the names of its contributors * may be used to endorse or promote products derived from this software * without specific prior written permission. @@ -35,7 +31,7 @@ static const char sccsid[] = "@(#)conv.c 8.1 (Berkeley) 6/6/93"; #endif /* not lint */ #include -__FBSDID("$FreeBSD: src/usr.bin/hexdump/conv.c,v 1.8 2004/07/16 11:07:07 johan Exp $"); +__FBSDID("$FreeBSD$"); #include @@ -57,7 +53,7 @@ conv_c(PR *pr, u_char *p, size_t bufsize) wchar_t wc; size_t clen, oclen; int converr, pad, width; - char peekbuf[MB_LEN_MAX]; + u_char peekbuf[MB_LEN_MAX]; if (pr->mbleft > 0) { str = "**"; @@ -107,7 +103,7 @@ retry: if (clen == 0) clen = 1; else if (clen == (size_t)-1 || (clen == (size_t)-2 && - buf == peekbuf)) { + p == peekbuf)) { memset(&pr->mbstate, 0, sizeof(pr->mbstate)); wc = *p; clen = 1; @@ -118,7 +114,7 @@ retry: * can complete it. */ oclen = bufsize; - bufsize = peek(p = (u_char *)peekbuf, MB_CUR_MAX); + bufsize = peek(p = peekbuf, MB_CUR_MAX); goto retry; } clen += oclen; @@ -134,7 +130,7 @@ retry: *pr->cchar = 'C'; assert(strcmp(pr->fmt, "%3C") == 0); width = wcwidth(wc); - assert(width > 0); + assert(width >= 0); pad = 3 - width; if (pad < 0) pad = 0; diff --git a/hexdump/hexdump.1 b/hexdump/hexdump.1 index 6cbe418..5e49a64 100644 --- a/hexdump/hexdump.1 +++ b/hexdump/hexdump.1 @@ -113,15 +113,17 @@ is interpreted as an octal number. Appending the character .Cm b , .Cm k , +.Cm m , or -.Cm m +.Cm g to .Ar offset causes it to be interpreted as a multiple of .Li 512 , .Li 1024 , -or .Li 1048576 , +or +.Li 1073741824 , respectively. .It Fl v Cause diff --git a/id/id.1 b/id/id.1 index c92c29a..1090c9a 100644 --- a/id/id.1 +++ b/id/id.1 @@ -47,6 +47,9 @@ .Nm .Fl A .Nm +.Fl F +.Op Ar user +.Nm .Fl G Op Fl n .Op Ar user .Nm @@ -82,6 +85,8 @@ The options are as follows: .It Fl A Display the process audit user ID and other process audit properties, which requires privilege. +.It Fl F +Display the full name of the user. .It Fl G Display the different group IDs (effective, real and supplementary) as white-space separated numbers, in no particular order. diff --git a/id/id.c b/id/id.c index 4506f9b..2567770 100644 --- a/id/id.c +++ b/id/id.c @@ -67,6 +67,7 @@ void id_print(struct passwd *, int, int, int); void pline(struct passwd *); void pretty(struct passwd *); void auditid(void); +void fullname(struct passwd *); void group(struct passwd *, int); void maclabel(void); void usage(void); @@ -86,10 +87,12 @@ main(int argc, char *argv[]) struct passwd *pw; int Gflag, Mflag, Pflag, ch, gflag, id, nflag, pflag, rflag, uflag; int Aflag; + int Fflag; const char *myname; Gflag = Mflag = Pflag = gflag = nflag = pflag = rflag = uflag = 0; Aflag = 0; + Fflag = 0; myname = strrchr(argv[0], '/'); myname = (myname != NULL) ? myname + 1 : argv[0]; @@ -103,13 +106,16 @@ main(int argc, char *argv[]) } while ((ch = getopt(argc, argv, - (isgroups || iswhoami) ? "" : "APGMagnpru")) != -1) + (isgroups || iswhoami) ? "" : "AFPGMagnpru")) != -1) switch(ch) { #ifdef USE_BSM_AUDIT case 'A': Aflag = 1; break; #endif + case 'F': + Fflag = 1; + break; case 'G': Gflag = 1; break; @@ -146,7 +152,7 @@ main(int argc, char *argv[]) if (iswhoami && argc > 0) usage(); - switch(Aflag + Gflag + Mflag + Pflag + gflag + pflag + uflag) { + switch(Aflag + Fflag + Gflag + Mflag + Pflag + gflag + pflag + uflag) { case 1: break; case 0: @@ -169,6 +175,11 @@ main(int argc, char *argv[]) } #endif + if (Fflag) { + fullname(pw); + exit(0); + } + if (gflag) { id = pw ? pw->pw_gid : rflag ? getgid() : getegid(); if (nflag && (gr = getgrgid(id))) @@ -359,6 +370,18 @@ auditid(void) } #endif +void +fullname(struct passwd *pw) +{ + + if (!pw) { + if ((pw = getpwuid(getuid())) == NULL) + err(1, "getpwuid"); + } + + (void)printf("%s\n", pw->pw_gecos); +} + void group(struct passwd *pw, int nflag) { @@ -387,7 +410,7 @@ group(struct passwd *pw, int nflag) #endif } else { #ifdef __APPLE__ - groups = malloc(NGROUPS + 1); + groups = malloc((NGROUPS + 1) * sizeof(gid_t)); #endif groups[0] = getgid(); ngroups = getgroups(NGROUPS, groups + 1) + 1; @@ -488,13 +511,14 @@ usage(void) else if (iswhoami) (void)fprintf(stderr, "usage: whoami\n"); else - (void)fprintf(stderr, "%s\n%s%s\n%s\n%s\n%s\n%s\n%s\n", + (void)fprintf(stderr, "%s\n%s%s\n%s\n%s\n%s\n%s\n%s\n%s\n", "usage: id [user]", #ifdef USE_BSM_AUDIT " id -A\n", #else "", #endif + " id -F [user]", " id -G [-n] [user]", " id -M", " id -P [user]", diff --git a/killall/killall.1 b/killall/killall.1 index da99668..7c7b59d 100644 --- a/killall/killall.1 +++ b/killall/killall.1 @@ -56,13 +56,8 @@ The super-user is allowed to kill any process. .Pp The options are as follows: .Bl -tag -width 10n -offset indent -.It Fl d | v +.It Fl v Be more verbose about what will be done. -For a single -.Fl d -option, a list of the processes that will be sent the signal will be -printed, or a message indicating that no matching processes have been -found. .It Fl e Use the effective user ID instead of the (default) real user ID for matching processes specified with the @@ -83,6 +78,9 @@ This is dangerous, a single dot will match any process running under the real UID of the caller. .It Fl s Show only what would be done, but do not send any signal. +.It Fl d +Print detailed information about the processes matched, +but do not send any signal. .It Fl SIGNAL Send a different signal instead of the default .Dv TERM . diff --git a/shell_cmds.xcodeproj/project.pbxproj b/shell_cmds.xcodeproj/project.pbxproj index 5f0eff8..ced8bc1 100644 --- a/shell_cmds.xcodeproj/project.pbxproj +++ b/shell_cmds.xcodeproj/project.pbxproj @@ -1592,7 +1592,7 @@ FCBA142A14A141A300AA698B /* xargs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = xargs.c; sourceTree = ""; }; FCBA142D14A141A300AA698B /* yes.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = yes.1; sourceTree = ""; }; FCBA142E14A141A300AA698B /* yes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = yes.c; sourceTree = ""; }; - FCBA149E14A141FF00AA698B /* alias copy */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = "alias copy"; path = apply; sourceTree = BUILT_PRODUCTS_DIR; }; + FCBA149E14A141FF00AA698B /* apply */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = apply; sourceTree = BUILT_PRODUCTS_DIR; }; FCBA14B414A1422D00AA698B /* basename */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = basename; sourceTree = BUILT_PRODUCTS_DIR; }; FCBA14BD14A1423E00AA698B /* chroot */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = chroot; sourceTree = BUILT_PRODUCTS_DIR; }; FCBA14C514A1426800AA698B /* date */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = date; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -1600,7 +1600,7 @@ FCBA14D514A1433F00AA698B /* echo */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = echo; sourceTree = BUILT_PRODUCTS_DIR; }; FCBA14DD14A1434A00AA698B /* env */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = env; sourceTree = BUILT_PRODUCTS_DIR; }; FCBA151414A1453A00AA698B /* expr */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = expr; sourceTree = BUILT_PRODUCTS_DIR; }; - FCBA151C14A1454D00AA698B /* expr copy */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; name = "expr copy"; path = false; sourceTree = BUILT_PRODUCTS_DIR; }; + FCBA151C14A1454D00AA698B /* false */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = false; sourceTree = BUILT_PRODUCTS_DIR; }; FCBA152414A1455600AA698B /* find */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = find; sourceTree = BUILT_PRODUCTS_DIR; }; FCBA152C14A1455900AA698B /* getopt */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = getopt; sourceTree = BUILT_PRODUCTS_DIR; }; FCBA153414A1455C00AA698B /* hostname */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = hostname; sourceTree = BUILT_PRODUCTS_DIR; }; @@ -2082,7 +2082,7 @@ FC80BF6114A05A2F00C6F7F5 /* Products */ = { isa = PBXGroup; children = ( - FCBA149E14A141FF00AA698B /* alias copy */, + FCBA149E14A141FF00AA698B /* apply */, FCBA14B414A1422D00AA698B /* basename */, FCBA14BD14A1423E00AA698B /* chroot */, FCBA14C514A1426800AA698B /* date */, @@ -2090,7 +2090,7 @@ FCBA14D514A1433F00AA698B /* echo */, FCBA14DD14A1434A00AA698B /* env */, FCBA151414A1453A00AA698B /* expr */, - FCBA151C14A1454D00AA698B /* expr copy */, + FCBA151C14A1454D00AA698B /* false */, FCBA152414A1455600AA698B /* find */, FCBA152C14A1455900AA698B /* getopt */, FCBA153414A1455C00AA698B /* hostname */, @@ -2675,7 +2675,7 @@ ); name = apply; productName = shell_cmds; - productReference = FCBA149E14A141FF00AA698B /* alias copy */; + productReference = FCBA149E14A141FF00AA698B /* apply */; productType = "com.apple.product-type.tool"; }; FCBA14AE14A1422D00AA698B /* basename */ = { @@ -2811,7 +2811,7 @@ ); name = false; productName = shell_cmds; - productReference = FCBA151C14A1454D00AA698B /* expr copy */; + productReference = FCBA151C14A1454D00AA698B /* false */; productType = "com.apple.product-type.tool"; }; FCBA151E14A1455600AA698B /* find */ = { diff --git a/time/time.1 b/time/time.1 index 52e2fef..8c4ca8c 100644 --- a/time/time.1 +++ b/time/time.1 @@ -72,16 +72,12 @@ The output is formatted as specified by .St -p1003.2-92 . .El .Pp -The -.Xr csh 1 -has its own and syntactically different builtin version of -.Nm . -The utility described here -is available as -.Pa /usr/bin/time -to -.Xr csh -users. +Some shells may provide a builtin +.Nm +command which is similar or identical to this utility. +Consult the +.Xr builtin 1 +manual page. .Sh DIAGNOSTICS The .Nm @@ -106,6 +102,7 @@ Otherwise, the exit status of shall be that of .Ar utility . .Sh SEE ALSO +.Xr builtin 1 , .Xr csh 1 , .Xr getrusage 2 .Sh FILES diff --git a/uname/uname.c b/uname/uname.c index ddca5fd..7dadd52 100644 --- a/uname/uname.c +++ b/uname/uname.c @@ -185,9 +185,9 @@ main(argc, argv) #else #if defined(__ppc__) || defined(__ppc64__) fputs("powerpc", stdout); -#elif defined (__i386__) || defined(__x86_64__) +#elif defined(__i386__) || defined(__x86_64__) fputs("i386", stdout); -#elif defined(__arm__) +#elif defined(__arm__) || defined(__arm64__) fputs("arm", stdout); #else fputs("unknown", stdout); -- 2.45.2