summaryrefslogtreecommitdiff
path: root/src/passwd/putpwent.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/passwd/putpwent.c')
-rw-r--r--src/passwd/putpwent.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/passwd/putpwent.c b/src/passwd/putpwent.c
new file mode 100644
index 00000000..80fbf384
--- /dev/null
+++ b/src/passwd/putpwent.c
@@ -0,0 +1,9 @@
+#include <pwd.h>
+#include <stdio.h>
+
+int putpwent(const struct passwd *pw, FILE *f)
+{
+ return fprintf(f, "%s:%s:%d:%d:%s:%s:%s\n",
+ pw->pw_name, pw->pw_passwd, pw->pw_uid, pw->pw_gid,
+ pw->pw_gecos, pw->pw_dir, pw->pw_shell)<0 ? -1 : 0;
+}