Logo Search packages:      
Sourcecode: rainbow version File versions  Download package

uids.c

#define _GNU_SOURCE
#include <pwd.h>
#include <stdio.h>
#define BUFLEN 4096

int main() {
     struct passwd pw, *pwp;
     char buf[BUFLEN];
     int i, cnt;

     cnt = 0;

     setpwent();
     while (1) {
           i = getpwent_r(&pw, buf, BUFLEN, &pwp);
           if (i) {
                 printf("status: %d\n", i);
                 break;
           }
           printf("%d: %s (%d)\tHOME %s\tSHELL %s\n", cnt,
                 pwp->pw_name, pwp->pw_uid,
                 pwp->pw_dir, pwp->pw_shell);
           cnt++;
     }
     endpwent();
     return 0;
}


Generated by  Doxygen 1.6.0   Back to index