diff options
author | Rob Landley <rob@landley.net> | 2014-08-02 19:52:44 -0500 |
---|---|---|
committer | Rob Landley <rob@landley.net> | 2014-08-02 19:52:44 -0500 |
commit | dc48a0c7c5d5bd001adfe2827f357aaaf7dcbb7c (patch) | |
tree | 376f93e9cc7140a53e75a965d7510501f7a25dc0 /toys | |
parent | bd0ad99d2e39c0eaf86ef8a92cceafd79989f470 (diff) | |
download | toybox-dc48a0c7c5d5bd001adfe2827f357aaaf7dcbb7c.tar.gz |
Cosmetic tweak, slightly more conventional for loop.
Diffstat (limited to 'toys')
-rw-r--r-- | toys/posix/id.c | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/toys/posix/id.c b/toys/posix/id.c index a03a0975..acd1429e 100644 --- a/toys/posix/id.c +++ b/toys/posix/id.c @@ -113,14 +113,13 @@ void do_id(char *username) i = sizeof(toybuf)/sizeof(gid_t); ngroups = username ? getgrouplist(username, gid, groups, &i) : getgroups(i, groups); - if (0 >= ngroups) perror_exit(0); + if (ngroups<0) perror_exit(0); - for (i = 0;;) { + for (i = 0; i<ngroups; i++) { + if (i) xputc(' '); if (!(grp = getgrgid(groups[i]))) perror_msg(0); else if (flags & FLAG_G) s_or_u(grp->gr_name, grp->gr_gid, 0); else if (grp->gr_gid != egid) showid("", grp->gr_gid, grp->gr_name); - if (++i >= ngroups) break; - xputc(' '); } xputc('\n'); } |