home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 4: GNU Archives / Linux Cubed Series 4 - GNU Archives.iso / gnu / gawk-3.000 / gawk-3 / gawk-3.0.0 / awklib / eg / lib / pwcat.c < prev   
Encoding:
C/C++ Source or Header  |  1996-01-11  |  480 b   |  30 lines

  1. /*
  2.  * pwcat.c
  3.  *
  4.  * Generate a printable version of the password database
  5.  *
  6.  * Arnold Robbins
  7.  * arnold@gnu.ai.mit.edu
  8.  * May 1993
  9.  * Public Domain
  10.  */
  11.  
  12. #include <stdio.h>
  13. #include <pwd.h>
  14.  
  15. int
  16. main(argc, argv)
  17. int argc;
  18. char **argv;
  19. {
  20.     struct passwd *p;
  21.  
  22.     while ((p = getpwent()) != NULL)
  23.         printf("%s:%s:%d:%d:%s:%s:%s\n",
  24.             p->pw_name, p->pw_passwd, p->pw_uid,
  25.             p->pw_gid, p->pw_gecos, p->pw_dir, p->pw_shell);
  26.  
  27.     endpwent();
  28.     exit(0);
  29. }
  30.