update from Lite, with local changes. fix Ids, etc.

This commit is contained in:
cgd 1995-02-27 04:12:15 +00:00
parent 72c46b1cdc
commit b585e843ca
26 changed files with 220 additions and 142 deletions

View File

@ -1,5 +1,7 @@
.\" Copyright (c) 1991 The Regents of the University of California.
.\" All rights reserved.
.\" $NetBSD: getcwd.3,v 1.5 1995/02/27 04:12:15 cgd Exp $
.\"
.\" 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
@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)getcwd.3 6.4 (Berkeley) 4/19/91
.\" $Id: getcwd.3,v 1.4 1993/11/29 21:41:03 jtc Exp $
.\" @(#)getcwd.3 8.2 (Berkeley) 12/11/93
.\"
.Dd April 19, 1991
.Dd December 11, 1993
.Dt GETCWD 3
.Os BSD 4.2
.Sh NAME

View File

@ -1,6 +1,8 @@
/* $NetBSD: getcwd.c,v 1.4 1995/02/27 04:12:20 cgd Exp $ */
/*
* Copyright (c) 1989, 1991 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1989, 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,12 +34,16 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)getcwd.c 5.11 (Berkeley) 2/24/91";*/
static char *rcsid = "$Id: getcwd.c,v 1.3 1993/08/26 00:44:36 jtc Exp $";
#if 0
static char sccsid[] = "@(#)getcwd.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: getcwd.c,v 1.4 1995/02/27 04:12:20 cgd Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#include <sys/stat.h>
#include <errno.h>
#include <dirent.h>
#include <stdio.h>
@ -76,12 +82,12 @@ getcwd(pt, size)
ptsize = 0;
if (!size) {
errno = EINVAL;
return((char *)NULL);
return (NULL);
}
ept = pt + size;
} else {
if (!(pt = (char *)malloc(ptsize = 1024 - 4)))
return((char *)NULL);
if ((pt = malloc(ptsize = 1024 - 4)) == NULL)
return (NULL);
ept = pt + ptsize;
}
bpt = ept - 1;
@ -92,7 +98,7 @@ getcwd(pt, size)
* Should always be enough (it's 340 levels). If it's not, allocate
* as necessary. Special * case the first stat, it's ".", not "..".
*/
if (!(up = (char *)malloc(upsize = 1024 - 4)))
if ((up = malloc(upsize = 1024 - 4)) == NULL)
goto err;
eup = up + MAXPATHLEN;
bup = up;
@ -126,7 +132,7 @@ getcwd(pt, size)
*/
(void)bcopy(bpt, pt, ept - bpt);
free(up);
return(pt);
return (pt);
}
/*
@ -135,8 +141,9 @@ getcwd(pt, size)
* possible component name, plus a trailing NULL.
*/
if (bup + 3 + MAXNAMLEN + 1 >= eup) {
if (!(up = (char *)realloc(up, upsize *= 2)))
if ((up = realloc(up, upsize *= 2)) == NULL)
goto err;
bup = up;
eup = up + upsize;
}
*bup++ = '.';
@ -195,7 +202,7 @@ getcwd(pt, size)
}
off = bpt - pt;
len = ept - bpt;
if (!(pt = (char *)realloc(pt, ptsize *= 2)))
if ((pt = realloc(pt, ptsize *= 2)) == NULL)
goto err;
bpt = pt + off;
ept = pt + ptsize;
@ -225,5 +232,5 @@ err:
if (ptsize)
free(pt);
free(up);
return((char *)NULL);
return (NULL);
}

View File

