|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T m
Length: 1258 (0x4ea)
Types: TextFile
Names: »members.c«
└─⟦4f9d7c866⟧ Bits:30007245 EUUGD6: Sikkerheds distributionen
└─⟦3da311d67⟧ »./cops/1.04/cops_104.tar.Z«
└─⟦6a2577110⟧
└─⟦4f9d7c866⟧ Bits:30007245 EUUGD6: Sikkerheds distributionen
└─⟦6a2577110⟧ »./cops/1.04/cops_104.tar«
└─⟦this⟧ »cops_104/src/members.c«
└─⟦4f9d7c866⟧ Bits:30007245 EUUGD6: Sikkerheds distributionen
└─⟦ed5edc051⟧ »./cops/1.02/cops.102.tar«
└─⟦4f9d7c866⟧ Bits:30007245 EUUGD6: Sikkerheds distributionen
└─⟦db60b44f1⟧ »./cops/1.02/cops.102.tar.Z«
└─⟦ed5edc051⟧
└─⟦this⟧ »cops/src/members.c«
/* Copyright 1985 Robert W. Baldwin */
/* Copyright 1986 Robert W. Baldwin */
static char *notice85 = "Copyright 1985 Robert W. Baldwin";
static char *notice86 = "Copyright 1986 Robert W. Baldwin";
/*
* useage: members GroupName
* Writes to stdout the list of UserNames that are in the given group.
* The UserNames are separated by space or newline characters.
*
*/
#include <stdio.h>
#include <grp.h>
#include <pwd.h>
#ifdef cray
struct group *getgrnam();
#endif
main(argc, argv)
int argc;
char *argv[];
{
int i;
int gid;
struct group *grent;
struct passwd *pwent;
char **user;
/*
* Print the list of group members from /etc/group.
*/
if ((grent = getgrnam(argv[1])) == NULL) {
fprintf(stderr, "%s: Bad group name %s.\n",
argv[0], argv[1]);
exit(1);
}
gid = grent->gr_gid;
for (user = grent->gr_mem ; *user != NULL ; user++) {
fprintf(stdout, "%s ", *user);
}
fprintf(stdout, "\n");
endgrent();
/*
* The passwd file must also be examined to find members of the group.
* Duplicates may occur, but the higher level code shouldn't care about them.
*/
while ((pwent = getpwent()) != NULL) {
if (pwent->pw_gid != gid)
continue;
fprintf(stdout, "%s ", pwent->pw_name);
}
fprintf(stdout, "\n");
endpwent();
}