pwcat.c 471 B

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