@ -1,5 +1,7 @@
.\" Copyright (c) 1983, 1991 The Regents of the University of California.
.\" All rights reserved.
.\" $NetBSD: getdiskbyname.3,v 1.3 1995/02/27 04:12:24 cgd Exp $
.\"
.\" Copyright (c) 1983, 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
@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)getdiskbyname.3 6.6 (Berkeley) 4/19/91
.\" $Id: getdiskbyname.3,v 1.2 1993/07/30 08:36:24 mycroft Exp $
.\" @(#)getdiskbyname.3 8.1 (Berkeley) 6/4/93
.\"
.Dd April 19, 1991
.Dd June 4, 1993
.Dt GETDISKBYNAME 3
.Os BSD 4.2
.Sh NAME

View File

@ -1,3 +1,5 @@
.\" $NetBSD: getdomainname.3,v 1.2 1995/02/27 04:12:27 cgd Exp $
.\"
.\" Copyright (c) 1983, 1991, 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: @(#)gethostname.3 8.1 (Berkeley) 6/4/93
.\" $Id: getdomainname.3,v 1.1 1994/05/07 03:09:19 cgd Exp $
.\" @(#)gethostname.3 8.1 (Berkeley) 6/4/93
.\"
.Dd May 6, 1994
.Dt GETDOMAINNAME 3

View File

@ -1,3 +1,5 @@
/* $NetBSD: getdomainname.c,v 1.2 1995/02/27 04:12:30 cgd Exp $ */
/*
* Copyright (c) 1989, 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[] = "@(#)gethostname.c 8.1 (Berkeley) 6/4/93"; */
static char *rcsid = "$Id: getdomainname.c,v 1.1 1994/05/07 03:09:22 cgd Exp $";
#if 0
static char sccsid[] = "@(#)gethostname.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: getdomainname.c,v 1.2 1995/02/27 04:12:30 cgd Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>

View File

@ -1,5 +1,7 @@
.\" Copyright (c) 1983, 1991 The Regents of the University of California.
.\" All rights reserved.
.\" $NetBSD: getfsent.3,v 1.4 1995/02/27 04:12:33 cgd Exp $
.\"
.\" Copyright (c) 1983, 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
@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)getfsent.3 6.9 (Berkeley) 4/19/91
.\" $Id: getfsent.3,v 1.3 1993/11/25 02:48:58 jtc Exp $
.\" @(#)getfsent.3 8.1 (Berkeley) 6/4/93
.\"
.Dd April 19, 1991
.Dd June 4, 1993
.Dt GETFSENT 3
.Os BSD 4
.Sh NAME

View File

@ -1,5 +1,7 @@
.\" Copyright (c) 1989, 1991 The Regents of the University of California.
.\" All rights reserved.
.\" $NetBSD: getgrent.3,v 1.8 1995/02/27 04:12:36 cgd Exp $
.\"
.\" Copyright (c) 1989, 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
@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)getgrent.3 6.8 (Berkeley) 4/20/91
.\" $Id: getgrent.3,v 1.7 1994/01/10 23:32:28 jtc Exp $
.\" @(#)getgrent.3 8.2 (Berkeley) 4/19/94
.\"
.Dd April 20, 1991
.Dd April 19, 1994
.Dt GETGRENT 3
.Os
.Sh NAME

View File

@ -1,6 +1,8 @@
/* $NetBSD: getgrent.c,v 1.11 1995/02/27 04:12:39 cgd Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1989, 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: @(#)getgrent.c 5.9 (Berkeley) 4/1/91";*/
static char *rcsid = "$Id: getgrent.c,v 1.10 1994/08/02 05:15:25 deraadt Exp $";
#if 0
static char sccsid[] = "@(#)getgrent.c 8.2 (Berkeley) 3/21/94";
#else
static char rcsid[] = "$NetBSD: getgrent.c,v 1.11 1995/02/27 04:12:39 cgd Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>

View File

@ -1,3 +1,5 @@
.\" $NetBSD: gethostname.3,v 1.2 1995/02/27 04:12:42 cgd Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"

View File

