summaryrefslogtreecommitdiff
path: root/usr.bin/rdist
diff options
context:
space:
mode:
authorJason Downs <downsj@cvs.openbsd.org>1997-04-27 13:01:30 +0000
committerJason Downs <downsj@cvs.openbsd.org>1997-04-27 13:01:30 +0000
commit3732b94a837ea7489ea6a07bbe6ca0fb016b68e7 (patch)
tree237c6476e2a85c8bb07bbbbde579210b46406c1f /usr.bin/rdist
parentd6fb7fb1a11dedc45f7c35618fbea3789a4cad58 (diff)
Pull in more includes to properly prototype library functions, kill local
decls of library functions, kill local implementation of setproctitle(). This of course points out how utterly bad this code is and that someone needs to come in here with a chainsaw sometime.
Diffstat (limited to 'usr.bin/rdist')
-rw-r--r--usr.bin/rdist/Makefile4
-rw-r--r--usr.bin/rdist/common.c6
-rw-r--r--usr.bin/rdist/defs.h13
-rw-r--r--usr.bin/rdist/os-openbsd.h4
-rw-r--r--usr.bin/rdist/setargs.c163
5 files changed, 18 insertions, 172 deletions
diff --git a/usr.bin/rdist/Makefile b/usr.bin/rdist/Makefile
index bf1c5adaa19..c57652a8b1e 100644
--- a/usr.bin/rdist/Makefile
+++ b/usr.bin/rdist/Makefile
@@ -1,11 +1,11 @@
-# $OpenBSD: Makefile,v 1.7 1996/09/07 03:14:26 millert Exp $
+# $OpenBSD: Makefile,v 1.8 1997/04/27 13:01:27 downsj Exp $
#
# from: @(#)Makefile 5.11 (Berkeley) 3/12/91
PROG= rdist
CFLAGS+=-I. -DOS_H=\"os-openbsd.h\"
SRCS= gram.y child.c client.c common.c distopt.c docmd.c expand.c \
- isexec.c lookup.c message.c rdist.c rshrcmd.c setargs.c signal.c
+ isexec.c lookup.c message.c rdist.c rshrcmd.c signal.c
CLEANFILES+=gram.c y.tab.h
LDADD= -lcompat
diff --git a/usr.bin/rdist/common.c b/usr.bin/rdist/common.c
index 96f57b7d51f..b67d6521c2b 100644
--- a/usr.bin/rdist/common.c
+++ b/usr.bin/rdist/common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.c,v 1.3 1996/06/26 05:38:09 deraadt Exp $ */
+/* $OpenBSD: common.c,v 1.4 1997/04/27 13:01:28 downsj Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
static char RCSid[] =
-"$OpenBSD: common.c,v 1.3 1996/06/26 05:38:09 deraadt Exp $";
+"$OpenBSD: common.c,v 1.4 1997/04/27 13:01:28 downsj Exp $";
static char sccsid[] = "@(#)common.c";
@@ -141,7 +141,7 @@ extern int init(argc, argv, envp)
for (i = 0; i < argc; i++)
realargv[i] = strdup(argv[i]);
-#if defined(SETARGS)
+#if defined(SETARGS) && !defined(__OpenBSD__)
setargs_settup(argc, argv, envp);
#endif /* SETARGS */
diff --git a/usr.bin/rdist/defs.h b/usr.bin/rdist/defs.h
index 1fbfc4945e3..dc71280a7a4 100644
--- a/usr.bin/rdist/defs.h
+++ b/usr.bin/rdist/defs.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: defs.h,v 1.5 1996/04/28 22:11:55 etheisen Exp $ */
+/* $OpenBSD: defs.h,v 1.6 1997/04/27 13:01:28 downsj Exp $ */
#ifndef __DEFS_H__
#define __DEFS_H__
/*
@@ -35,7 +35,7 @@
*/
/*
- * $Id: defs.h,v 1.5 1996/04/28 22:11:55 etheisen Exp $
+ * $Id: defs.h,v 1.6 1997/04/27 13:01:28 downsj Exp $
* @(#)defs.h 5.2 (Berkeley) 3/20/86
*/
@@ -95,6 +95,9 @@
#if defined(NEED_UNISTD_H)
#include <unistd.h>
#endif /* NEED_UNISTD_H */
+#if defined(NEED_STDLIB_H)
+#include <stdlib.h>
+#endif /* NEED_STDLIB_H */
#if defined(NEED_STRING_H)
#include <string.h>
#endif /* NEED_STRING_H */
@@ -340,6 +343,7 @@ extern int dostatdb;
extern int juststatdb;
#endif /* USE_STATDB */
+#if 0
/*
* System function declarations
*/
@@ -348,6 +352,7 @@ char *strchr();
char *strdup();
char *strrchr();
char *strtok();
+#endif
/*
* Our own declarations.
@@ -403,7 +408,9 @@ extern void debugmsg(int, char *, ...);
extern void error(char *, ...);
extern void fatalerr(char *, ...);
extern void message(int, char *, ...);
-/*extern void setproctitle(char *fmt, ...); /* Not for OpenBSD*/
+#if 0
+extern void setproctitle(char *fmt, ...);
+#endif
#else
extern void debugmsg();
extern void error();
diff --git a/usr.bin/rdist/os-openbsd.h b/usr.bin/rdist/os-openbsd.h
index 99862dc546f..da96be555ec 100644
--- a/usr.bin/rdist/os-openbsd.h
+++ b/usr.bin/rdist/os-openbsd.h
@@ -1,4 +1,4 @@
-/* * $OpenBSD: os-openbsd.h,v 1.4 1997/02/09 23:58:44 millert Exp $*/
+/* * $OpenBSD: os-openbsd.h,v 1.5 1997/04/27 13:01:29 downsj Exp $*/
/*
* Copyright (c) 1993 Michael A. Cooper
* Copyright (c) 1993 Regents of the University of California.
@@ -150,6 +150,8 @@ typedef void POINTER;
* Things we need
*/
#define NEED_UNISTD_H /* Need <unistd.h> */
+#define NEED_STDLIB_H /* Need <stdlib.h> */
+#define NEED_STRING_H /* Need <string.h> */
/*
* Path to the remote shell command.
diff --git a/usr.bin/rdist/setargs.c b/usr.bin/rdist/setargs.c
deleted file mode 100644
index c22067649af..00000000000
--- a/usr.bin/rdist/setargs.c
+++ /dev/null
@@ -1,163 +0,0 @@
-/* $OpenBSD: setargs.c,v 1.3 1996/06/26 05:38:18 deraadt Exp $ */
-
-/*
- * Copyright (c) 1983 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
- * 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 lint
-static char RCSid[] =
-"$OpenBSD: setargs.c,v 1.3 1996/06/26 05:38:18 deraadt Exp $";
-
-static char sccsid[] = "@(#)setargs.c";
-
-static char copyright[] =
-"@(#) Copyright (c) 1983 Regents of the University of California.\n\
- All rights reserved.\n";
-#endif /* not lint */
-
-#include "defs.h"
-
-#if defined(SETARGS)
-
-/*
- * Set process argument functions
- */
-
-#define MAXUSERENVIRON 40
-char **Argv = NULL;
-char *LastArgv = NULL;
-char *UserEnviron[MAXUSERENVIRON+1];
-
-/*
- * Settup things for using setproctitle()
- */
-setargs_settup(argc, argv, envp)
- int argc;
- char **argv;
- char **envp;
-{
- register int i;
- extern char **environ;
-
- /* Remember the User Environment */
-
- for (i = 0; i < MAXUSERENVIRON && envp[i] != NULL; i++)
- UserEnviron[i] = strdup(envp[i]);
- UserEnviron[i] = NULL;
- environ = UserEnviron;
-
- /* Save start and extent of argv for setproctitle */
- Argv = argv;
- if (i > 0)
- LastArgv = envp[i-1] + strlen(envp[i-1]);
- else
- LastArgv = argv[argc-1] + strlen(argv[argc-1]);
-}
-
-/*
- * Set process title
- */
-extern void _setproctitle(msg)
- char *msg;
-{
- register int i;
- char *p;
-
- p = Argv[0];
-
- /* Make ps print "(program)" */
- *p++ = '-';
-
- i = strlen(msg);
- if (i > LastArgv - p - 2) {
- i = LastArgv - p - 2;
- msg[i] = '\0';
- }
- (void) strcpy(p, msg);
- p += i;
- while (p < LastArgv) {
- *p++ = ' ';
- }
-}
-
-#if defined(ARG_TYPE) && ARG_TYPE == ARG_VARARGS
-/*
- * Varargs front-end to _setproctitle()
- */
-extern void setproctitle(va_alist)
- va_dcl
-{
- static char buf[BUFSIZ];
- va_list args;
- char *fmt;
-
- va_start(args);
- fmt = va_arg(args, char *);
- (void) vsprintf(buf, fmt, args);
- va_end(args);
-
- _setproctitle(buf);
-}
-#endif /* ARG_VARARGS */
-#if defined(ARG_TYPE) && ARG_TYPE == ARG_STDARG
-/*
- * Stdarg front-end to _setproctitle()
- */
-extern void setproctitle(char *fmt, ...)
-{
- static char buf[BUFSIZ];
- va_list args;
-
- va_start(args, fmt);
- (void) vsprintf(buf, fmt, args);
- va_end(args);
-
- _setproctitle(buf);
-}
-#endif /* ARG_STDARG */
-#if !defined(ARG_TYPE)
-/*
- * Non-Varargs front-end to _setproctitle()
- */
-/*VARARGS1*/
-extern void setproctitle(fmt, a1, a2, a3, a4, a5, a6)
- char *fmt;
-{
- static char buf[BUFSIZ];
-
- (void) sprintf(buf, fmt, a1, a2, a3, a4, a5, a6);
-
- _setproctitle(buf);
-}
-#endif /* !ARG_TYPE */
-
-#endif /* SETARGS */