]> Zhao Yanbai Git Server - minix.git/commitdiff
Importing usr.bin/id 45/1145/1
authorThomas Cort <tcort@minix3.org>
Tue, 12 Nov 2013 13:40:59 +0000 (08:40 -0500)
committerThomas Cort <tcort@minix3.org>
Tue, 12 Nov 2013 15:15:47 +0000 (10:15 -0500)
Replaces commands/id. No Minix-specific changes needed.

Change-Id: I307ae0fa3f41ade398ee9be12c1b4d78e8b59e95

commands/Makefile
releasetools/nbsd_ports
tests/usr.bin/id/Makefile
usr.bin/Makefile
usr.bin/id/Makefile [moved from commands/id/Makefile with 64% similarity]
usr.bin/id/groups.1 [moved from commands/id/groups.1 with 100% similarity]
usr.bin/id/id.1 [moved from commands/id/id.1 with 100% similarity]
usr.bin/id/id.c [moved from commands/id/id.c with 95% similarity]
usr.bin/id/whoami.1 [moved from commands/id/whoami.1 with 100% similarity]

index 4754ecbf4501f875890f370ee3124c538574e14d..99bc45defbb95e5a40cfb5d274f5ca30104c9a19 100644 (file)
@@ -11,7 +11,7 @@ SUBDIR=       add_route arp ash at backup btrace \
        eject factor fbdctl \
        find fix format fortune fsck.mfs \
        gcore gcov-pull getty grep host \
-       hostaddr id ifconfig ifdef \
+       hostaddr ifconfig ifdef \
        intr ipcrm ipcs irdpd isoread last \
        less loadkeys loadramdisk logger look lp \
        lpd lspci mail MAKEDEV \
index 5082b3f9225f0d918c921e05f9259701ef8a7efc..ca05b4b6e5082c473bddae1c70fb81843d8ecd00 100644 (file)
 2012/10/17 12:00:00,usr.bin/genassym
 2013/03/09 12:00:00,usr.bin/getopt
 2012/10/17 12:00:00,usr.bin/gzip
+2012/10/17 12:00:00,usr.bin/id
 2012/10/17 12:00:00,usr.bin/indent
 2012/10/17 12:00:00,usr.bin/infocmp
 2012/10/17 12:00:00,usr.bin/join
index 8ceff408de4dda5987f1ba17e0d0836ead5c7479..3d09019efb44cee46073811a9aeae39be0528862 100644 (file)
@@ -12,11 +12,7 @@ TESTS_SH+=   t_whoami
 
 BINDIR=                ${TESTSDIR}
 PROG=          h_id
-.if defined(__MINIX)
-.PATH:         ${NETBSDSRCDIR}/commands/id
-.else
 .PATH:         ${NETBSDSRCDIR}/usr.bin/id
-.endif # defined(__MINIX)
 SRCS=          id.c pwgr.c
 
 COPTS.id.c += -Wno-format-nonliteral
index 5f719b50bb8acca88d9a91bf148b18d58e9e3bcf..04c9916dfd9ad3cd9f5a93791df640632cb7a5f4 100644 (file)
@@ -12,7 +12,7 @@ SUBDIR= asa \
        env expand \
        finger fold from \
        fsplit ftp genassym getopt \
-       head hexdump indent infocmp join jot \
+       head hexdump id indent infocmp join jot \
        lam ldd leave \
        lock login logname lorder m4 \
        machine make man menuc mesg \
similarity index 64%
rename from commands/id/Makefile
rename to usr.bin/id/Makefile
index 4e11db3caf6d3f6f40b768cda092acf0f1d7d234..ce0d24dc5eb762e722d272de7930eb65311311cd 100644 (file)
@@ -1,4 +1,4 @@
-#      $NetBSD: Makefile,v 1.11 2006/10/08 17:52:28 peter Exp $
+#      $NetBSD: Makefile,v 1.13 2011/08/16 10:37:21 christos Exp $
 #      from: @(#)Makefile      8.1 (Berkeley) 6/6/93
 
 PROG=  id