@ -1,3 +1,5 @@
/* $NetBSD: gethostname.c,v 1.2 1995/02/27 04:12:45 cgd Exp $ */
/*
* Copyright (c) 1989, 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[] = "@(#)gethostname.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: gethostname.c,v 1.2 1995/02/27 04:12:45 cgd Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>

View File

@ -1,6 +1,8 @@
/* $NetBSD: getlogin.c,v 1.6 1995/02/27 04:12:47 cgd Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1988, 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: @(#)getlogin.c 5.9 (Berkeley) 2/23/91";*/
static char *rcsid = "$Id: getlogin.c,v 1.5 1993/12/18 01:16:18 jtc Exp $";
#if 0
static char sccsid[] = "@(#)getlogin.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: getlogin.c,v 1.6 1995/02/27 04:12:47 cgd Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>

View File

@ -1,5 +1,7 @@
.\" Copyright (c) 1989, 1991 The Regents of the University of California.
.\" All rights reserved.
.\" $NetBSD: getmntinfo.3,v 1.5 1995/02/27 04:12:50 cgd Exp $
.\"
.\" Copyright (c) 1989, 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
@ -29,17 +31,17 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)getmntinfo.3 6.5 (Berkeley) 4/19/91
.\" $Id: getmntinfo.3,v 1.4 1994/08/29 03:27:36 mycroft Exp $
.\" @(#)getmntinfo.3 8.1 (Berkeley) 6/9/93
.\"
.Dd April 19, 1991
.Dd June 9, 1993
.Dt GETMNTINFO 3
.Os
.Sh NAME
.Nm getmntinfo
.Nd get information about mounted file systems
.Sh SYNOPSIS
.Fd #include <sys/types.h>
.Fd #include <sys/param.h>
.Fd #include <sys/ucred.h>
.Fd #include <sys/mount.h>
.Ft int
.Fn getmntinfo "struct statfs **mntbufp" "int flags"
@ -92,8 +94,7 @@ or
.Sh HISTORY
The
.Fn getmntinfo
function is
.Ud .
function first appeared in 4.4BSD.
.Sh BUGS
The
.Fn getmntinfo

View File

@ -1,6 +1,8 @@
/* $NetBSD: getmntinfo.c,v 1.5 1995/02/27 04:12:53 cgd Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1989, 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,11 +34,15 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)getmntinfo.c 6.4 (Berkeley) 2/23/91";*/
static char *rcsid = "$Id: getmntinfo.c,v 1.4 1994/06/12 22:52:03 cgd Exp $";
#if 0
static char sccsid[] = "@(#)getmntinfo.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: getmntinfo.c,v 1.5 1995/02/27 04:12:53 cgd Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#include <sys/ucred.h>
#include <sys/mount.h>
#include <stdlib.h>

View File

@ -1,3 +1,5 @@
.\" $NetBSD: getpagesize.3,v 1.2 1995/02/27 04:12:55 cgd Exp $
.\"
.\" Copyright (c) 1983, 1991, 1993
.\" The Regents of the University of California. All rights reserved.
.\"

View File

@ -1,5 +1,7 @@
.\" Copyright (c) 1989, 1991 The Regents of the University of California.
.\" All rights reserved.
.\" $NetBSD: getpass.3,v 1.4 1995/02/27 04:12:57 cgd Exp $
.\"
.\" Copyright (c) 1989, 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
@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)getpass.3 6.5 (Berkeley) 5/21/91
.\" $Id: getpass.3,v 1.3 1993/11/29 21:41:04 jtc Exp $
.\" @(#)getpass.3 8.1 (Berkeley) 6/4/93
.\"
.Dd May 21, 1991
.Dd June 4, 1993
.Dt GETPASS 3
.Os
.Sh NAME

View File

