diff --git a/include/grp.h b/include/grp.h index c6499e3..4a9c999 100644 --- a/include/grp.h +++ b/include/grp.h @@ -13,3 +13,4 @@ struct group *getgrgid(gid_t gid); void setgrent(void); void endgrent(void); int setgroups(size_t size, const gid_t *list); +int getgrouplist(char *uname, gid_t agroup, gid_t *groups, int *grpcnt); diff --git a/include/unistd.h b/include/unistd.h index ff9ff4e..81e7154 100644 --- a/include/unistd.h +++ b/include/unistd.h @@ -143,6 +143,9 @@ int getopt (int argc, char * const argv[], const char *optstring); extern char *optarg; /* getopt(3) external variables */ extern int opterr, optind, optopt; +int gethostname(char *name, int namelen); +int sethostname(char *name, int namelen); + #ifndef _VA_LIST_ # ifdef __GNUC__ # define va_list __builtin_va_list /* For Gnu C */ diff --git a/src/cmd/glcdtest/glcdtest.c b/src/cmd/glcdtest/glcdtest.c index 80f1c47..3431248 100644 --- a/src/cmd/glcdtest/glcdtest.c +++ b/src/cmd/glcdtest/glcdtest.c @@ -7,6 +7,7 @@ #include #include #include +#include int glcd; @@ -267,7 +268,7 @@ int main() banner("Bouncy Lines"); sleep(1); bouncy_lines(500); - sleep(1); + sleep(1); cls(); banner("Stretchy Box"); diff --git a/src/cmd/hostname/hostname.c b/src/cmd/hostname/hostname.c index 3a87582..e916c2b 100644 --- a/src/cmd/hostname/hostname.c +++ b/src/cmd/hostname/hostname.c @@ -34,6 +34,7 @@ #include #include #include +#include int main(argc,argv) diff --git a/src/cmd/id/id.c b/src/cmd/id/id.c index bbbd8f8..bef8689 100644 --- a/src/cmd/id/id.c +++ b/src/cmd/id/id.c @@ -159,16 +159,18 @@ pretty(pw) else (void)printf("uid\t%u\n", rid); - if ((eid = geteuid()) != rid) - if (pw = getpwuid(eid)) + if ((eid = geteuid()) != rid) { + if ((pw = getpwuid(eid))) (void)printf("euid\t%s", pw->pw_name); else (void)printf("euid\t%u", eid); - if ((rid = getgid()) != (eid = getegid())) - if (gr = getgrgid(rid)) + } + if ((rid = getgid()) != (eid = getegid())) { + if ((gr = getgrgid(rid))) (void)printf("rgid\t%s\n", gr->gr_name); else (void)printf("rgid\t%u\n", rid); + } (void)printf("groups\t"); group(NULL, 1); } @@ -185,20 +187,20 @@ current() id = getuid(); (void)printf("uid=%u", id); - if (pw = getpwuid(id)) + if ((pw = getpwuid(id))) (void)printf("(%s)", pw->pw_name); if ((eid = geteuid()) != id) { (void)printf(" euid=%u", eid); - if (pw = getpwuid(eid)) + if ((pw = getpwuid(eid))) (void)printf("(%s)", pw->pw_name); } id = getgid(); (void)printf(" gid=%u", id); - if (gr = getgrgid(id)) + if ((gr = getgrgid(id))) (void)printf("(%s)", gr->gr_name); if ((eid = getegid()) != id) { (void)printf(" egid=%u", eid); - if (gr = getgrgid(eid)) + if ((gr = getgrgid(eid))) (void)printf("(%s)", gr->gr_name); } ngroups = getgroups(NGROUPS, groups); @@ -209,7 +211,7 @@ current() if (lastid == id) continue; (void)printf(fmt, id); - if (gr = getgrgid(id)) + if ((gr = getgrgid(id))) (void)printf("(%s)", gr->gr_name); } (void)printf("\n"); @@ -237,7 +239,7 @@ user(pw) continue; (void)printf(fmt, id); fmt = " %u"; - if (gr = getgrgid(id)) + if ((gr = getgrgid(id))) (void)printf("(%s)", gr->gr_name); lastid = id; } @@ -266,7 +268,7 @@ group(pw, nflag) if (lastid == (id = groups[cnt])) continue; if (nflag) { - if (gr = getgrgid(id)) + if ((gr = getgrgid(id))) (void)printf(fmt, gr->gr_name); else (void)printf(*fmt == ' ' ? " %u" : "%u", @@ -293,12 +295,13 @@ who(u) * Translate user argument into a pw pointer. First, try to * get it as specified. If that fails, try it as a number. */ - if (pw = getpwnam(u)) + if ((pw = getpwnam(u))) return(pw); id = strtol(u, &ep, 10); if (*u && !*ep && (pw = getpwuid(id))) return(pw); errx(1, "%s: No such user", u); + return 0; } void