@@ -6,4 +6,6 @@ MAN=    id.1 groups.1 whoami.1
 LINKS=   ${BINDIR}/id ${BINDIR}/groups
 LINKS+=  ${BINDIR}/id ${BINDIR}/whoami
 
+COPTS.id.c += -Wno-format-nonliteral
+
 .include <bsd.prog.mk>
similarity index 100%
rename from commands/id/groups.1
rename to usr.bin/id/groups.1
similarity index 100%
rename from commands/id/id.1
rename to usr.bin/id/id.1
similarity index 95%
rename from commands/id/id.c
rename to usr.bin/id/id.c
index 86797fb54f8e419e419b60ed834927b12a86faca..720cc495486f29f9a67e6946f8f87d9c54d8b872 100644 (file)
  */
 
 #include <sys/cdefs.h>
+#ifndef lint
+__COPYRIGHT("@(#) Copyright (c) 1991, 1993\
+ The Regents of the University of California.  All rights reserved.");
+#endif /* not lint */
+
+#ifndef lint
+#if 0
+static char sccsid[] = "@(#)id.c       8.3 (Berkeley) 4/28/95";
+#else
+__RCSID("$NetBSD: id.c,v 1.32 2011/09/16 15:39:26 joerg Exp $");
+#endif
+#endif /* not lint */
 
 #include <sys/param.h>
 
@@ -43,7 +55,7 @@
 static void current(void);
 static void pretty(struct passwd *);
 static void group(struct passwd *, int);
-static void usage(void);
+__dead static void usage(void);
 static void user(struct passwd *);
 static struct passwd *who(char *);
 
@@ -229,7 +241,6 @@ current(void)
                if ((gr = getgrgid(egid)) != NULL)
                        (void)printf("(%s)", gr->gr_name);
        }
-#ifndef __minix
        if ((ngroups = getgroups(maxgroups, groups)) != 0) {
                for (fmt = " groups=%ju", lastid = -1, cnt = 0; cnt < ngroups;
                    fmt = ",%ju", lastid = gid, cnt++) {
@@ -241,7 +252,6 @@ current(void)
                                (void)printf("(%s)", gr->gr_name);
                }
        }
-#endif
        (void)printf("\n");
 }
 
@@ -259,12 +269,10 @@ user(struct passwd *pw)
        if ((gr = getgrgid(pw->pw_gid)) != NULL)
                (void)printf("(%s)", gr->gr_name);
        ngroups = maxgroups + 1;
-#ifndef __minix
        if (getgrouplist(pw->pw_name, pw->pw_gid, glist, &ngroups) == -1) {
                glist = malloc(ngroups * sizeof(gid_t));
                (void) getgrouplist(pw->pw_name, pw->pw_gid, glist, &ngroups);
        }
-#endif
        for (fmt = " groups=%u", lastid = -1, cnt = 0; cnt < ngroups;
            fmt=",%u", lastid = id, cnt++) {
                id = glist[cnt];
@@ -283,21 +291,19 @@ static void
 group(struct passwd *pw, int nflag)
 {
        struct group *gr;
-       int cnt, id, lastid, ngroups;
+       int cnt, ngroups;
+       gid_t id, lastid;
        const char *fmt;
        gid_t *glist = groups;
 
        if (pw) {
                ngroups = maxgroups;
-#ifndef __minix
                if (getgrouplist(pw->pw_name, pw->pw_gid, glist, &ngroups)
                    == -1) {
                        glist = malloc(ngroups * sizeof(gid_t));
                        (void) getgrouplist(pw->pw_name, pw->pw_gid, glist,
                                            &ngroups);
-
                }
-#endif
        } else {
                glist[0] = getgid();
                ngroups = getgroups(maxgroups, glist + 1) + 1;
similarity index 100%
rename from commands/id/whoami.1
rename to usr.bin/id/whoami.1