@ -1,6 +1,8 @@
/* $NetBSD: getpass.c,v 1.5 1995/02/27 04:12:59 cgd Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1988, 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,16 +34,20 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)getpass.c 5.9 (Berkeley) 5/6/91";*/
static char *rcsid = "$Id: getpass.c,v 1.4 1994/01/04 18:27:08 jtc Exp $";
#if 0
static char sccsid[] = "@(#)getpass.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: getpass.c,v 1.5 1995/02/27 04:12:59 cgd Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/termios.h>
#include <sys/signal.h>
#include <paths.h>
#include <pwd.h>
#include <stdio.h>
#include <unistd.h>
#include <pwd.h>
#include <paths.h>
char *
getpass(prompt)
@ -82,7 +88,7 @@ getpass(prompt)
(void)write(fileno(outfp), "\n", 1);
if (echo) {
term.c_lflag |= ECHO;
tcsetattr(fileno(fp), TCSAFLUSH|TCSASOFT, &term);
(void)tcsetattr(fileno(fp), TCSAFLUSH|TCSASOFT, &term);
}
(void)sigsetmask(omask);
if (fp != stdin)

View File

@ -1,5 +1,7 @@
.\" Copyright (c) 1988, 1991 The Regents of the University of California.
.\" All rights reserved.
.\" $NetBSD: getpwent.3,v 1.7 1995/02/27 04:13:01 cgd Exp $
.\"
.\" Copyright (c) 1988, 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
@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)getpwent.3 6.8 (Berkeley) 4/19/91
.\" $Id: getpwent.3,v 1.6 1995/01/03 15:57:32 jtc Exp $
.\" @(#)getpwent.3 8.2 (Berkeley) 12/11/93
.\"
.Dd April 19, 1991
.Dd December 11, 1993
.Dt GETPWENT 3
.Os
.Sh NAME
@ -113,7 +114,7 @@ up subsequent accesses for all of the routines.
as it doesn't close its file descriptors by default.)
.Pp
It is dangerous for long-running programs to keep the file descriptors
open the database will become out of date if it is updated while the
open as the database will become out of date if it is updated while the
program is running.
.Pp
The

View File

@ -1,6 +1,8 @@
/* $NetBSD: getpwent.c,v 1.12 1995/02/27 04:13:05 cgd Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1988, 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: @(#)getpwent.c 5.21 (Berkeley) 3/14/91";*/
static char *rcsid = "$Id: getpwent.c,v 1.11 1994/03/09 10:10:29 deraadt Exp $";
#if 0
static char sccsid[] = "@(#)getpwent.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: getpwent.c,v 1.12 1995/02/27 04:13:05 cgd Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>

View File

@ -1,3 +1,5 @@
.\" $NetBSD: getsubopt.3,v 1.3 1995/02/27 04:13:09 cgd Exp $
.\"
.\" Copyright (c) 1990, 1991 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: @(#)getsubopt.3 5.4 (Berkeley) 7/31/91
.\" $Id: getsubopt.3,v 1.2 1993/07/30 08:36:45 mycroft Exp $
.\" @(#)getsubopt.3 5.4 (Berkeley) 7/31/91
.\"
.Dd July 31, 1991
.Dt GETSUBOPT 3

View File

@ -1,3 +1,5 @@
/* $NetBSD: getsubopt.c,v 1.4 1995/02/27 04:13:12 cgd Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
* All rights reserved.
@ -32,8 +34,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)getsubopt.c 5.2 (Berkeley) 2/24/91";*/
static char *rcsid = "$Id: getsubopt.c,v 1.3 1993/08/26 00:44:43 jtc Exp $";
#if 0
static char *sccsid = "@(#)getsubopt.c 5.2 (Berkeley) 2/24/91";
#else
static char rcsid[] = "$NetBSD: getsubopt.c,v 1.4 1995/02/27 04:13:12 cgd Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
#include <unistd.h>

View File

