From ab0d0e5b239e2936ce885ebd1e325fe859742849 Mon Sep 17 00:00:00 2001 From: Michiel Broek Date: Sat, 25 Aug 2001 20:34:32 +0000 Subject: [PATCH] Updated for FreeBSD port --- mbsebbs/putpwent.c | 73 ++++++++++++++++++++++++++++++++++++++++++++++ mbsebbs/putpwent.h | 14 +++++++++ 2 files changed, 87 insertions(+) create mode 100644 mbsebbs/putpwent.c create mode 100644 mbsebbs/putpwent.h diff --git a/mbsebbs/putpwent.c b/mbsebbs/putpwent.c new file mode 100644 index 00000000..4bfe7efa --- /dev/null +++ b/mbsebbs/putpwent.c @@ -0,0 +1,73 @@ +/* + * Copyright 1989 - 1994, Julianne Frances Haugh + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * 3. Neither the name of Julianne F. Haugh nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY JULIE HAUGH AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL JULIE HAUGH OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "../config.h" +#ifndef HAVE_PUTPWENT + + +#include +#include +#include "putpwent.h" + +/* + * putpwent - Output a (struct passwd) in character format + * + * putpwent() writes out a (struct passwd) in the format it appears + * in in flat ASCII files. + * + * (Author: Dr. Micheal Newberry) + */ + +int putpwent(const struct passwd *p, FILE *f) +{ + int status; + +#if defined(SUN) || defined(BSD) || defined(SUN4) + status = fprintf (f, "%s:%s:%d:%d:%s,%s:%s:%s\n", + p->pw_name, p->pw_passwd, p->pw_uid, p->pw_gid, + p->pw_gecos, p->pw_comment, p->pw_dir, p->pw_shell) == EOF; +#else + status = fprintf (f, "%s:%s", p->pw_name, p->pw_passwd) == EOF; +#ifdef ATT_AGE + if (p->pw_age && p->pw_age[0]) + status |= fprintf (f, ",%s", p->pw_age) == EOF; +#endif + status |= fprintf (f, ":%d:%d:%s", p->pw_uid, p->pw_gid, + p->pw_gecos) == EOF; +#ifdef ATT_COMMENT + if (p->pw_comment && p->pw_comment[0]) + status |= fprintf (f, ",%s", p->pw_comment) == EOF; +#endif + status |= fprintf (f, ":%s:%s\n", p->pw_dir, p->pw_shell) == EOF; +#endif + return status; +} + +#endif + diff --git a/mbsebbs/putpwent.h b/mbsebbs/putpwent.h new file mode 100644 index 00000000..6f1f2ebe --- /dev/null +++ b/mbsebbs/putpwent.h @@ -0,0 +1,14 @@ +#include "../config.h" + +#ifndef HAVE_PUTPWENT + +#ifndef _PUTPWENT_H +#define _PUTPWENT_H + + +int putpwent(const struct passwd *, FILE *); + + +#endif + +#endif