diff --git a/lib/libc/gen/daemon.3 b/lib/libc/gen/daemon.3 index 6bf7c8ddd22a..9ef8386dc15a 100644 --- a/lib/libc/gen/daemon.3 +++ b/lib/libc/gen/daemon.3 @@ -1,3 +1,5 @@ +.\" $NetBSD: daemon.3,v 1.3 1995/02/25 13:41:12 cgd Exp $ +.\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -29,8 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)daemon.3 8.1 (Berkeley) 6/9/93 -.\" $Id: daemon.3,v 1.2 1994/12/18 04:26:06 cgd Exp $ +.\" @(#)daemon.3 8.1 (Berkeley) 6/9/93 .\" .Dd June 9, 1993 .Dt DAEMON 3 diff --git a/lib/libc/gen/daemon.c b/lib/libc/gen/daemon.c index ae0ccb883e0f..c620ce9d539c 100644 --- a/lib/libc/gen/daemon.c +++ b/lib/libc/gen/daemon.c @@ -1,6 +1,8 @@ +/* $NetBSD: daemon.c,v 1.4 1995/02/25 13:41:16 cgd Exp $ */ + /*- - * Copyright (c) 1990 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1990, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,36 +34,44 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -/*static char sccsid[] = "from: @(#)daemon.c 5.3 (Berkeley) 12/28/90";*/ -static char rcsid[] = "$Id: daemon.c,v 1.3 1993/12/19 08:44:42 pk Exp $"; +#if 0 +static char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93"; +#else +static char rcsid[] = "$NetBSD: daemon.c,v 1.4 1995/02/25 13:41:16 cgd Exp $"; +#endif #endif /* LIBC_SCCS and not lint */ -#include -#include +#include #include +#include +int daemon(nochdir, noclose) int nochdir, noclose; { - int cpid; + int fd; - if ((cpid = fork()) == -1) + switch (fork()) { + case -1: return (-1); - if (cpid) - exit(0); - (void) setsid(); - if (!nochdir) - (void) chdir("/"); - if (!noclose) { - int devnull = open(_PATH_DEVNULL, O_RDWR, 0); + case 0: + break; + default: + _exit(0); + } - if (devnull != -1) { - (void) dup2(devnull, STDIN_FILENO); - (void) dup2(devnull, STDOUT_FILENO); - (void) dup2(devnull, STDERR_FILENO); - if (devnull > 2) - (void) close(devnull); - } + if (setsid() == -1) + return (-1); + + if (!nochdir) + (void)chdir("/"); + + if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + (void)dup2(fd, STDIN_FILENO); + (void)dup2(fd, STDOUT_FILENO); + (void)dup2(fd, STDERR_FILENO); + if (fd > 2) + (void)close (fd); } return (0); } diff --git a/lib/libc/gen/err.3 b/lib/libc/gen/err.3 index b2c736b7e8c1..be7f3a8c5e4f 100644 --- a/lib/libc/gen/err.3 +++ b/lib/libc/gen/err.3 @@ -1,3 +1,5 @@ +.\" $NetBSD: err.3,v 1.5 1995/02/25 13:40:57 cgd Exp $ +.\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -29,8 +31,7 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)err.3 8.1 (Berkeley) 6/9/93 -.\" $Id: err.3,v 1.4 1993/11/25 02:48:54 jtc Exp $ +.\" @(#)err.3 8.1 (Berkeley) 6/9/93 .\" .Dd "June 9, 1993" .Dt ERR 3 diff --git a/lib/libc/gen/err.c b/lib/libc/gen/err.c index c1419eaaf78a..580d0b6851b5 100644 --- a/lib/libc/gen/err.c +++ b/lib/libc/gen/err.c @@ -1,3 +1,5 @@ +/* $NetBSD: err.c,v 1.11 1995/02/25 13:41:01 cgd Exp $ */ + /*- * Copyright (c) 1993 * The Regents of the University of California. All rights reserved. @@ -32,8 +34,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -/* from: static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; */ -static char *rcsid = "$Id: err.c,v 1.10 1994/12/17 16:16:00 pk Exp $"; +#if 0 +static char sccsid[] = "@(#)err.c 8.1 (Berkeley) 6/4/93"; +#else +static char rcsid[] = "$NetBSD: err.c,v 1.11 1995/02/25 13:41:01 cgd Exp $"; +#endif #endif /* LIBC_SCCS and not lint */ #include @@ -50,25 +55,6 @@ static char *rcsid = "$Id: err.c,v 1.10 1994/12/17 16:16:00 pk Exp $"; extern char *__progname; /* Program name, from crt0. */ -__dead void -_verr(eval, fmt, ap) - int eval; - const char *fmt; - va_list ap; -{ - int sverrno; - - sverrno = errno; - (void)fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) { - (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, ": "); - } - (void)fprintf(stderr, "%s\n", strerror(sverrno)); - exit(eval); -} - - __dead void #ifdef __STDC__ _err(int eval, const char *fmt, ...) @@ -92,21 +78,24 @@ _err(va_alist) va_end(ap); } - __dead void -_verrx(eval, fmt, ap) +_verr(eval, fmt, ap) int eval; const char *fmt; va_list ap; { + int sverrno; + + sverrno = errno; (void)fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) + if (fmt != NULL) { (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, "\n"); + (void)fprintf(stderr, ": "); + } + (void)fprintf(stderr, "%s\n", strerror(sverrno)); exit(eval); } - __dead void #if __STDC__ _errx(int eval, const char *fmt, ...) @@ -130,21 +119,17 @@ _errx(va_alist) va_end(ap); } - -void -_vwarn(fmt, ap) +__dead void +_verrx(eval, fmt, ap) + int eval; const char *fmt; va_list ap; { - int sverrno; - - sverrno = errno; (void)fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) { + if (fmt != NULL) (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, ": "); - } - (void)fprintf(stderr, "%s\n", strerror(sverrno)); + (void)fprintf(stderr, "\n"); + exit(eval); } @@ -169,18 +154,21 @@ _warn(va_alist) va_end(ap); } - void -_vwarnx(fmt, ap) +_vwarn(fmt, ap) const char *fmt; va_list ap; { - (void)fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) - (void)vfprintf(stderr, fmt, ap); - (void)fprintf(stderr, "\n"); -} + int sverrno; + sverrno = errno; + (void)fprintf(stderr, "%s: ", __progname); + if (fmt != NULL) { + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, ": "); + } + (void)fprintf(stderr, "%s\n", strerror(sverrno)); +} void #ifdef __STDC__ @@ -202,3 +190,14 @@ _warnx(va_alist) _vwarnx(fmt, ap); va_end(ap); } + +void +_vwarnx(fmt, ap) + const char *fmt; + va_list ap; +{ + (void)fprintf(stderr, "%s: ", __progname); + if (fmt != NULL) + (void)vfprintf(stderr, fmt, ap); + (void)fprintf(stderr, "\n"); +} diff --git a/lib/libc/gen/errlist.c b/lib/libc/gen/errlist.c index eaf3eba2a5de..0993f750ec69 100644 --- a/lib/libc/gen/errlist.c +++ b/lib/libc/gen/errlist.c @@ -1,6 +1,8 @@ +/* $NetBSD: errlist.c,v 1.4 1995/02/25 13:40:51 cgd Exp $ */ + /* - * Copyright (c) 1982, 1985 Regents of the University of California. - * All rights reserved. + * Copyright (c) 1982, 1985, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,8 +34,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -/*static char *sccsid = "from: @(#)errlst.c 5.10 (Berkeley) 2/19/91";*/ -static char *rcsid = "$Id: errlist.c,v 1.3 1994/12/12 22:42:07 jtc Exp $"; +#if 0 +static char sccsid[] = "@(#)errlst.c 8.2 (Berkeley) 11/16/93"; +#else +static char *rcsid = "$NetBSD: errlist.c,v 1.4 1995/02/25 13:40:51 cgd Exp $"; +#endif #endif /* LIBC_SCCS and not lint */ const char *const _sys_errlist[] = { @@ -107,7 +112,7 @@ const char *const _sys_errlist[] = { "Socket is not connected", /* 57 - ENOTCONN */ "Can't send after socket shutdown", /* 58 - ESHUTDOWN */ "Too many references: can't splice", /* 59 - ETOOMANYREFS */ - "Connection timed out", /* 60 - ETIMEDOUT */ + "Operation timed out", /* 60 - ETIMEDOUT */ "Connection refused", /* 61 - ECONNREFUSED */ "Too many levels of symbolic links", /* 62 - ELOOP */ diff --git a/lib/libc/gen/getbsize.3 b/lib/libc/gen/getbsize.3 index 045557304eae..65f5cd656938 100644 --- a/lib/libc/gen/getbsize.3 +++ b/lib/libc/gen/getbsize.3 @@ -1,3 +1,5 @@ +.\" $NetBSD: getbsize.3,v 1.2 1995/02/25 13:41:31 cgd Exp $ +.\" .\" Copyright (c) 1993 .\" The Regents of the University of California. All rights reserved. .\" @@ -75,5 +77,5 @@ a block size of 512 bytes. .Sh HISTORY The .Nm getbsize -function call appeared in +function first appeared in .Bx 4.4 . diff --git a/lib/libc/gen/getbsize.c b/lib/libc/gen/getbsize.c index ac3045843127..85060c483cdd 100644 --- a/lib/libc/gen/getbsize.c +++ b/lib/libc/gen/getbsize.c @@ -1,6 +1,8 @@ +/* $NetBSD: getbsize.c,v 1.6 1995/02/25 13:41:34 cgd Exp $ */ + /*- - * Copyright (c) 1991 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -32,8 +34,11 @@ */ #ifndef lint -/*static char sccsid[] = "from: @(#)getbsize.c 5.3 (Berkeley) 3/9/92";*/ -static char rcsid[] = "$Id: getbsize.c,v 1.5 1994/12/12 22:42:08 jtc Exp $"; +#if 0 +static char sccsid[] = "@(#)getbsize.c 8.1 (Berkeley) 6/4/93"; +#else +static char rcsid[] = "$NetBSD: getbsize.c,v 1.6 1995/02/25 13:41:34 cgd Exp $"; +#endif #endif /* not lint */ #include diff --git a/lib/libc/gen/getcap.3 b/lib/libc/gen/getcap.3 index 6214c730b7ec..1c5e413c50d3 100644 --- a/lib/libc/gen/getcap.3 +++ b/lib/libc/gen/getcap.3 @@ -1,5 +1,7 @@ -.\" Copyright (c) 1992 The Regents of the University of California. -.\" All rights reserved. +.\" $NetBSD: getcap.3,v 1.4 1995/02/25 13:41:21 cgd Exp $ +.\" +.\" Copyright (c) 1992, 1993 +.\" The Regents of the University of California. All rights reserved. .\" .\" This code is derived from software contributed to Berkeley by .\" Casey Leedom of Lawrence Livermore National Laboratory. @@ -32,10 +34,9 @@ .\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF .\" SUCH DAMAGE. .\" -.\" from: @(#)getcap.3 5.4 (Berkeley) 8/11/92 -.\" $Id: getcap.3,v 1.3 1994/01/10 23:32:26 jtc Exp $ +.\" @(#)getcap.3 8.3 (Berkeley) 4/19/94 .\" -.Dd "August 11, 1992" +.Dd "April 19, 1994" .Dt GETCAP 3 .Os .Sh NAME @@ -340,7 +341,7 @@ file in which the is declared and all subsequent files in the file array. .Pp When a database is searched for a capability record, the first matching -record in the search is returned. When an record is scanned for a +record in the search is returned. When a record is scanned for a capability, the first matching capability is returned; the capability .Ic :nameT@: will hide any following definition of a value of type @@ -465,7 +466,7 @@ use `\e\|200' to represent a .Nm cgetfirst , and .Nm cgetnext -return a a value greater than or equal to 0 on success and a value less +return a value greater than or equal to 0 on success and a value less than 0 on failure. .Nm Cgetcap returns a character pointer on success and a diff --git a/lib/libc/gen/getcap.c b/lib/libc/gen/getcap.c index d257a3b212a1..7e0eb1fa378d 100644 --- a/lib/libc/gen/getcap.c +++ b/lib/libc/gen/getcap.c @@ -1,6 +1,8 @@ +/* $NetBSD: getcap.c,v 1.9 1995/02/25 13:41:26 cgd Exp $ */ + /*- - * Copyright (c) 1992 The Regents of the University of California. - * All rights reserved. + * Copyright (c) 1992, 1993 + * The Regents of the University of California. All rights reserved. * * This code is derived from software contributed to Berkeley by * Casey Leedom of Lawrence Livermore National Laboratory. @@ -35,8 +37,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) -/*static char *sccsid = "from: @(#)getcap.c 5.15 (Berkeley) 3/19/93";*/ -static char *rcsid = "$Id: getcap.c,v 1.8 1994/03/26 02:51:45 cgd Exp $"; +#if 0 +static char sccsid[] = "@(#)getcap.c 8.3 (Berkeley) 3/25/94"; +#else +static char rcsid[] = "$NetBSD: getcap.c,v 1.9 1995/02/25 13:41:26 cgd Exp $"; +#endif #endif /* LIBC_SCCS and not lint */ #include @@ -254,7 +259,7 @@ getent(cap, len, db_array, fd, name, depth, nfield) if (retval < 0) { /* no record available */ (void)capdbp->close(capdbp); - return (retval); + return (retval); } /* save the data; close frees it */ clen = strlen(record); diff --git a/lib/libc/gen/getgrouplist.3 b/lib/libc/gen/getgrouplist.3 index 78785749daa3..307931534714 100644 --- a/lib/libc/gen/getgrouplist.3 +++ b/lib/libc/gen/getgrouplist.3 @@ -1,3 +1,5 @@ +.\" $NetBSD: getgrouplist.3,v 1.2 1995/02/25 13:41:05 cgd Exp $ +.\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. .\" diff --git a/lib/libc/gen/getgrouplist.c b/lib/libc/gen/getgrouplist.c index 1ee30c4d71b3..583954508605 100644 --- a/lib/libc/gen/getgrouplist.c +++ b/lib/libc/gen/getgrouplist.c @@ -1,3 +1,5 @@ +/* $NetBSD: getgrouplist.c,v 1.4 1995/02/25 13:41:09 cgd Exp $ */ + /* * Copyright (c) 1991, 1993 * The Regents of the University of California. All rights reserved. @@ -32,7 +34,11 @@ */ #if defined(LIBC_SCCS) && !defined(lint) +#if 0 static char sccsid[] = "@(#)getgrouplist.c 8.1 (Berkeley) 6/4/93"; +#else +static char rcsid[] = "$NetBSD: getgrouplist.c,v 1.4 1995/02/25 13:41:09 cgd Exp $"; +#endif #endif /* LIBC_SCCS and not lint */ /*