summaryrefslogtreecommitdiff
path: root/lib/libutil
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1996-06-17 07:46:06 +0000
committerJason Downs <downsj@cvs.openbsd.org>1996-06-17 07:46:06 +0000
commit9281454e7819387863b8e0d34b445bce3c512f2d (patch)
treea58e8710a1b3de0783522b55afcc2d3195df83f9 /lib/libutil
parent5cf61379d069ade38e8b4ad8863767ed160e75e0 (diff)
util.h: new resting place
opendev.h: ok, so I merged it with util.h opendev.h: use util.h everything else: use "util.h"
Diffstat (limited to 'lib/libutil')
-rw-r--r--lib/libutil/Makefile4
-rw-r--r--lib/libutil/getmaxpartitions.c4
-rw-r--r--lib/libutil/getrawpartition.c4
-rw-r--r--lib/libutil/login.c6
-rw-r--r--lib/libutil/login_tty.c6
-rw-r--r--lib/libutil/logout.c6
-rw-r--r--lib/libutil/logwtmp.c6
-rw-r--r--lib/libutil/opendev.c15
-rw-r--r--lib/libutil/opendev.h45
-rw-r--r--lib/libutil/passwd.c4
-rw-r--r--lib/libutil/pty.c6
-rw-r--r--lib/libutil/util.h76
12 files changed, 114 insertions, 68 deletions
diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile
index 49c01cfda9e..4b9412b0a18 100644
--- a/lib/libutil/Makefile
+++ b/lib/libutil/Makefile
@@ -1,10 +1,10 @@
-# $OpenBSD: Makefile,v 1.4 1996/06/17 06:35:32 downsj Exp $
+# $OpenBSD: Makefile,v 1.5 1996/06/17 07:46:01 downsj Exp $
# $NetBSD: Makefile,v 1.8 1996/05/16 07:03:28 thorpej Exp $
LIB= util
CFLAGS+=-DLIBC_SCCS
-HDRS= opendev.h scsi.h
+HDRS= util.h scsi.h
SRCS= getmaxpartitions.c getrawpartition.c login.c login_tty.c logout.c \
logwtmp.c opendev.c passwd.c pty.c scsi.c
diff --git a/lib/libutil/getmaxpartitions.c b/lib/libutil/getmaxpartitions.c
index 493c885bc25..0afe6e7ac66 100644
--- a/lib/libutil/getmaxpartitions.c
+++ b/lib/libutil/getmaxpartitions.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: getmaxpartitions.c,v 1.2 1996/06/17 07:46:01 downsj Exp $ */
/* $NetBSD: getmaxpartitions.c,v 1.1 1996/05/16 07:03:31 thorpej Exp $ */
/*-
@@ -42,7 +43,8 @@ static char rcsid[] = "$NetBSD: getmaxpartitions.c,v 1.1 1996/05/16 07:03:31 tho
#include <sys/param.h>
#include <sys/sysctl.h>
-#include <util.h>
+
+#include "util.h"
int
getmaxpartitions()
diff --git a/lib/libutil/getrawpartition.c b/lib/libutil/getrawpartition.c
index 239a030f84b..346701d1d2c 100644
--- a/lib/libutil/getrawpartition.c
+++ b/lib/libutil/getrawpartition.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: getrawpartition.c,v 1.2 1996/06/17 07:46:02 downsj Exp $ */
/* $NetBSD: getrawpartition.c,v 1.1 1996/05/16 07:03:33 thorpej Exp $ */
/*-
@@ -42,7 +43,8 @@ static char rcsid[] = "$NetBSD: getrawpartition.c,v 1.1 1996/05/16 07:03:33 thor
#include <sys/param.h>
#include <sys/sysctl.h>
-#include <util.h>
+
+#include "util.h"
int
getrawpartition()
diff --git a/lib/libutil/login.c b/lib/libutil/login.c
index 2398f001313..c70040701af 100644
--- a/lib/libutil/login.c
+++ b/lib/libutil/login.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: login.c,v 1.3 1996/06/17 07:46:02 downsj Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/* from: static char sccsid[] = "@(#)login.c 8.1 (Berkeley) 6/4/93"; */
-static char *rcsid = "$Id: login.c,v 1.2 1996/05/22 11:35:05 deraadt Exp $";
+static char *rcsid = "$Id: login.c,v 1.3 1996/06/17 07:46:02 downsj Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -43,7 +44,8 @@ static char *rcsid = "$Id: login.c,v 1.2 1996/05/22 11:35:05 deraadt Exp $";
#include <stdlib.h>
#include <utmp.h>
#include <stdio.h>
-#include <util.h>
+
+#include "util.h"
void
login(ut)
diff --git a/lib/libutil/login_tty.c b/lib/libutil/login_tty.c
index a72a9f457a2..8b88f4f6577 100644
--- a/lib/libutil/login_tty.c
+++ b/lib/libutil/login_tty.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: login_tty.c,v 1.3 1996/06/17 07:46:02 downsj Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,13 +34,14 @@
#if defined(LIBC_SCCS) && !defined(lint)
/* from: static char sccsid[] = "@(#)login_tty.c 8.1 (Berkeley) 6/4/93"; */
-static char *rcsid = "$Id: login_tty.c,v 1.2 1996/05/22 11:35:06 deraadt Exp $";
+static char *rcsid = "$Id: login_tty.c,v 1.3 1996/06/17 07:46:02 downsj Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
#include <sys/ioctl.h>
#include <unistd.h>
-#include <util.h>
+
+#include "util.h"
int
login_tty(fd)
diff --git a/lib/libutil/logout.c b/lib/libutil/logout.c
index a3e34793c01..2276167e2f8 100644
--- a/lib/libutil/logout.c
+++ b/lib/libutil/logout.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: logout.c,v 1.3 1996/06/17 07:46:03 downsj Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/* from: static char sccsid[] = "@(#)logout.c 8.1 (Berkeley) 6/4/93"; */
-static char *rcsid = "$Id: logout.c,v 1.2 1996/05/22 11:35:07 deraadt Exp $";
+static char *rcsid = "$Id: logout.c,v 1.3 1996/06/17 07:46:03 downsj Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -44,7 +45,8 @@ static char *rcsid = "$Id: logout.c,v 1.2 1996/05/22 11:35:07 deraadt Exp $";
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
-#include <util.h>
+
+#include "util.h"
typedef struct utmp UTMP;
diff --git a/lib/libutil/logwtmp.c b/lib/libutil/logwtmp.c
index 9cfcf2d61da..31bb3e5b28d 100644
--- a/lib/libutil/logwtmp.c
+++ b/lib/libutil/logwtmp.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: logwtmp.c,v 1.3 1996/06/17 07:46:03 downsj Exp $ */
/*
* Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/* from: static char sccsid[] = "@(#)logwtmp.c 8.1 (Berkeley) 6/4/93"; */
-static char *rcsid = "$Id: logwtmp.c,v 1.2 1996/05/22 11:35:08 deraadt Exp $";
+static char *rcsid = "$Id: logwtmp.c,v 1.3 1996/06/17 07:46:03 downsj Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/types.h>
@@ -44,7 +45,8 @@ static char *rcsid = "$Id: logwtmp.c,v 1.2 1996/05/22 11:35:08 deraadt Exp $";
#include <string.h>
#include <unistd.h>
#include <utmp.h>
-#include <util.h>
+
+#include "util.h"
void
logwtmp(line, name, host)
diff --git a/lib/libutil/opendev.c b/lib/libutil/opendev.c
index 66b50e08134..6603dc0791a 100644
--- a/lib/libutil/opendev.c
+++ b/lib/libutil/opendev.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: opendev.c,v 1.1 1996/06/17 06:35:34 downsj Exp $ */
+/* $OpenBSD: opendev.c,v 1.2 1996/06/17 07:46:03 downsj Exp $ */
/*
* Copyright (c) 1996, Jason Downs. All rights reserved.
@@ -31,7 +31,7 @@
#include <sys/disklabel.h>
#include <paths.h>
-#include "opendev.h"
+#include "util.h"
/*
* This routine is a generic rewrite of the original code found in
@@ -39,11 +39,10 @@
*/
int
-opendev(path, oflags, dflags, mode, realpath)
+opendev(path, oflags, dflags, realpath)
char *path;
int oflags;
int dflags;
- mode_t mode;
char **realpath;
{
int fd;
@@ -51,7 +50,7 @@ opendev(path, oflags, dflags, mode, realpath)
*realpath = path;
- fd = open(path, oflags, mode);
+ fd = open(path, oflags);
if ((fd < 0) && (errno == ENOENT)) {
if (path[0] != '/') {
if (dflags & OPENDEV_PART) {
@@ -61,14 +60,14 @@ opendev(path, oflags, dflags, mode, realpath)
*/
(void)snprintf(namebuf, sizeof(namebuf),
"%sr%s%c", _PATH_DEV, path, 'a' + RAW_PART);
- fd = open(namebuf, oflags, mode);
+ fd = open(namebuf, oflags);
}
if ((dflags & OPENDEV_DRCT) && (fd < 0) &&
(errno == ENOENT)) {
/* ..and now no partition (for tapes) */
namebuf[strlen(namebuf) - 1] = '\0';
- fd = open(namebuf, oflags, mode);
+ fd = open(namebuf, oflags);
}
*realpath = namebuf;
@@ -77,7 +76,7 @@ opendev(path, oflags, dflags, mode, realpath)
if ((fd < 0) && (errno == ENOENT) && (path[0] != '/')) {
(void)snprintf(namebuf, sizeof(namebuf), "%sr%s",
_PATH_DEV, path);
- fd = open(namebuf, oflags, mode);
+ fd = open(namebuf, oflags);
*realpath = namebuf;
}
diff --git a/lib/libutil/opendev.h b/lib/libutil/opendev.h
deleted file mode 100644
index f81f78409fd..00000000000
--- a/lib/libutil/opendev.h
+++ /dev/null
@@ -1,45 +0,0 @@
-/* $OpenBSD: opendev.h,v 1.1 1996/06/17 06:35:34 downsj Exp $ */
-
-/*
- * Copyright (c) 1996, Jason Downs. 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.
- *
- * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``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 THE AUTHOR(S) 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.
- */
-
-#ifndef _OPENDEV_H_
-#define _OPENDEV_H_
-
-#include <sys/types.h>
-
-/*
- * opendev() specific operation flags.
- */
-#define OPENDEV_PART 0x01 /* Try to open the raw partition. */
-#define OPENDEV_DRCT 0x02 /* Try to open the device directly. */
-
-#include <sys/cdefs.h>
-
-__BEGIN_DECLS
-int opendev __P((char *, int, int, mode_t, char **));
-__END_DECLS
-
-#endif /* _OPENDEV_H_ */
diff --git a/lib/libutil/passwd.c b/lib/libutil/passwd.c
index 0d03133d3e3..8c7eeb5faac 100644
--- a/lib/libutil/passwd.c
+++ b/lib/libutil/passwd.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: passwd.c,v 1.3 1996/06/17 07:46:04 downsj Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
* The Regents of the University of California. All rights reserved.
@@ -51,7 +52,8 @@ static char rcsid[] = "$NetBSD: passwd.c,v 1.1 1996/05/15 21:42:31 jtc Exp $";
#include <paths.h>
#include <signal.h>
#include <limits.h>
-#include <util.h>
+
+#include "util.h"
static void pw_cont __P((int sig));
diff --git a/lib/libutil/pty.c b/lib/libutil/pty.c
index 1319ae122f4..fa2c1cadfbd 100644
--- a/lib/libutil/pty.c
+++ b/lib/libutil/pty.c
@@ -1,3 +1,4 @@
+/* $OpenBSD: pty.c,v 1.3 1996/06/17 07:46:05 downsj Exp $ */
/*-
* Copyright (c) 1990, 1993
* The Regents of the University of California. All rights reserved.
@@ -33,7 +34,7 @@
#if defined(LIBC_SCCS) && !defined(lint)
/* from: static char sccsid[] = "@(#)pty.c 8.1 (Berkeley) 6/4/93"; */
-static char *rcsid = "$Id: pty.c,v 1.2 1996/05/22 11:35:11 deraadt Exp $";
+static char *rcsid = "$Id: pty.c,v 1.3 1996/06/17 07:46:05 downsj Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/cdefs.h>
@@ -47,7 +48,8 @@ static char *rcsid = "$Id: pty.c,v 1.2 1996/05/22 11:35:11 deraadt Exp $";
#include <stdio.h>
#include <string.h>
#include <grp.h>
-#include <util.h>
+
+#include "util.h"
#ifdef i386
/* PCVT conflicts with ttyv*. */
diff --git a/lib/libutil/util.h b/lib/libutil/util.h
new file mode 100644
index 00000000000..95a7006e199
--- /dev/null
+++ b/lib/libutil/util.h
@@ -0,0 +1,76 @@
+/* $OpenBSD: util.h,v 1.1 1996/06/17 07:46:05 downsj Exp $ */
+/* $NetBSD: util.h,v 1.2 1996/05/16 07:00:22 thorpej Exp $ */
+
+/*-
+ * Copyright (c) 1995
+ * The Regents of the University of California. All rights reserved.
+ * Portions Copyright (c) 1996, Jason Downs. 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. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University 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 THE REGENTS 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 THE REGENTS 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.
+ */
+
+#ifndef _UTIL_H_
+#define _UTIL_H_
+
+#include <pwd.h>
+#include <utmp.h>
+#include <termios.h>
+#include <sys/ttycom.h>
+#include <sys/types.h>
+#include <sys/cdefs.h>
+
+/*
+ * opendev() specific operation flags.
+ */
+#define OPENDEV_PART 0x01 /* Try to open the raw partition. */
+#define OPENDEV_DRCT 0x02 /* Try to open the device directly. */
+
+__BEGIN_DECLS
+void login __P((struct utmp *));
+int login_tty __P((int));
+int logout __P((const char *));
+void logwtmp __P((const char *, const char *, const char *));
+int opendev __P((char *, int, int, char **));
+int pw_lock __P((int retries));
+int pw_mkdb __P((void));
+int pw_abort __P((void));
+void pw_init __P((void));
+void pw_edit __P((int notsetuid, const char *filename));
+void pw_prompt __P((void));
+void pw_copy __P((int ffd, int tfd, struct passwd *pw));
+int pw_scan __P((char *bp, struct passwd *pw, int *flags));
+void pw_error __P((const char *name, int err, int eval));
+int openpty __P((int *, int *, char *, struct termios *,
+ struct winsize *));
+pid_t forkpty __P((int *, char *, struct termios *, struct winsize *));
+int getmaxpartitions __P((void));
+int getrawpartition __P((void));
+__END_DECLS
+
+#endif /* !_UTIL_H_ */