From 90aff6656e9104179a7a4f79afece8f3ecf3ccbf Mon Sep 17 00:00:00 2001 From: Bill Joy Date: Mon, 1 Mar 1982 07:41:52 -0800 Subject: [PATCH] date and time created 82/02/28 23:41:52 by wnj SCCS-vsn: old/groups/groups.c 4.1 --- usr/src/old/groups/groups.c | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 usr/src/old/groups/groups.c diff --git a/usr/src/old/groups/groups.c b/usr/src/old/groups/groups.c new file mode 100644 index 0000000000..f6bf82ac9e --- /dev/null +++ b/usr/src/old/groups/groups.c @@ -0,0 +1,33 @@ +/* groups.c 4.1 82/02/28 */ + +/* + * groups + */ + +#include +#include +#include + +int grps[NGRPS/(sizeof(int)*8)]; +struct group *gr, *getgrgid(); + +main(argc, argv) + int argc; + char *argv[]; +{ + char *sep = ""; + int i; + + setgrp(0, grps); + for (i = 0; i < NGRPS; i++) + if (grps[i/(sizeof(int)*8)] & (1<<(i%(sizeof(int)*8)))) { + gr = getgrgid(i); + if (gr == NULL) + printf("%s%d", sep, i); + else + printf("%s%s", sep, gr->gr_name); + sep = " "; + } + printf("\n"); + exit(0); +} -- 2.20.1