BSD 4_4_Lite2 release
[unix-history] / usr / src / usr.bin / id / id.c
index 5570c47..bf9218e 100644 (file)
@@ -38,17 +38,18 @@ static char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)id.c       8.1 (Berkeley) 6/6/93";
+static char sccsid[] = "@(#)id.c       8.3 (Berkeley) 4/28/95";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
-#include <pwd.h>
-#include <grp.h>
+
 #include <errno.h>
 #include <errno.h>
-#include <unistd.h>
-#include <stdlib.h>
+#include <grp.h>
+#include <pwd.h>
 #include <stdio.h>
 #include <stdio.h>
+#include <stdlib.h>
 #include <string.h>
 #include <string.h>
+#include <unistd.h>
 
 void   current __P((void));
 void   err __P((const char *, ...));
 
 void   current __P((void));
 void   err __P((const char *, ...));
@@ -188,7 +189,8 @@ current()
 {
        struct group *gr;
        struct passwd *pw;
 {
        struct group *gr;
        struct passwd *pw;
-       int cnt, id, eid, lastid, ngroups, groups[NGROUPS];
+       int cnt, id, eid, lastid, ngroups;
+       gid_t groups[NGROUPS];
        char *fmt;
 
        id = getuid();
        char *fmt;
 
        id = getuid();
@@ -234,7 +236,7 @@ user(pw)
        id = pw->pw_uid;
        (void)printf("uid=%u(%s)", id, pw->pw_name);
        (void)printf(" gid=%u", pw->pw_gid);
        id = pw->pw_uid;
        (void)printf("uid=%u(%s)", id, pw->pw_name);
        (void)printf(" gid=%u", pw->pw_gid);
-       if (gr = getgrgid(id))
+       if (gr = getgrgid(pw->pw_gid))
                (void)printf("(%s)", gr->gr_name);
        ngroups = NGROUPS + 1;
        (void) getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups);
                (void)printf("(%s)", gr->gr_name);
        ngroups = NGROUPS + 1;
        (void) getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups);
@@ -257,7 +259,8 @@ group(pw, nflag)
        int nflag;
 {
        struct group *gr;
        int nflag;
 {
        struct group *gr;
-       int cnt, id, lastid, ngroups, groups[NGROUPS + 1];
+       int cnt, id, lastid, ngroups;
+       gid_t groups[NGROUPS + 1];
        char *fmt;
 
        if (pw) {
        char *fmt;
 
        if (pw) {