diff options
Diffstat (limited to 'awklib/eg/lib/pwcat.c')
-rw-r--r-- | awklib/eg/lib/pwcat.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/awklib/eg/lib/pwcat.c b/awklib/eg/lib/pwcat.c new file mode 100644 index 00000000..ecd25861 --- /dev/null +++ b/awklib/eg/lib/pwcat.c @@ -0,0 +1,29 @@ +/* + * pwcat.c + * + * Generate a printable version of the password database + * + * Arnold Robbins + * arnold@gnu.ai.mit.edu + * May 1993 + * Public Domain + */ + +#include <stdio.h> +#include <pwd.h> + +int +main(argc, argv) +int argc; +char **argv; +{ + struct passwd *p; + + while ((p = getpwent()) != NULL) + printf("%s:%s:%d:%d:%s:%s:%s\n", + p->pw_name, p->pw_passwd, p->pw_uid, + p->pw_gid, p->pw_gecos, p->pw_dir, p->pw_shell); + + endpwent(); + exit(0); +} |