]> git.saurik.com Git - apple/shell_cmds.git/commitdiff
shell_cmds-179.tar.gz os-x-1010 os-x-10101 os-x-10102 os-x-10103 os-x-10104 os-x-10105 v179
authorApple <opensource@apple.com>
Tue, 18 Feb 2014 20:44:21 +0000 (20:44 +0000)
committerApple <opensource@apple.com>
Tue, 18 Feb 2014 20:44:21 +0000 (20:44 +0000)
hexdump/conv.c
hexdump/hexdump.1
id/id.1
id/id.c
killall/killall.1
shell_cmds.xcodeproj/project.pbxproj
time/time.1
uname/uname.c

index a10baf3b4f6fcb4413d87303afe8e31e6dce3df7..9eebc5121913e81b24c74f50b27ba511c196b08c 100644 (file)
  * 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 <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/usr.bin/hexdump/conv.c,v 1.8 2004/07/16 11:07:07 johan Exp $");
+__FBSDID("$FreeBSD$");
 
 #include <sys/types.h>
 
@@ -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;
index 6cbe418d5c266b77b2ba71c2503a556bca27b7bb..5e49a64a1127addbbc9f80d34a4510ea31c12ab4 100644 (file)
@@ -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 c92c29a9c36610d1e299483b47dc1799d6f894fb..1090c9a11e55c7c16b1081ffae2f1e257fa1056d 100644 (file)
--- 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 4506f9b75ec096b4343677d9676008840a569e6b..2567770fdb8efce1ceb9ed243fe70934708abaaa 100644 (file)
--- 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]",
index da99668a569a22eb48499af8935b1bf02400e2b2..7c7b59dc58764e29f8f77d3bcb9769c69f158144 100644 (file)
@@ -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 .
index 5f0eff8965a58a4702c90fc8737a9cf97cafe52f..ced8bc15db7e8d1842a961b2f1fa0ccb951e000c 100644 (file)
                FCBA142A14A141A300AA698B /* xargs.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = xargs.c; sourceTree = "<group>"; };
                FCBA142D14A141A300AA698B /* yes.1 */ = {isa = PBXFileReference; lastKnownFileType = text.man; path = yes.1; sourceTree = "<group>"; };
                FCBA142E14A141A300AA698B /* yes.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = yes.c; sourceTree = "<group>"; };
-               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; };
                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; };
                FC80BF6114A05A2F00C6F7F5 /* Products */ = {
                        isa = PBXGroup;
                        children = (
-                               FCBA149E14A141FF00AA698B /* alias copy */,
+                               FCBA149E14A141FF00AA698B /* apply */,
                                FCBA14B414A1422D00AA698B /* basename */,
                                FCBA14BD14A1423E00AA698B /* chroot */,
                                FCBA14C514A1426800AA698B /* date */,
                                FCBA14D514A1433F00AA698B /* echo */,
                                FCBA14DD14A1434A00AA698B /* env */,
                                FCBA151414A1453A00AA698B /* expr */,
-                               FCBA151C14A1454D00AA698B /* expr copy */,
+                               FCBA151C14A1454D00AA698B /* false */,
                                FCBA152414A1455600AA698B /* find */,
                                FCBA152C14A1455900AA698B /* getopt */,
                                FCBA153414A1455C00AA698B /* hostname */,
                        );
                        name = apply;
                        productName = shell_cmds;
-                       productReference = FCBA149E14A141FF00AA698B /* alias copy */;
+                       productReference = FCBA149E14A141FF00AA698B /* apply */;
                        productType = "com.apple.product-type.tool";
                };
                FCBA14AE14A1422D00AA698B /* basename */ = {
                        );
                        name = false;
                        productName = shell_cmds;
-                       productReference = FCBA151C14A1454D00AA698B /* expr copy */;
+                       productReference = FCBA151C14A1454D00AA698B /* false */;
                        productType = "com.apple.product-type.tool";
                };
                FCBA151E14A1455600AA698B /* find */ = {
index 52e2fef66d8f4b26bfbefe345278341ab34ed9ee..8c4ca8ca1b172475fef4693f14aa4077a327d2ba 100644 (file)
@@ -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
index ddca5fdb8412f54d54c1a665e3421bcf4132fb81..7dadd5296e52a206acac1e8f3e671812b120d2df 100644 (file)
@@ -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);