Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/netbsd-1-4]: src/usr.bin/id pull up rev 1.15 from trunk (requested by my...



details:   https://anonhg.NetBSD.org/src/rev/1f332c8b3c7b
branches:  netbsd-1-4
changeset: 469542:1f332c8b3c7b
user:      cgd <cgd%NetBSD.org@localhost>
date:      Sat Oct 09 21:24:23 1999 +0000

description:
pull up rev 1.15 from trunk (requested by mycroft):
  Fix inconsistent format between `id' and `id userid'.

diffstat:

 usr.bin/id/id.c |  15 +++++++--------
 1 files changed, 7 insertions(+), 8 deletions(-)

diffs (43 lines):

diff -r f64e217f07a6 -r 1f332c8b3c7b usr.bin/id/id.c
--- a/usr.bin/id/id.c   Sat Oct 09 19:15:24 1999 +0000
+++ b/usr.bin/id/id.c   Sat Oct 09 21:24:23 1999 +0000
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)id.c       8.3 (Berkeley) 4/28/95";
 #else
-__RCSID("$NetBSD: id.c,v 1.14 1998/12/19 16:55:21 christos Exp $");
+__RCSID("$NetBSD: id.c,v 1.14.2.1 1999/10/09 21:24:23 cgd Exp $");
 #endif
 #endif /* not lint */
 
@@ -239,8 +239,8 @@
        }
        if ((ngroups = getgroups(maxgroups, groups)) != NULL) {
                for (fmt = " groups=%u", lastid = -1, cnt = 0; cnt < ngroups;
-                   fmt = ", %u", lastid = id) {
-                       id = groups[cnt++];
+                   fmt = ",%u", lastid = id, cnt++) {
+                       id = groups[cnt];
                        if (lastid == id)
                                continue;
                        (void)printf(fmt, id);
@@ -266,15 +266,14 @@
                (void)printf("(%s)", gr->gr_name);
        ngroups = maxgroups + 1;
        (void) getgrouplist(pw->pw_name, pw->pw_gid, groups, &ngroups);
-       fmt = " groups=%u";
-       for (lastid = -1, cnt = 0; cnt < ngroups; ++cnt) {
-               if (lastid == (id = groups[cnt]))
+       for (fmt = " groups=%u", lastid = -1, cnt = 0; cnt < ngroups;
+           fmt=",%u", lastid = id, cnt++) {
+               id = groups[cnt];
+               if (lastid == id)
                        continue;
                (void)printf(fmt, id);
-               fmt = " %u";
                if ((gr = getgrgid(id)) != NULL)
                        (void)printf("(%s)", gr->gr_name);
-               lastid = id;
        }
        (void)printf("\n");
 }



Home | Main Index | Thread Index | Old Index