P8000/WEGA/contrib/lcc/lib/libc/port/gen/putpwent.c

26 lines
438 B
C

/*
* format a password file entry
*/
#include <stdio.h>
#include <pwd.h>
extern int fprintf();
int
putpwent(p, f)
register struct passwd *p;
register FILE *f;
{
(void) fprintf(f, "%s:%s", p->pw_name, p->pw_passwd);
if((*p->pw_age) != '\0')
(void) fprintf(f, ",%s", p->pw_age);
(void) fprintf(f, ":%u:%u:%s:%s:%s",
p->pw_uid,
p->pw_gid,
p->pw_gecos,
p->pw_dir,
p->pw_shell);
(void) putc('\n', f);
return(ferror(f));
}