From 3b7e1cc80ffe102239ea20f8ea00eb74bebbc4e9 Mon Sep 17 00:00:00 2001 From: Peter Wemm Date: Mon, 1 Jan 1996 08:27:41 +0000 Subject: [PATCH] Bump libutil revision after recent addition of setproctitle(). Install (optional) libutil.h with prototypes for the functions and document this in the man page. minor cleanups to the various routines, include the prototype file, declare return codes etc. --- lib/libc/gen/setproctitle.3 | 10 ++++++++- lib/libutil/Makefile | 8 ++++++- lib/libutil/libutil.h | 44 +++++++++++++++++++++++++++++++++++++ lib/libutil/login.c | 1 + lib/libutil/login_tty.c | 5 +++++ lib/libutil/logout.c | 1 + lib/libutil/logwtmp.c | 2 ++ lib/libutil/pty.c | 2 ++ lib/libutil/setproctitle.3 | 10 ++++++++- 9 files changed, 80 insertions(+), 3 deletions(-) create mode 100644 lib/libutil/libutil.h diff --git a/lib/libc/gen/setproctitle.3 b/lib/libc/gen/setproctitle.3 index dffed301898..5eefe609d10 100644 --- a/lib/libc/gen/setproctitle.3 +++ b/lib/libc/gen/setproctitle.3 @@ -17,7 +17,7 @@ .\" 5. Modifications may be freely made to this file providing the above .\" conditions are met. .\" -.\" $Id$ +.\" $Id: setproctitle.3,v 1.1 1995/12/26 22:50:08 peter Exp $ .\" .\" The following requests are required for all man pages. .Dd December 16, 1995 @@ -28,8 +28,16 @@ .Nd set the process title for .Xr ps 1 .Sh SYNOPSIS +#include +.Pp .Ft void .Fn setproctitle "const char *fmt" "..." +.Pp +Link with +.Va -lutil +on the +.Xr cc 1 +command line. .Sh DESCRIPTION The .Nm setproctitle diff --git a/lib/libutil/Makefile b/lib/libutil/Makefile index 47366cc3387..0ad1151abe9 100644 --- a/lib/libutil/Makefile +++ b/lib/libutil/Makefile @@ -1,8 +1,14 @@ # @(#)Makefile 8.1 (Berkeley) 6/4/93 LIB= util -CFLAGS+=-DLIBC_SCCS -I/sys +SHLIB_MAJOR= 2 +SHLIB_MINOR= 1 +CFLAGS+=-DLIBC_SCCS -I${.CURDIR} -I/sys SRCS= login.c login_tty.c logout.c logwtmp.c pty.c setproctitle.c MAN3+= setproctitle.3 +beforeinstall: + ${INSTALL} -C -o ${BINOWN} -g ${BINGRP} -m 444 ${.CURDIR}/libutil.h \ + ${DESTDIR}/usr/include + .include diff --git a/lib/libutil/libutil.h b/lib/libutil/libutil.h new file mode 100644 index 00000000000..3f32d7ac0c0 --- /dev/null +++ b/lib/libutil/libutil.h @@ -0,0 +1,44 @@ +/* + * Copyright (c) 1995 Peter Wemm + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, is permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice immediately at the beginning of the file, without modification, + * 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. This work was done expressly for inclusion into FreeBSD. Other use + * is permitted provided this notation is included. + * 4. Absolutely no warranty of function or purpose is made by the author + * Peter Wemm. + * 5. Modifications may be freely made to this file providing the above + * conditions are met. + * + * $Id$ + */ + +#ifndef _LIBUTIL_H_ +#define _LIBUTIL_H_ + +#include + +/* Avoid pulling in all the include files for no need */ +struct termios; +struct winsize; +struct utmp; + +__BEGIN_DECLS +void setproctitle __P((const char *fmt, ...)); +void login __P((struct utmp *ut)); +int login_tty __P((int fd)); +int logout __P((char *line)); +void logwtmp __P((char *line, char *name, char *host)); +int openpty __P((int *amaster, int *aslave, char *name, + struct termios *termp, struct winsize *winp)); +__END_DECLS + +#endif /* !_LIBUTIL_H_ */ diff --git a/lib/libutil/login.c b/lib/libutil/login.c index 911c2892d20..3e68563a911 100644 --- a/lib/libutil/login.c +++ b/lib/libutil/login.c @@ -42,6 +42,7 @@ static char sccsid[] = "@(#)login.c 8.1 (Berkeley) 6/4/93"; #include #include #include +#include void login(ut) diff --git a/lib/libutil/login_tty.c b/lib/libutil/login_tty.c index 5692637fdc4..a5b19ba1c2b 100644 --- a/lib/libutil/login_tty.c +++ b/lib/libutil/login_tty.c @@ -38,6 +38,11 @@ static char sccsid[] = "@(#)login_tty.c 8.1 (Berkeley) 6/4/93"; #include #include +#include +#include +#include + +int login_tty(fd) int fd; { diff --git a/lib/libutil/logout.c b/lib/libutil/logout.c index 11da24f1c80..d8cf3c87024 100644 --- a/lib/libutil/logout.c +++ b/lib/libutil/logout.c @@ -43,6 +43,7 @@ static char sccsid[] = "@(#)logout.c 8.1 (Berkeley) 6/4/93"; #include #include #include +#include typedef struct utmp UTMP; diff --git a/lib/libutil/logwtmp.c b/lib/libutil/logwtmp.c index d55ac9e9413..f4a6408d659 100644 --- a/lib/libutil/logwtmp.c +++ b/lib/libutil/logwtmp.c @@ -42,7 +42,9 @@ static char sccsid[] = "@(#)logwtmp.c 8.1 (Berkeley) 6/4/93"; #include #include +#include +void logwtmp(line, name, host) char *line, *name, *host; { diff --git a/lib/libutil/pty.c b/lib/libutil/pty.c index 5aecbfbf2f7..515ff9eb437 100644 --- a/lib/libutil/pty.c +++ b/lib/libutil/pty.c @@ -47,7 +47,9 @@ static char sccsid[] = "@(#)pty.c 8.3 (Berkeley) 5/16/94"; #include #include #include +#include +int openpty(amaster, aslave, name, termp, winp) int *amaster, *aslave; char *name; diff --git a/lib/libutil/setproctitle.3 b/lib/libutil/setproctitle.3 index dffed301898..5eefe609d10 100644 --- a/lib/libutil/setproctitle.3 +++ b/lib/libutil/setproctitle.3 @@ -17,7 +17,7 @@ .\" 5. Modifications may be freely made to this file providing the above .\" conditions are met. .\" -.\" $Id$ +.\" $Id: setproctitle.3,v 1.1 1995/12/26 22:50:08 peter Exp $ .\" .\" The following requests are required for all man pages. .Dd December 16, 1995 @@ -28,8 +28,16 @@ .Nd set the process title for .Xr ps 1 .Sh SYNOPSIS +#include +.Pp .Ft void .Fn setproctitle "const char *fmt" "..." +.Pp +Link with +.Va -lutil +on the +.Xr cc 1 +command line. .Sh DESCRIPTION The .Nm setproctitle