#include #include #include #include #include main( int argc, char **argv) { register struct group *g; int f=0; gid_t gid; setgrent(); while ((g = getgrent()) != NULL) { fprintf(stdout,"%s:%d\n",g->gr_name,g->gr_gid); f++; } if (0 == f) perror("getgrent"); endgrent(); gid=getgid(); if ( gid==3000 ) puts("OK"); setgrent(); if ((g = getgrnam("giga")) == NULL) perror("getgrnam"); else while (*(g->gr_mem) != NULL) { puts(*(g->gr_mem)); if (0==strcmp(argv[1],*(g->gr_mem))) { puts("OK"); break; } *(g->gr_mem)++; } endgrent(); fprintf(stderr,"%s,%d\n","giga",g->gr_gid); } /* main */