@ -1,5 +1,7 @@
.\" Copyright (c) 1989, 1991 The Regents of the University of California.
.\" All rights reserved.
.\" $NetBSD: getttyent.3,v 1.6 1995/02/27 04:13:16 cgd Exp $
.\"
.\" Copyright (c) 1989, 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
@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)getttyent.3 6.7 (Berkeley) 4/19/91
.\" $Id: getttyent.3,v 1.5 1994/03/30 06:31:02 cgd Exp $
.\" @(#)getttyent.3 8.1 (Berkeley) 6/4/93
.\"
.Dd April 19, 1991
.Dd June 4, 1993
.Dt GETTTYENT 3
.Os BSD 4.3
.Sh NAME

View File

@ -1,6 +1,8 @@
/* $NetBSD: getttyent.c,v 1.8 1995/02/27 04:13:20 cgd Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
* Copyright (c) 1989, 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: @(#)getttyent.c 5.10 (Berkeley) 3/23/91";*/
static char *rcsid = "$Id: getttyent.c,v 1.7 1994/03/30 08:22:07 cgd Exp $";
#if 0
static char sccsid[] = "@(#)getttyent.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: getttyent.c,v 1.8 1995/02/27 04:13:20 cgd Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
#include <ttyent.h>

View File

@ -1,5 +1,7 @@
.\" Copyright (c) 1985, 1991 The Regents of the University of California.
.\" All rights reserved.
.\" $NetBSD: getusershell.3,v 1.3 1995/02/27 04:13:24 cgd Exp $
.\"
.\" Copyright (c) 1985, 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
@ -29,10 +31,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)getusershell.3 6.5 (Berkeley) 4/19/91
.\" $Id: getusershell.3,v 1.2 1993/07/30 08:36:52 mycroft Exp $
.\" @(#)getusershell.3 8.1 (Berkeley) 6/4/93
.\"
.Dd April 19, 1991
.Dd June 4, 1993
.Dt GETUSERSHELL 3
.Os BSD 4.3
.Sh NAME

View File

@ -1,6 +1,8 @@
/* $NetBSD: getusershell.c,v 1.5 1995/02/27 04:13:27 cgd Exp $ */
/*
* Copyright (c) 1985 Regents of the University of California.
* All rights reserved.
* Copyright (c) 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,32 +34,33 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
/*static char *sccsid = "from: @(#)getusershell.c 5.7 (Berkeley) 2/23/91";*/
static char *rcsid = "$Id: getusershell.c,v 1.4 1993/08/26 00:44:45 jtc Exp $";
#if 0
static char sccsid[] = "@(#)getusershell.c 8.1 (Berkeley) 6/4/93";
#else
static char rcsid[] = "$NetBSD: getusershell.c,v 1.5 1995/02/27 04:13:27 cgd Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#include <sys/file.h>
#include <sys/stat.h>
#include <ctype.h>
#include <stdio.h>
#include <ctype.h>
#include <stdlib.h>
#include <unistd.h>
#define SHELLS "/etc/shells"
#include <paths.h>
/*
* Do not add local shells here. They should be added in /etc/shells
* Local shells should NOT be added here. They should be added in
* /etc/shells.
*/
static char *okshells[] =
{ "/bin/sh", "/bin/csh", 0 };
static char **shells, *strings;
static char **curshell = NULL;
static char **initshells();
static char *okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL };
static char **curshell, **shells, *strings;
static char **initshells __P((void));
/*
* Get a list of shells from SHELLS, if it exists.
* Get a list of shells from _PATH_SHELLS, if it exists.
*/
char *
getusershell()
@ -77,7 +80,7 @@ endusershell()
{
if (shells != NULL)
free((char *)shells);
free(shells);
shells = NULL;
if (strings != NULL)
free(strings);
@ -100,27 +103,27 @@ initshells()
struct stat statb;
if (shells != NULL)
free((char *)shells);
free(shells);
shells = NULL;
if (strings != NULL)
free(strings);
strings = NULL;
if ((fp = fopen(SHELLS, "r")) == (FILE *)0)
return(okshells);
if ((fp = fopen(_PATH_SHELLS, "r")) == NULL)
return (okshells);
if (fstat(fileno(fp), &statb) == -1) {
(void)fclose(fp);
return(okshells);
return (okshells);
}
if ((strings = malloc((unsigned)statb.st_size)) == NULL) {
if ((strings = malloc((u_int)statb.st_size)) == NULL) {
(void)fclose(fp);
return(okshells);
return (okshells);
}
shells = (char **)calloc((unsigned)statb.st_size / 3, sizeof (char *));
shells = calloc((unsigned)statb.st_size / 3, sizeof (char *));
if (shells == NULL) {
(void)fclose(fp);
free(strings);
strings = NULL;
return(okshells);
return (okshells);
}
sp = shells;
cp = strings;
@ -134,7 +137,7 @@ initshells()
cp++;
*cp++ = '\0';
}
*sp = (char *)0;
*sp = NULL;
(void)fclose(fp);
return (shells);
}

