1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
// Copyright (c) 2002 David Muse
// See the file COPYING for more information
#include <rudiments/groupentry.h>
#include <stdio.h>
int main(int argc, const char **argv) {
// get the group entry for "bin"
groupentry grent;
grent.initialize("bin");
// print the components individually
printf("Individually...\n");
printf(" Name: %s\n",grent.getName());
printf(" Password: %s\n",grent.getPassword());
printf(" Group Id: %d\n",grent.getGroupId());
printf(" Members:\n");
for (int i=0; grent.getMembers()[i]; i++) {
printf(" %s\n",grent.getMembers()[i]);
}
printf("\n");
// use the built in print method
printf("Built in...:\n");
grent.print();
printf("\n");
// get the group entry for group id 1
grent.initialize((gid_t)1);
// print the components individually
printf("Individually...\n");
printf(" Name: %s\n",grent.getName());
printf(" Password: %s\n",grent.getPassword());
printf(" Group Id: %d\n",grent.getGroupId());
printf(" Members:\n");
for (int i=0; grent.getMembers()[i]; i++) {
printf(" %s\n",grent.getMembers()[i]);
}
printf("\n");
// use the built in print method
printf("Built in...:\n");
grent.print();
printf("\n");
}
|