View File

@ -1,4 +1,6 @@
.\" Copyright (c) 1989, 1991, 1993
.\" $NetBSD: glob.3,v 1.9 1995/02/27 04:13:30 cgd Exp $
.\"
.\" Copyright (c) 1989, 1991, 1993, 1994
.\" The Regents of the University of California. All rights reserved.
.\"
.\" This code is derived from software contributed to Berkeley by
@ -31,10 +33,9 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
.\" from: @(#)glob.3 8.1 (Berkeley) 6/9/93
.\" $Id: glob.3,v 1.8 1994/01/06 13:24:09 deraadt Exp $
.\" @(#)glob.3 8.3 (Berkeley) 4/16/94
.\"
.Dd June 9, 1993
.Dd April 16, 1994
.Dt GLOB 3
.Os
.Sh NAME
@ -381,10 +382,24 @@ The arguments
and
.Fa pglob\->gl_pathv
are still set as specified above.
.Sh EXAMPLE
A rough equivalent of
.Ql "ls -l *.c *.h"
can be obtained with the
following code:
.Bd -literal -offset indent
glob_t g;
g.gl_offs = 2;
glob("*.c", GLOB_DOOFFS, NULL, &g);
glob("*.h", GLOB_DOOFFS | GLOB_APPEND, NULL, &g);
g.gl_pathv[0] = "ls";
g.gl_pathv[1] = "-l";
execvp("ls", g.gl_pathv);
.Ed
.Sh SEE ALSO
.Xr sh 1 ,
.Xr fnmatch 3 ,
.Xr wordexp 3 ,
.Xr regexp 3
.Sh STANDARDS
The
@ -407,21 +422,6 @@ and
should not be used by applications striving for strict
.Tn POSIX
conformance.
.Sh EXAMPLE
A rough equivalent of
.Ql "ls -l *.c *.h"
can be obtained with the
following code:
.Bd -literal -offset indent
glob_t g;
g.gl_offs = 2;
glob("*.c", GLOB_DOOFFS, NULL, &g);
glob("*.h", GLOB_DOOFFS | GLOB_APPEND, NULL, &g);
g.gl_pathv[0] = "ls";
g.gl_pathv[1] = "-l";
execvp("ls", g.gl_pathv);
.Ed
.Sh HISTORY
The
.Fn glob

View File

@ -1,3 +1,5 @@
/* $NetBSD: glob.c,v 1.5 1995/02/27 04:13:35 cgd Exp $ */
/*
* Copyright (c) 1989, 1993
* The Regents of the University of California. All rights reserved.
@ -35,8 +37,11 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
/* from: static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93"; */
static char *rcsid = "$Id: glob.c,v 1.4 1993/11/06 01:10:18 cgd Exp $";
#if 0
static char sccsid[] = "@(#)glob.c 8.3 (Berkeley) 10/13/93";
#else
static char rcsid[] = "$NetBSD: glob.c,v 1.5 1995/02/27 04:13:35 cgd Exp $";
#endif
#endif /* LIBC_SCCS and not lint */
/*