summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1998-06-26 21:21:25 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1998-06-26 21:21:25 +0000
commite02f77d2a6a52f96b8f35599d9c13a1e62817b9b (patch)
treecdffbc6d417f3f0b0f89db1bc35dd35d4d63b96c /usr.bin
parentf82caec240a71362a5d0f2305c7f074be119948b (diff)
rdist 6.1.4 + OpenBSD patches + some -Wall
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/rdist/child.c24
-rw-r--r--usr.bin/rdist/client.c38
-rw-r--r--usr.bin/rdist/common.c38
-rw-r--r--usr.bin/rdist/config-data.h4
-rw-r--r--usr.bin/rdist/config-def.h4
-rw-r--r--usr.bin/rdist/config.h6
-rw-r--r--usr.bin/rdist/defs.h21
-rw-r--r--usr.bin/rdist/distopt.c15
-rw-r--r--usr.bin/rdist/docmd.c29
-rw-r--r--usr.bin/rdist/expand.c37
-rw-r--r--usr.bin/rdist/gram.y12
-rw-r--r--usr.bin/rdist/isexec.c9
-rw-r--r--usr.bin/rdist/lookup.c10
-rw-r--r--usr.bin/rdist/message.c45
-rw-r--r--usr.bin/rdist/os-openbsd.h25
-rw-r--r--usr.bin/rdist/pathnames.h6
-rw-r--r--usr.bin/rdist/rdist.13
-rw-r--r--usr.bin/rdist/rdist.c26
-rw-r--r--usr.bin/rdist/signal.c9
-rw-r--r--usr.bin/rdist/types.h4
-rw-r--r--usr.bin/rdist/version.h6
-rw-r--r--usr.bin/rdistd/filesys-os.c25
-rw-r--r--usr.bin/rdistd/filesys.c37
-rw-r--r--usr.bin/rdistd/filesys.h6
-rw-r--r--usr.bin/rdistd/rdistd.13
-rw-r--r--usr.bin/rdistd/rdistd.c12
-rw-r--r--usr.bin/rdistd/server.c50
27 files changed, 306 insertions, 198 deletions
diff --git a/usr.bin/rdist/child.c b/usr.bin/rdist/child.c
index c97dbf3baa9..6640cb31483 100644
--- a/usr.bin/rdist/child.c
+++ b/usr.bin/rdist/child.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: child.c,v 1.6 1997/12/16 22:15:36 deraadt Exp $ */
+/* $OpenBSD: child.c,v 1.7 1998/06/26 21:20:58 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: child.c,v 1.6 1997/12/16 22:15:36 deraadt Exp $";
+"$From: child.c,v 6.28 1996/02/22 19:30:09 mcooper Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: child.c,v 1.7 1998/06/26 21:20:58 millert Exp $";
+#endif
static char sccsid[] = "@(#)docmd.c 5.1 (Berkeley) 6/6/85";
@@ -109,7 +114,7 @@ static void removechild(child)
sigemptyset(&set);
sigaddset(&set, SIGCHLD);
- sigprocmask(SIG_BLOCK, &set, (sigset_t *)NULL);
+ sigprocmask(SIG_BLOCK, &set, NULL);
#else /* !POSIX_SIGNALS */
int oldmask;
@@ -122,7 +127,7 @@ static void removechild(child)
childlist = pc->c_next;
#if defined(POSIX_SIGNALS)
- sigprocmask(SIG_UNBLOCK, &set, (sigset_t *)NULL);
+ sigprocmask(SIG_UNBLOCK, &set, NULL);
#else
sigsetmask(oldmask);
#endif /* POSIX_SIGNALS */
@@ -366,7 +371,7 @@ extern void waitup()
register CHILD *pc;
fd_set *rchildfdsp = NULL;
int rchildfdsn = 0;
- int bytes;
+ size_t bytes;
debugmsg(DM_CALL, "waitup() start\n");
@@ -401,9 +406,8 @@ extern void waitup()
debugmsg(DM_MISC, "waitup() Call select(), activechildren=%d\n",
activechildren);
- count = select(rchildfdsn+1, (SELECT_FD_TYPE *) rchildfdsp,
- (SELECT_FD_TYPE *) NULL, (SELECT_FD_TYPE *) NULL,
- (struct timeval *) NULL);
+ count = select(FD_SETSIZE, (SELECT_FD_TYPE *) rchildfdsp,
+ NULL, NULL, NULL);
debugmsg(DM_MISC, "waitup() select returned %d activechildren = %d\n",
count, activechildren);
@@ -453,6 +457,7 @@ extern void waitup()
readchild(pc);
--count;
}
+ free(rchildfdsp);
#else /* !defined(HAVE_SELECT) */
@@ -461,12 +466,11 @@ extern void waitup()
*/
debugmsg(DM_CALL, "waitup() start\n");
- if (waitproc((int *) NULL, TRUE) > 0)
+ if (waitproc(NULL, TRUE) > 0)
--activechildren;
#endif /* defined(HAVE_SELECT) */
debugmsg(DM_CALL, "waitup() end\n");
- free(rchildfdsp);
}
/*
diff --git a/usr.bin/rdist/client.c b/usr.bin/rdist/client.c
index 0ab5c37787c..978f5f460c4 100644
--- a/usr.bin/rdist/client.c
+++ b/usr.bin/rdist/client.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: client.c,v 1.6 1998/05/18 19:12:29 deraadt Exp $ */
+/* $OpenBSD: client.c,v 1.7 1998/06/26 21:21:00 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: client.c,v 1.6 1998/05/18 19:12:29 deraadt Exp $";
+"$From: client.c,v 6.80 1996/02/28 20:34:27 mcooper Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: client.c,v 1.7 1998/06/26 21:21:00 millert Exp $";
+#endif
static char sccsid[] = "@(#)client.c";
@@ -246,8 +251,6 @@ extern void runcmdspecial(cmd, filev, opts)
{
register struct subcmd *sc;
register struct namelist *f;
- register char **cpp;
- char *file;
int first = TRUE;
for (sc = cmd->c_cmds; sc != NULL; sc = sc->sc_next) {
@@ -331,7 +334,7 @@ static struct linkbuf *linkinfo(statp)
else
*lp->target = CNULL;
- return((struct linkbuf *) NULL);
+ return(NULL);
}
/*
@@ -598,7 +601,7 @@ static int senddir(rname, opts, stb, user, group, destdir)
optarget = ptarget;
len = ptarget - target;
- while (dp = readdir(d)) {
+ while ((dp = readdir(d))) {
if (!strcmp(dp->d_name, ".") ||
!strcmp(dp->d_name, ".."))
continue;
@@ -611,7 +614,7 @@ static int senddir(rname, opts, stb, user, group, destdir)
if (ptarget[-1] != '/')
*ptarget++ = '/';
cp = dp->d_name;
- while (*ptarget++ = *cp++)
+ while ((*ptarget++ = *cp++))
;
ptarget--;
if (sendit(dp->d_name, opts, destdir) > 0)
@@ -639,7 +642,7 @@ static int sendlink(rname, opts, stb, user, group, destdir)
char *group;
int destdir;
{
- int sizerr, f, n;
+ int f, n;
static char tbuf[BUFSIZ];
char lbuf[MAXPATHLEN];
u_char *s;
@@ -667,11 +670,16 @@ static int sendlink(rname, opts, stb, user, group, destdir)
/*
* Gather and send additional link info
*/
- sizerr = (readlink(target, lbuf, sizeof(lbuf)-1) != stb->st_size);
+ if ((n = readlink(target, lbuf, sizeof(lbuf)-1)) != -1)
+ lbuf[n] = '\0';
+ else {
+ error("%s: readlink failed", target);
+ err();
+ }
(void) sprintf(tbuf, "%.*s", (int) stb->st_size, lbuf);
(void) sendcmd(C_NONE, "%s\n", tbuf);
- if (sizerr) {
+ if (n != stb->st_size) {
error("%s: file changed size", target);
err();
} else
@@ -838,7 +846,7 @@ static int update(rname, opts, statp)
/*
* Parse size
*/
- size = strtol(cp, (char **) &cp, 10);
+ size = strtol(cp, (char **)&cp, 10);
if (*cp++ != ' ') {
error("update: size not delimited");
return(US_NOTHING);
@@ -847,7 +855,7 @@ static int update(rname, opts, statp)
/*
* Parse mtime
*/
- mtime = strtol(cp, (char **) &cp, 10);
+ mtime = strtol(cp, (char **)&cp, 10);
if (*cp++ != ' ') {
error("update: mtime not delimited");
return(US_NOTHING);
@@ -856,7 +864,7 @@ static int update(rname, opts, statp)
/*
* Parse remote file mode
*/
- rmode = strtol(cp, (char **) &cp, 8);
+ rmode = strtol(cp, (char **)&cp, 8);
if (cp && *cp)
++cp;
@@ -876,7 +884,7 @@ static int update(rname, opts, statp)
/*
* Parse remote file group
*/
- group = strtok((char *) NULL, " ");
+ group = strtok(NULL, " ");
if (group == NULL) {
error("update: group not delimited");
return(US_NOTHING);
@@ -1137,7 +1145,7 @@ extern void cleanup()
(void) unlink(statfile);
#endif
- if (file = getnotifyfile())
+ if ((file = getnotifyfile()))
(void) unlink(file);
}
diff --git a/usr.bin/rdist/common.c b/usr.bin/rdist/common.c
index ca9996671c4..0e753d75869 100644
--- a/usr.bin/rdist/common.c
+++ b/usr.bin/rdist/common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.c,v 1.5 1997/10/07 23:39:34 millert Exp $ */
+/* $OpenBSD: common.c,v 1.6 1998/06/26 21:21:01 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: common.c,v 1.5 1997/10/07 23:39:34 millert Exp $";
+"$From: common.c,v 6.82 1998/03/23 23:27:33 michaelc Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: common.c,v 1.6 1998/06/26 21:21:01 millert Exp $";
+#endif
static char sccsid[] = "@(#)common.c";
@@ -52,6 +57,8 @@ static char copyright[] =
#if defined(NEED_UTIME_H)
#include <utime.h>
#endif /* defined(NEED_UTIME_H) */
+#include <sys/socket.h>
+#include <sys/wait.h>
/*
* Variables common to both client and server
@@ -111,7 +118,7 @@ extern void setprogname(argv)
if (!progname) {
progname = strdup(argv[0]);
- if (cp = strrchr(progname, '/'))
+ if ((cp = strrchr(progname, '/')))
progname = cp + 1;
}
}
@@ -141,7 +148,7 @@ extern int init(argc, argv, envp)
for (i = 0; i < argc; i++)
realargv[i] = strdup(argv[i]);
-#if defined(SETARGS) && !defined(__OpenBSD__)
+#if defined(SETARGS)
setargs_settup(argc, argv, envp);
#endif /* SETARGS */
@@ -488,6 +495,7 @@ extern int remline(buffer, space, doclean)
/*
* Non-line-oriented remote read.
*/
+int
readrem(p, space)
char *p;
register int space;
@@ -542,7 +550,7 @@ extern char *getusername(uid, file, opts)
/*
* Try to avoid getpwuid() call.
*/
- if (lastuid == uid && buf[0] && buf[0] != ':')
+ if (lastuid == uid && buf[0] != '\0' && buf[0] != ':')
return(buf);
lastuid = uid;
@@ -581,7 +589,7 @@ extern char *getgroupname(gid, file, opts)
/*
* Try to avoid getgrgid() call.
*/
- if (lastgid == gid && buf[0] && buf[0] != ':')
+ if (lastgid == gid && buf[0] != '\0' && buf[0] != ':')
return(buf);
lastgid = gid;
@@ -688,12 +696,12 @@ extern char *exptilde(ebuf, file)
*s3 = '/';
s2 = pw->pw_dir;
}
- for (s1 = ebuf; *s1++ = *s2++; )
+ for (s1 = ebuf; (*s1++ = *s2++); )
;
s2 = --s1;
if (s3 != NULL) {
s2++;
- while (*s1++ = *s3++)
+ while ((*s1++ = *s3++))
;
}
return(s2);
@@ -761,7 +769,7 @@ extern int setfiletime(file, atime, mtime)
tv[0].tv_usec = tv[1].tv_usec = (time_t) 0;
return(utimes(file, tv));
} else /* Set to current time */
- return(utimes(file, (struct timeval *) NULL));
+ return(utimes(file, NULL));
#endif /* SETFTIME_UTIMES */
@@ -773,7 +781,7 @@ extern int setfiletime(file, atime, mtime)
utbuf.modtime = mtime;
return(utime(file, &utbuf));
} else /* Set to current time */
- return(utime(file, (struct utimbuf *)NULL));
+ return(utime(file, NULL));
#endif /* SETFTIME_UTIME */
#if !defined(SETFTIME_TYPE)
@@ -932,7 +940,7 @@ extern char *xbasename(path)
{
register char *cp;
- if (cp = strrchr(path, '/'))
+ if ((cp = strrchr(path, '/')))
return(cp+1);
else
return(path);
@@ -952,7 +960,7 @@ extern char *searchpath(path)
for (; ;) {
if (!path)
- return((char *) NULL);
+ return(NULL);
file = path;
cp = strchr(path, ':');
if (cp) {
@@ -971,15 +979,15 @@ extern char *searchpath(path)
/*
* Set line buffering.
*/
-extern int
+extern void
mysetlinebuf(fp)
FILE *fp;
{
#if SETBUF_TYPE == SETBUF_SETLINEBUF
- return(setlinebuf(fp));
+ setlinebuf(fp);
#endif /* SETBUF_SETLINEBUF */
#if SETBUF_TYPE == SETBUF_SETVBUF
- return(setvbuf(stdout, NULL, _IOLBF, BUFSIZ));
+ setvbuf(stdout, NULL, _IOLBF, BUFSIZ);
#endif /* SETBUF_SETVBUF */
#if !defined(SETBUF_TYPE)
No SETBUF_TYPE is defined!
diff --git a/usr.bin/rdist/config-data.h b/usr.bin/rdist/config-data.h
index b9d18ad7d83..8c8df3a7ae2 100644
--- a/usr.bin/rdist/config-data.h
+++ b/usr.bin/rdist/config-data.h
@@ -1,4 +1,5 @@
-/* * $OpenBSD: config-data.h,v 1.3 1996/06/26 05:38:09 deraadt Exp $*/
+/* $OpenBSD: config-data.h,v 1.4 1998/06/26 21:21:02 millert Exp $ */
+
/*
* Copyright (c) 1993 Michael A. Cooper
* Copyright (c) 1993 Regents of the University of California.
@@ -34,6 +35,7 @@
*/
/*
+ * $From: config-data.h,v 6.3 1995/12/13 01:55:26 mcooper Exp $
* @(#)configdata.h
*/
diff --git a/usr.bin/rdist/config-def.h b/usr.bin/rdist/config-def.h
index 34e99f47210..eb469f00bd8 100644
--- a/usr.bin/rdist/config-def.h
+++ b/usr.bin/rdist/config-def.h
@@ -1,4 +1,5 @@
-/* * $OpenBSD: config-def.h,v 1.3 1996/06/26 05:38:10 deraadt Exp $*/
+/* $OpenBSD: config-def.h,v 1.4 1998/06/26 21:21:03 millert Exp $ */
+
/*
* Copyright (c) 1993 Michael A. Cooper
* Copyright (c) 1993 Regents of the University of California.
@@ -34,6 +35,7 @@
*/
/*
+ * $From: config-def.h,v 6.12 1994/03/31 04:30:42 mcooper Exp $
* @(#)configdef.h
*/
diff --git a/usr.bin/rdist/config.h b/usr.bin/rdist/config.h
index 06e24fb69b1..453d82c0350 100644
--- a/usr.bin/rdist/config.h
+++ b/usr.bin/rdist/config.h
@@ -1,4 +1,5 @@
-/* * $OpenBSD: config.h,v 1.5 1996/07/25 05:31:01 millert Exp $*/
+/* $OpenBSD: config.h,v 1.6 1998/06/26 21:21:05 millert Exp $ */
+
/*
* Copyright (c) 1993 Michael A. Cooper
* Copyright (c) 1993 Regents of the University of California.
@@ -34,6 +35,7 @@
*/
/*
+ * $From: config.h,v 6.43 1998/03/24 01:05:27 michaelc Exp $
* @(#)config.h
*/
@@ -53,7 +55,7 @@
#if defined(PATHS_H)
# include PATHS_H
#else
-# include "paths.h"
+# include "rdistpaths.h"
#endif
/*
diff --git a/usr.bin/rdist/defs.h b/usr.bin/rdist/defs.h
index ad838bd1139..d4fbfe27be3 100644
--- a/usr.bin/rdist/defs.h
+++ b/usr.bin/rdist/defs.h
@@ -1,4 +1,5 @@
-/* $OpenBSD: defs.h,v 1.7 1997/10/15 16:58:17 millert Exp $ */
+/* $OpenBSD: defs.h,v 1.8 1998/06/26 21:21:06 millert Exp $ */
+
#ifndef __DEFS_H__
#define __DEFS_H__
/*
@@ -35,14 +36,14 @@
*/
/*
- * $Id: defs.h,v 1.7 1997/10/15 16:58:17 millert Exp $
+ * $From: defs.h,v 6.82 1998/03/23 23:28:25 michaelc Exp $
* @(#)defs.h 5.2 (Berkeley) 3/20/86
*/
/*
* POSIX settings
*/
-#if defined(_POSIX_SOURCE)
+#if defined(_POSIX_SOURCE) || defined(__OpenBSD__)
#include <unistd.h>
#include <stdlib.h>
#endif /* _POSIX_SOURCE */
@@ -66,10 +67,6 @@
#include "pathnames.h"
#include "types.h"
-#if !defined(yacc)
-/* #include "y.tab.h" */
-#endif /* yacc */
-
#include <signal.h>
/*
@@ -95,9 +92,6 @@
#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 */
@@ -332,6 +326,7 @@ extern int rem_r; /* Remote file descriptor, reading */
extern int rem_w; /* Remote file descriptor, writing */
extern int rtimeout; /* Response time out in seconds */
extern int setjmp_ok; /* setjmp/longjmp flag */
+extern void mysetlinebuf(); /* set line buffering */
extern UID_T userid; /* User ID of rdist user */
extern jmp_buf finish_jmpbuf; /* Setjmp buffer for finish() */
extern struct group *gr; /* pointer to static area used by getgrent */
@@ -342,7 +337,6 @@ extern int dostatdb;
extern int juststatdb;
#endif /* USE_STATDB */
-#if 0
/*
* System function declarations
*/
@@ -351,7 +345,6 @@ char *strchr();
char *strdup();
char *strrchr();
char *strtok();
-#endif
/*
* Our own declarations.
@@ -407,7 +400,7 @@ extern void debugmsg(int, char *, ...);
extern void error(char *, ...);
extern void fatalerr(char *, ...);
extern void message(int, char *, ...);
-#if 0
+#ifndef HAVE_SETPROCTITLE
extern void setproctitle(char *fmt, ...);
#endif
#else
@@ -415,7 +408,9 @@ extern void debugmsg();
extern void error();
extern void fatalerr();
extern void message();
+#ifndef HAVE_SETPROCTITLE
extern void setproctitle();
#endif
+#endif
#endif /* __DEFS_H__ */
diff --git a/usr.bin/rdist/distopt.c b/usr.bin/rdist/distopt.c
index 016bc4777a4..99b62150b3b 100644
--- a/usr.bin/rdist/distopt.c
+++ b/usr.bin/rdist/distopt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: distopt.c,v 1.3 1996/06/26 05:38:11 deraadt Exp $ */
+/* $OpenBSD: distopt.c,v 1.4 1998/06/26 21:21:07 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: distopt.c,v 1.3 1996/06/26 05:38:11 deraadt Exp $";
+"$From: distopt.c,v 6.10 1996/01/30 01:52:07 mcooper Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: distopt.c,v 1.4 1998/06/26 21:21:07 millert Exp $";
+#endif
static char sccsid[] = "@(#)distopt.c";
@@ -89,7 +94,7 @@ extern DISTOPTINFO *getdistopt(name)
if (strcasecmp(name, distoptinfo[i].do_name) == 0)
return(&distoptinfo[i]);
- return((DISTOPTINFO *) NULL);
+ return(NULL);
}
/*
@@ -110,7 +115,7 @@ extern int parsedistopts(str, optptr, doerrs)
string = strdup(str);
for (optstr = strtok(string, ","); optstr;
- optstr = strtok((char *) NULL, ",")) {
+ optstr = strtok(NULL, ",")) {
if (strncasecmp(optstr, "no", 2) == 0)
negate = TRUE;
else
@@ -121,7 +126,7 @@ extern int parsedistopts(str, optptr, doerrs)
* and the option starts with "no", strip "no"
* from option and retry lookup.
*/
- if (distopt = getdistopt(optstr)) {
+ if ((distopt = getdistopt(optstr))) {
FLAG_ON(*optptr, distopt->do_value);
continue;
}
diff --git a/usr.bin/rdist/docmd.c b/usr.bin/rdist/docmd.c
index 83715f1296c..04ac5a24f6f 100644
--- a/usr.bin/rdist/docmd.c
+++ b/usr.bin/rdist/docmd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: docmd.c,v 1.6 1997/07/22 06:59:38 millert Exp $ */
+/* $OpenBSD: docmd.c,v 1.7 1998/06/26 21:21:09 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: docmd.c,v 1.6 1997/07/22 06:59:38 millert Exp $";
+"$From: docmd.c,v 6.86 1996/01/30 02:29:43 mcooper Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: docmd.c,v 1.7 1998/06/26 21:21:09 millert Exp $";
+#endif
static char sccsid[] = "@(#)docmd.c 5.1 (Berkeley) 6/6/85";
@@ -435,6 +440,11 @@ static void doarrow(cmd, filev)
char *rhost;
int didupdate = 0;
+#ifdef __GNUC__
+ (void)&didupdate;
+ (void)&opts;
+#endif
+
if (setjmp_ok) {
error("reentrant call to doarrow");
abort();
@@ -597,6 +607,7 @@ done:
setjmp_ok = FALSE;
}
+int
okname(name)
register char *name;
{
@@ -637,7 +648,7 @@ static void rcmptime(st, sbcmds, env)
}
optarget = ptarget;
len = ptarget - target;
- while (dp = readdir(d)) {
+ while ((dp = readdir(d))) {
if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
continue;
if (len + 1 + (int)strlen(dp->d_name) >= BUFSIZ - 1) {
@@ -647,7 +658,7 @@ static void rcmptime(st, sbcmds, env)
ptarget = optarget;
*ptarget++ = '/';
cp = dp->d_name;
- while (*ptarget++ = *cp++)
+ while ((*ptarget++ = *cp++))
;
ptarget--;
cmptime(target, sbcmds, env);
@@ -791,7 +802,7 @@ static void dodcolon(cmd, filev)
for (sc = sbcmds; sc != NULL; sc = sc->sc_next) {
if (sc->sc_type == NOTIFY)
- notify((char *)NULL, sc->sc_args, (time_t)lastmod);
+ notify(NULL, sc->sc_args, (time_t)lastmod);
else if (sc->sc_type == CMDSPECIAL && env) {
char *p;
int len = strlen(env);
@@ -889,9 +900,9 @@ static void docmdhost(cmd, filev)
if (!nflag) {
currenthost = (cmd->c_name) ? cmd->c_name : "<unknown>";
-#if defined(SETARGS)
+#if defined(SETARGS) || defined(HAVE_SETPROCTITLE)
setproctitle("update %s", currenthost);
-#endif /* SETARGS */
+#endif /* SETARGS || HAVE_SETPROCTITLE */
}
switch (cmd->c_type) {
@@ -921,7 +932,7 @@ static void docmd(cmd, argc, argv)
for (i = 0; i < argc; i++) {
if (cmd->c_label != NULL &&
strcmp(cmd->c_label, argv[i]) == 0) {
- docmdhost(cmd, (char **) NULL);
+ docmdhost(cmd, NULL);
return;
}
for (f = cmd->c_files; f != NULL; f = f->n_next)
@@ -931,7 +942,7 @@ static void docmd(cmd, argc, argv)
}
}
} else
- docmdhost(cmd, (char **) NULL);
+ docmdhost(cmd, NULL);
}
/*
diff --git a/usr.bin/rdist/expand.c b/usr.bin/rdist/expand.c
index 7415a9085f5..c8b469731bd 100644
--- a/usr.bin/rdist/expand.c
+++ b/usr.bin/rdist/expand.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: expand.c,v 1.4 1996/06/26 05:38:12 deraadt Exp $ */
+/* $OpenBSD: expand.c,v 1.5 1998/06/26 21:21:10 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: expand.c,v 1.4 1996/06/26 05:38:12 deraadt Exp $";
+"$From: expand.c,v 6.18 1998/03/24 00:37:10 michaelc Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: expand.c,v 1.5 1998/06/26 21:21:10 millert Exp $";
+#endif
static char sccsid[] = "@(#)expand.c 5.2 (Berkeley) 3/28/86";
@@ -85,18 +90,18 @@ static void Cat(s1, s2) /* quote in s1 and s2 */
return;
}
- eargv[++eargc] = (char *) NULL;
+ eargv[++eargc] = NULL;
eargv[eargc - 1] = cp = xmalloc(len);
do {
if (*s1 == QUOTECHAR)
s1++;
- } while (*cp++ = *s1++);
+ } while ((*cp++ = *s1++));
cp--;
do {
if (*s2 == QUOTECHAR)
s2++;
- } while (*cp++ = *s2++);
+ } while ((*cp++ = *s2++));
}
static void addpath(c)
@@ -143,7 +148,7 @@ expand(list, wh) /* quote in list->n_name */
tilde = "";
eargc = 0;
eargv = sortbase = argvbuf;
- *eargv = (char *) NULL;
+ *eargv = NULL;
/*
* Walk the name list and expand names into eargv[];
@@ -155,7 +160,7 @@ expand(list, wh) /* quote in list->n_name */
*/
list = prev = NULL;
for (n = 0; n < eargc; n++) {
- nl = makenl((char *)NULL);
+ nl = makenl(NULL);
nl->n_name = eargv[n];
if (prev == NULL)
list = prev = nl;
@@ -182,7 +187,7 @@ u_char *xstrchr(str, ch)
if (ch == *cp)
return(cp);
- return((u_char *)NULL);
+ return(NULL);
}
void expstr(s)
@@ -251,7 +256,7 @@ void expstr(s)
savec = *tail;
*tail = CNULL;
}
- tp = lookup((char *)cp, LOOKUP, (struct namelist *)NULL);
+ tp = lookup((char *)cp, LOOKUP, NULL);
if (savec != CNULL)
*tail = savec;
if (tp != NULL) {
@@ -296,7 +301,7 @@ void expstr(s)
cp1 = (u_char *)pw->pw_dir;
s = cp;
}
- for (cp = (u_char *)path; *cp++ = *cp1++; )
+ for (cp = (u_char *)path; (*cp++ = *cp1++); )
;
tpathp = pathp = (char *)cp - 1;
} else {
@@ -320,7 +325,7 @@ void expstr(s)
sort();
}
-static
+static int
argcmp(a1, a2)
char **a1, **a2;
{
@@ -361,7 +366,7 @@ void expsh(s) /* quote in s */
cp++, pathp++;
*pathp = CNULL;
if (*oldcp == '{') {
- (void) execbrc(cp, (u_char *)NULL);
+ (void) execbrc(cp, NULL);
return;
}
matchdir((char *)cp);
@@ -410,6 +415,7 @@ patherr2:
yyerror(path);
}
+int
execbrc(p, s) /* quote in p */
u_char *p, *s;
{
@@ -500,6 +506,7 @@ doit:
return (0);
}
+int
match(s, p) /* quote in p */
char *s, *p;
{
@@ -517,6 +524,7 @@ match(s, p) /* quote in p */
return (c);
}
+int
amatch(s, p) /* quote in p */
register char *s;
register u_char *p;
@@ -538,7 +546,7 @@ amatch(s, p) /* quote in p */
case '[':
ok = 0;
lc = 077777;
- while (cc = *p++) {
+ while ((cc = *p++)) {
if (cc == ']') {
if (ok)
break;
@@ -600,8 +608,9 @@ slash:
else
Cat((u_char *)tilde,
(u_char *)tpathp);
- } else
+ } else {
expsh(p);
+ }
pathp = spathp;
*pathp = CNULL;
return (0);
diff --git a/usr.bin/rdist/gram.y b/usr.bin/rdist/gram.y
index b8a58648111..9c813740aa7 100644
--- a/usr.bin/rdist/gram.y
+++ b/usr.bin/rdist/gram.y
@@ -1,4 +1,6 @@
%{
+/* $OpenBSD: gram.y,v 1.4 1998/06/26 21:21:11 millert Exp $ */
+
/*
* Copyright (c) 1993 Michael A. Cooper
* Copyright (c) 1993 Regents of the University of California.
@@ -34,8 +36,13 @@
*/
#ifndef lint
+#if 0
+static char RCSid[] =
+"$From: gram.y,v 6.29 1994/04/11 23:59:15 mcooper Exp mcooper $";
+#else
static char RCSid[] =
-"$Id: gram.y,v 1.3 1996/03/05 03:16:05 dm Exp $";
+"$OpenBSD: gram.y,v 1.4 1998/06/26 21:21:11 millert Exp $";
+#endif
static char *sccsid = "@(#)gram.y 5.2 (Berkeley) 85/06/21";
@@ -413,6 +420,7 @@ extern int any(c, str)
/*
* Insert or append ARROW command to list of hosts to be updated.
*/
+void
insert(label, files, hosts, subcmds)
char *label;
struct namelist *files, *hosts;
@@ -467,6 +475,7 @@ insert(label, files, hosts, subcmds)
* Append DCOLON command to the end of the command list since these are always
* executed in the order they appear in the distfile.
*/
+void
append(label, files, stamp, subcmds)
char *label;
struct namelist *files;
@@ -493,6 +502,7 @@ append(label, files, stamp, subcmds)
/*
* Error printing routine in parser.
*/
+void
yyerror(s)
char *s;
{
diff --git a/usr.bin/rdist/isexec.c b/usr.bin/rdist/isexec.c
index 795a2e27a12..9abbd21b8ad 100644
--- a/usr.bin/rdist/isexec.c
+++ b/usr.bin/rdist/isexec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: isexec.c,v 1.3 1996/06/26 05:38:13 deraadt Exp $ */
+/* $OpenBSD: isexec.c,v 1.4 1998/06/26 21:21:12 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -33,8 +33,13 @@
* SUCH DAMAGE.
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: isexec.c,v 1.3 1996/06/26 05:38:13 deraadt Exp $";
+"$From: isexec.c,v 6.21 1994/04/01 23:44:10 mcooper Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: isexec.c,v 1.4 1998/06/26 21:21:12 millert Exp $";
+#endif
static char sccsid[] = "@(#)client.c";
diff --git a/usr.bin/rdist/lookup.c b/usr.bin/rdist/lookup.c
index 10b69524c2a..2ed5d7663b5 100644
--- a/usr.bin/rdist/lookup.c
+++ b/usr.bin/rdist/lookup.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lookup.c,v 1.7 1996/07/25 05:31:01 millert Exp $ */
+/* $OpenBSD: lookup.c,v 1.8 1998/06/26 21:21:14 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: lookup.c,v 1.7 1996/07/25 05:31:01 millert Exp $";
+"$From: lookup.c,v 6.8 1996/07/19 16:49:55 michaelc Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: lookup.c,v 1.8 1998/06/26 21:21:14 millert Exp $";
+#endif
static char sccsid[] = "@(#)lookup.c 5.1 (Berkeley) 6/6/85";
@@ -62,6 +67,7 @@ static struct syment *hashtab[HASHSIZE];
/*
* Define a variable from a command line argument.
*/
+void
define(name)
char *name;
{
diff --git a/usr.bin/rdist/message.c b/usr.bin/rdist/message.c
index 34b33f1fc42..f3253a9d6a0 100644
--- a/usr.bin/rdist/message.c
+++ b/usr.bin/rdist/message.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: message.c,v 1.6 1996/07/29 17:50:09 millert Exp $ */
+/* $OpenBSD: message.c,v 1.7 1998/06/26 21:21:15 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: message.c,v 1.6 1996/07/29 17:50:09 millert Exp $";
+"$From: message.c,v 6.24 1996/07/19 17:00:35 michaelc Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: message.c,v 1.7 1998/06/26 21:21:15 millert Exp $";
+#endif
static char sccsid[] = "@(#)common.c";
@@ -145,7 +150,7 @@ static MSGFACILITY *getmsgfac(name)
if (strcasecmp(name, msgfacility[i].mf_name) == 0)
return(&msgfacility[i]);
- return((MSGFACILITY *) NULL);
+ return(NULL);
}
/*
@@ -160,7 +165,7 @@ static MSGTYPE *getmsgtype(name)
if (strcasecmp(name, msgtypes[i].mt_name) == 0)
return(&msgtypes[i]);
- return((MSGTYPE *) NULL);
+ return(NULL);
}
/*
@@ -183,7 +188,7 @@ static char *setmsgtypes(msgfac, str)
msgfac->mf_msgfac != MF_FILE)) {
(void) snprintf(ebuf, sizeof(ebuf),
"The \"%s\" message facility cannot be used by the server.",
- msgfac->mf_name);
+ msgfac->mf_name);
return(ebuf);
}
@@ -234,11 +239,11 @@ static char *setmsgtypes(msgfac, str)
msgfac->mf_msgtypes = 0; /* Start from scratch */
while (strptr) {
word = strptr;
- if (cp = strchr(strptr, ','))
+ if ((cp = strchr(strptr, ',')))
*cp++ = CNULL;
strptr = cp;
- if (mtp = getmsgtype(word)) {
+ if ((mtp = getmsgtype(word))) {
msgfac->mf_msgtypes |= mtp->mt_type;
/*
* XXX This is really a kludge until we add real
@@ -255,7 +260,7 @@ static char *setmsgtypes(msgfac, str)
}
}
- return((char *) NULL);
+ return(NULL);
}
/*
@@ -280,7 +285,7 @@ extern char *msgparseopts(msgstr, doset)
* Each <facility>=<types> list is seperated by ":".
*/
for (optstr = strtok(msgbuf, ":"); optstr;
- optstr = strtok((char *)NULL, ":")) {
+ optstr = strtok(NULL, ":")) {
if ((cp = strchr(optstr, '=')) == NULL)
return("No '=' found");
@@ -302,7 +307,7 @@ extern char *msgparseopts(msgstr, doset)
if (doset) {
char *mcp;
- if (mcp = setmsgtypes(msgfac, cp))
+ if ((mcp = setmsgtypes(msgfac, cp)))
return(mcp);
}
}
@@ -312,7 +317,7 @@ extern char *msgparseopts(msgstr, doset)
msgprconfig();
}
- return((char *) NULL);
+ return(NULL);
}
/*
@@ -457,13 +462,13 @@ static void msgsendnotify(msgfac, mtype, flags, msgbuf)
if (!msgfac->mf_fptr) {
register char *cp;
- char *getenv();
int fd;
+ char *getenv();
/*
* Create and open a new temporary file
*/
- if ((cp = getenv("TMPDIR")) == (char *) NULL)
+ if ((cp = getenv("TMPDIR")) == NULL)
cp = _PATH_TMP;
tempfile = (char *) xmalloc(strlen(cp) + 1 +
strlen(_RDIST_TMP) + 2);
@@ -521,7 +526,7 @@ static void _message(flags, msgbuf)
/*
* Ensure no stray newlines are present
*/
- if (cp = strchr(msgbuf, '\n'))
+ if ((cp = strchr(msgbuf, '\n')))
*cp = CNULL;
checkhostname();
@@ -537,7 +542,7 @@ static void _message(flags, msgbuf)
* logged to the system log facility
*/
if (IS_ON(flags, MT_SYSLOG)) {
- msgsendsyslog((MSGFACILITY *)NULL, MT_SYSLOG, flags, mbuf);
+ msgsendsyslog(NULL, MT_SYSLOG, flags, mbuf);
return;
}
@@ -545,14 +550,14 @@ static void _message(flags, msgbuf)
* Special cases
*/
if (isserver && IS_ON(flags, MT_NOTICE)) {
- msgsendstdout((MSGFACILITY *)NULL, MT_NOTICE, flags, mbuf);
+ msgsendstdout(NULL, MT_NOTICE, flags, mbuf);
return;
} else if (isserver && IS_ON(flags, MT_REMOTE))
- msgsendstdout((MSGFACILITY *)NULL, MT_REMOTE, flags, mbuf);
+ msgsendstdout(NULL, MT_REMOTE, flags, mbuf);
else if (isserver && IS_ON(flags, MT_NERROR))
- msgsendstdout((MSGFACILITY *)NULL, MT_NERROR, flags, mbuf);
+ msgsendstdout(NULL, MT_NERROR, flags, mbuf);
else if (isserver && IS_ON(flags, MT_FERROR))
- msgsendstdout((MSGFACILITY *)NULL, MT_FERROR, flags, mbuf);
+ msgsendstdout(NULL, MT_FERROR, flags, mbuf);
/*
* For each Message Facility, check each Message Type to see
@@ -871,5 +876,5 @@ extern char *getnotifyfile()
return(msgfacility[i].mf_filename);
}
- return((char *) NULL);
+ return(NULL);
}
diff --git a/usr.bin/rdist/os-openbsd.h b/usr.bin/rdist/os-openbsd.h
index 698bce42c12..b32f89ef220 100644
--- a/usr.bin/rdist/os-openbsd.h
+++ b/usr.bin/rdist/os-openbsd.h
@@ -1,4 +1,3 @@
-/* * $OpenBSD: os-openbsd.h,v 1.9 1997/07/22 06:59:39 millert Exp $*/
/*
* Copyright (c) 1993 Michael A. Cooper
* Copyright (c) 1993 Regents of the University of California.
@@ -34,6 +33,7 @@
*/
/*
+ * $OpenBSD: os-openbsd.h,v 1.10 1998/06/26 21:21:16 millert Exp $
*/
/*
@@ -41,15 +41,7 @@
*/
/*
- * Define the following name for use in #ifdef's.
- * The value should be all upper-case with no periods (.).
- */
-#if !defined(FREEBSD)
-#define FREEBSD
-#endif
-
-/*
- * NOTE: FreeBSD uses 64-bit file size semantics, and so you
+ * NOTE: OpenBSD uses 64-bit file size semantics, and so you
* must be careful when using varargs-type functions
* like the *printf family when printing elements which
* might be 64-bits (such as stat->st_size from stat.h).
@@ -58,10 +50,9 @@
/*
* Set process args to messages that show up when running ps(1)
*
- * Under some OS's, the SETARGS code will cause ": is not an identifier"
- * errors for "special" commands.
+ * OpenBSD has setproctitle() in libc so we don't want to use rdist's.
*/
-#define SETARGS
+#define HAVE_SETPROCTITLE
/*
* Define the type of directory routines your system has.
@@ -73,7 +64,7 @@
*/
#define FSI_TYPE FSI_GETFSSTAT
#ifndef FSTYPENAME
-#define FSTYPENAME 1 /* For OpenBSD 1.x */
+#define FSTYPENAME 1 /* use f_fstypename */
#endif
/*
@@ -145,15 +136,15 @@ typedef void POINTER;
#define HAVE_SELECT /* Have select() */
#define HAVE_SAVED_IDS /* Have POSIX style saved [ug]id's */
#define POSIX_SIGNALS /* Have POSIX signals */
+#define HAVE_PATHS_H /* Have <paths.h> */
/*
* Things we need
*/
#define NEED_UNISTD_H /* Need <unistd.h> */
-#define NEED_STDLIB_H /* Need <stdlib.h> */
#define NEED_STRING_H /* Need <string.h> */
/*
- * We have <paths.h>
+ * Use the system <paths.h>
*/
-#define PATHS_H <paths.h>
+#define PATHS_H <paths.h>
diff --git a/usr.bin/rdist/pathnames.h b/usr.bin/rdist/pathnames.h
index 656a01af4aa..c3dbeaccde7 100644
--- a/usr.bin/rdist/pathnames.h
+++ b/usr.bin/rdist/pathnames.h
@@ -1,4 +1,5 @@
-/* * $OpenBSD: pathnames.h,v 1.4 1996/06/26 05:38:15 deraadt Exp $*/
+/* $OpenBSD: pathnames.h,v 1.5 1998/06/26 21:21:17 millert Exp $ */
+
/*
* Copyright (c) 1989 The Regents of the University of California.
* All rights reserved.
@@ -33,13 +34,14 @@
*/
/*
+ * $From: pathnames.h,v 6.8 1993/01/05 21:27:59 mcooper Exp mcooper $
* @(#)pathnames.h 5.4 (Berkeley) 8/27/90
*/
#include "config.h"
#if !defined(_RDIST_TMP)
-# define _RDIST_TMP "rdistXXXXXX" /* Temporary file */
+# define _RDIST_TMP "rdistXXXXXXXX" /* Temporary file */
#endif /* _RDIST_TMP */
#if !defined(_PATH_RDISTD)
diff --git a/usr.bin/rdist/rdist.1 b/usr.bin/rdist/rdist.1
index def39b215b4..2b8806f55de 100644
--- a/usr.bin/rdist/rdist.1
+++ b/usr.bin/rdist/rdist.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rdist.1,v 1.5 1997/07/22 06:59:39 millert Exp $
+.\" $OpenBSD: rdist.1,v 1.6 1998/06/26 21:21:19 millert Exp $
.\"
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.
@@ -31,6 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
+.\" $From: rdist.man,v 6.34 1996/01/29 22:37:19 mcooper Exp $
.\" @(#)rdist.1 6.6 (Berkeley) 5/13/86
.\"
.TH RDIST 1 "January 29, 1996"
diff --git a/usr.bin/rdist/rdist.c b/usr.bin/rdist/rdist.c
index 9279120e4a4..5c597c29685 100644
--- a/usr.bin/rdist/rdist.c
+++ b/usr.bin/rdist/rdist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rdist.c,v 1.4 1997/07/22 06:59:39 millert Exp $ */
+/* $OpenBSD: rdist.c,v 1.5 1998/06/26 21:21:20 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: rdist.c,v 1.4 1997/07/22 06:59:39 millert Exp $";
+"$From: rdist.c,v 6.65 1995/12/12 00:20:39 mcooper Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: rdist.c,v 1.5 1998/06/26 21:21:20 millert Exp $";
+#endif
static char sccsid[] = "@(#)main.c 5.1 (Berkeley) 6/6/85";
@@ -92,6 +97,7 @@ static void addhostlist(name, hostlist)
*hostlist = new;
}
+int
main(argc, argv, envp)
int argc;
char *argv[];
@@ -109,7 +115,7 @@ main(argc, argv, envp)
*/
setprogname(argv);
- if (cp = msgparseopts(localmsglist, TRUE)) {
+ if ((cp = msgparseopts(localmsglist, TRUE))) {
error("Bad builtin log option (%s): %s.",
localmsglist, cp);
usage();
@@ -129,7 +135,7 @@ main(argc, argv, envp)
"Old rdist (-Server) requested; running %s",
_PATH_OLDRDIST);
(void) execl(_PATH_OLDRDIST, xbasename(_PATH_OLDRDIST),
- "-Server", (char *)NULL);
+ "-Server", NULL);
fatalerr("Exec old rdist failed: %s: %s.",
_PATH_OLDRDIST, SYSERR);
#else /* !_PATH_OLDRDIST */
@@ -153,7 +159,7 @@ main(argc, argv, envp)
while ((c = getopt(argc, argv, optchars)) != -1)
switch (c) {
case 'l':
- if (cp = msgparseopts(optarg, TRUE)) {
+ if ((cp = msgparseopts(optarg, TRUE))) {
error("Bad log option \"%s\": %s.", optarg,cp);
usage();
}
@@ -201,7 +207,7 @@ main(argc, argv, envp)
case 'D':
debug = DM_ALL;
- if (cp = msgparseopts("stdout=all,debug", TRUE)) {
+ if ((cp = msgparseopts("stdout=all,debug", TRUE))) {
error("Enable debug messages failed: %s.", cp);
usage();
}
@@ -240,7 +246,7 @@ main(argc, argv, envp)
error("No path specified to \"-P\".");
usage();
}
- if (cp = searchpath(optarg))
+ if ((cp = searchpath(optarg)))
path_remsh = strdup(cp);
else {
error("No component of path \"%s\" exists.",
@@ -346,6 +352,7 @@ FILE *opendist(distfile)
/*
* Print usage message and exit.
*/
+void
usage()
{
char *sopts = "cDFnv";
@@ -377,6 +384,7 @@ usage()
/*
* rcp like interface for distributing files.
*/
+void
docmdargs(nargs, args)
int nargs;
char *args[];
@@ -423,8 +431,8 @@ docmdargs(nargs, args)
debugmsg(DM_MISC, "docmdargs()\nfiles = %s", getnlstr(files));
debugmsg(DM_MISC, "host = %s", getnlstr(hosts));
- insert((char *)NULL, files, hosts, cmds);
- docmds(0, (char **)NULL, 0, (char **)NULL);
+ insert(NULL, files, hosts, cmds);
+ docmds(0, NULL, 0, (char **)NULL);
}
/*
diff --git a/usr.bin/rdist/signal.c b/usr.bin/rdist/signal.c
index fccec9952b1..cbf0bb653aa 100644
--- a/usr.bin/rdist/signal.c
+++ b/usr.bin/rdist/signal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: signal.c,v 1.3 1996/06/26 05:38:18 deraadt Exp $ */
+/* $OpenBSD: signal.c,v 1.4 1998/06/26 21:21:21 millert Exp $ */
/*
* Copyright (c) 1993 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: signal.c,v 1.3 1996/06/26 05:38:18 deraadt Exp $";
+"$From: signal.c,v 6.1 1993/07/15 22:47:30 mcooper Exp mcooper $";
+#else
+static char RCSid[] =
+"$OpenBSD: signal.c,v 1.4 1998/06/26 21:21:21 millert Exp $";
+#endif
static char sccsid[] = "@(#)signal.c";
diff --git a/usr.bin/rdist/types.h b/usr.bin/rdist/types.h
index 518a57f7c75..d98322ebdc8 100644
--- a/usr.bin/rdist/types.h
+++ b/usr.bin/rdist/types.h
@@ -1,8 +1,10 @@
-/* * $OpenBSD: types.h,v 1.3 1996/06/26 05:38:19 deraadt Exp $*/
+/* $OpenBSD: types.h,v 1.4 1998/06/26 21:21:22 millert Exp $ */
+
#ifndef __myTYPES_H__
#define __myTYPES_H__
/*
+ * $From: types.h,v 1.2 1996/01/30 01:52:24 mcooper Exp $
*/
/*
diff --git a/usr.bin/rdist/version.h b/usr.bin/rdist/version.h
index 4793409ef57..f0e0c1206a9 100644
--- a/usr.bin/rdist/version.h
+++ b/usr.bin/rdist/version.h
@@ -1,4 +1,5 @@
-/* * $OpenBSD: version.h,v 1.4 1996/07/25 05:31:02 millert Exp $*/
+/* $OpenBSD: version.h,v 1.5 1998/06/26 21:21:24 millert Exp $ */
+
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
@@ -33,6 +34,7 @@
*/
/*
+ * $From: version.h,v 6.31 1998/03/15 22:25:55 mcooper Exp $
*/
/*
@@ -50,7 +52,7 @@
/*
* Patch level
*/
-#define PATCHLEVEL 3
+#define PATCHLEVEL 4
/*
* Distribution status
diff --git a/usr.bin/rdistd/filesys-os.c b/usr.bin/rdistd/filesys-os.c
index b56ea6a42bf..7202743c963 100644
--- a/usr.bin/rdistd/filesys-os.c
+++ b/usr.bin/rdistd/filesys-os.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filesys-os.c,v 1.4 1997/06/17 20:37:53 kstailey Exp $ */
+/* $OpenBSD: filesys-os.c,v 1.5 1998/06/26 21:20:47 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: filesys-os.c,v 1.4 1997/06/17 20:37:53 kstailey Exp $";
+"$From: filesys-os.c,v 6.17 1996/01/17 21:02:45 mcooper Exp mcooper $";
+#else
+static char RCSid[] =
+"$OpenBSD: filesys-os.c,v 1.5 1998/06/26 21:20:47 millert Exp $";
+#endif
static char sccsid[] = "@(#)filesys-os.c";
@@ -54,10 +59,10 @@ static char copyright[] =
#if FSI_TYPE == FSI_GETFSSTAT
static struct statfs *mnt = NULL;
#if FSTYPENAME
-#define f_type_eq(a, b) (! strcmp (((struct statfs *) (a))->f_fstypename, (b)))
+#define f_type_eq(a, b) (! strcmp (((struct statfs *) (a))->f_fstypename, (b)))
#else /* !FSTYPENAME */
#define f_type_eq(a, b) (((struct statfs *) a)->f_type == (b))
-#endif /* !FSTYPENAME */
+#endif /* !FSTYPENAME */
#endif /* FSI_GETFSSTAT */
#if FSI_TYPE == FSI_MNTCTL
@@ -78,7 +83,7 @@ FILE *setmountent(file, mode)
char *file;
char *mode;
{
- u_int size;
+ ulong size;
if (mntbuf)
(void) free(mntbuf);
@@ -104,7 +109,7 @@ FILE *setmountent(file, mode)
char *file;
char *mode;
{
- int size;
+ long size;
if (mntbuf)
(void) free(mntbuf);
@@ -147,7 +152,7 @@ mntent_t *getmountent(fptr)
mntstruct.me_flags |= MEFLAG_READONLY;
mntstruct.me_path = vmt2dataptr(mnt, VMT_STUB);
- switch ((struct vmount*)mnt->vmt_gfstype) {
+ switch ((ulong)(struct vmount*)mnt->vmt_gfstype) {
case MNT_NFS:
mntstruct.me_type = METYPE_NFS;
break;
@@ -187,12 +192,11 @@ mntent_t *getmountent(fptr)
if (mnt->f_flags & M_RDONLY)
mntstruct.me_flags |= MEFLAG_READONLY;
#endif
- if (f_type_eq (mnt, MOUNT_NFS)) {
+ if (f_type_eq(mnt, MOUNT_NFS)) {
(void) sprintf(remote_dev, "%s", mnt->f_mntfromname);
mntstruct.me_path = remote_dev;
mntstruct.me_type = METYPE_NFS;
- }
- else {
+ } else {
mntstruct.me_path = mnt->f_mntonname;
mntstruct.me_type = METYPE_OTHER;
}
@@ -348,6 +352,7 @@ FILE *setmountent(file, mode)
char *mode;
{
startmounts = 0;
+ return(stdin); /* XXX - need to return something! */
}
void endmountent(fptr)
diff --git a/usr.bin/rdistd/filesys.c b/usr.bin/rdistd/filesys.c
index 33b30ca6d07..d941009e673 100644
--- a/usr.bin/rdistd/filesys.c
+++ b/usr.bin/rdistd/filesys.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filesys.c,v 1.4 1996/07/29 20:46:40 millert Exp $ */
+/* $OpenBSD: filesys.c,v 1.5 1998/06/26 21:20:48 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: filesys.c,v 1.4 1996/07/29 20:46:40 millert Exp $";
+"$From: filesys.c,v 6.24 1996/01/30 01:57:07 mcooper Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: filesys.c,v 1.5 1998/06/26 21:20:48 millert Exp $";
+#endif
static char sccsid[] = "@(#)filesys.c";
@@ -89,7 +94,7 @@ char *find_file(pathname, statbuf, isvalid)
if ((int)strlen(pathname) > sizeof(file)+3) {
error("%s: Name to large for buffer.", pathname);
- return((char *) NULL);
+ return(NULL);
}
/*
@@ -132,12 +137,12 @@ char *find_file(pathname, statbuf, isvalid)
*/
debugmsg(DM_MISC, "Cannot find dir of `%s'",
pathname);
- return((char *) NULL);
+ return(NULL);
}
continue;
} else {
error("%s: lstat failed: %s", pathname, SYSERR);
- return((char *) NULL);
+ return(NULL);
}
}
@@ -169,7 +174,7 @@ char *find_file(pathname, statbuf, isvalid)
if (strcmp(pathname, file) == 0)
*isvalid = 1;
- return((file && *file) ? file : (char *)NULL);
+ return((file && *file) ? file : NULL);
}
#if defined(NFS_CHECK) || defined(RO_CHECK)
@@ -190,7 +195,7 @@ mntent_t *findmnt(filest, mntinfo)
return(mi->mi_mnt);
}
- return((mntent_t *) NULL);
+ return(NULL);
}
/*
@@ -234,18 +239,18 @@ struct mntinfo *makemntinfo(mi)
if (!(mfp = setmountent(MOUNTED_FILE, "r"))) {
message(MT_NERROR, "%s: setmntent failed: %s",
MOUNTED_FILE, SYSERR);
- return((struct mntinfo *) NULL);
+ return(NULL);
}
(void) signal(SIGALRM, wakeup);
(void) alarm(timeo);
if (setjmp(env)) {
message(MT_NERROR, "Timeout getting mount info");
- return((struct mntinfo *) NULL);
+ return(NULL);
}
mntinfo = mi;
- while (mnt = getmountent(mfp)) {
+ while ((mnt = getmountent(mfp))) {
debugmsg(DM_MISC, "mountent = '%s' (%s)",
mnt->me_path, mnt->me_type);
@@ -317,32 +322,32 @@ mntent_t *getmntpt(pathname, statbuf, isvalid)
pstat = &filestat;
if (!find_file(pathname, pstat, isvalid))
- return((mntent_t *) NULL);
+ return(NULL);
/*
* Make mntinfo if it doesn't exist.
*/
if (!mntinfo)
- mntinfo = makemntinfo((struct mntinfo *) NULL);
+ mntinfo = makemntinfo(NULL);
/*
* Find the mnt that pathname is on.
*/
- if (mnt = findmnt(pstat, mntinfo))
+ if ((mnt = findmnt(pstat, mntinfo)))
return(mnt);
/*
* We failed to find correct mnt, so maybe it's a newly
* mounted filesystem. We rebuild mntinfo and try again.
*/
- if (tmpmi = makemntinfo(mntinfo)) {
+ if ((tmpmi = makemntinfo(mntinfo))) {
mntinfo = tmpmi;
- if (mnt = findmnt(pstat, mntinfo))
+ if ((mnt = findmnt(pstat, mntinfo)))
return(mnt);
}
error("%s: Could not find mount point", pathname);
- return((mntent_t *) NULL);
+ return(NULL);
}
#endif /* NFS_CHECK || RO_CHECK */
diff --git a/usr.bin/rdistd/filesys.h b/usr.bin/rdistd/filesys.h
index 57453f0d712..9e54bab4b8e 100644
--- a/usr.bin/rdistd/filesys.h
+++ b/usr.bin/rdistd/filesys.h
@@ -1,4 +1,5 @@
-/* * $OpenBSD: filesys.h,v 1.3 1996/06/26 05:38:22 deraadt Exp $*/
+/* $OpenBSD: filesys.h,v 1.4 1998/06/26 21:20:49 millert Exp $ */
+
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved.
@@ -33,6 +34,7 @@
*/
/*
+ * $From: filesys.h,v 6.19 1995/12/12 00:46:46 mcooper Exp $
* @(#)filesys.h
*/
@@ -111,7 +113,7 @@
typedef struct statvfs statfs_t;
# define statfs(mp,sb) statvfs(mp,sb)
#else
-#if defined(BSD386) || defined(__bsdi__) || defined(FREEBSD) || STATFS_TYPE == STATFS_OSF1
+#if defined(BSD386) || defined(__bsdi__) || defined(__OpenBSD__) || defined(FREEBSD) || STATFS_TYPE == STATFS_OSF1
typedef struct statfs statfs_t;
#else
# include <sys/vfs.h>
diff --git a/usr.bin/rdistd/rdistd.1 b/usr.bin/rdistd/rdistd.1
index f317fbff2b4..1128cea2064 100644
--- a/usr.bin/rdistd/rdistd.1
+++ b/usr.bin/rdistd/rdistd.1
@@ -1,4 +1,4 @@
-.\" $OpenBSD: rdistd.1,v 1.3 1996/06/26 05:38:23 deraadt Exp $
+.\" $OpenBSD: rdistd.1,v 1.4 1998/06/26 21:20:50 millert Exp $
.\"
.\" Copyright (c) 1983 Regents of the University of California.
.\" All rights reserved.
@@ -31,6 +31,7 @@
.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
.\" SUCH DAMAGE.
.\"
+.\" $From: rdistd.man,v 6.2 1994/02/08 22:17:17 mcooper Exp mcooper $
.\" @(#)rdistd.8 6.6 (Berkeley) 5/13/86
.\"
.TH RDISTD 8 "June 21, 1992"
diff --git a/usr.bin/rdistd/rdistd.c b/usr.bin/rdistd/rdistd.c
index 136ada11489..cfe201c2591 100644
--- a/usr.bin/rdistd/rdistd.c
+++ b/usr.bin/rdistd/rdistd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rdistd.c,v 1.3 1996/06/26 05:38:24 deraadt Exp $ */
+/* $OpenBSD: rdistd.c,v 1.4 1998/06/26 21:20:51 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -34,8 +34,13 @@
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: rdistd.c,v 1.3 1996/06/26 05:38:24 deraadt Exp $";
+"$From: rdistd.c,v 6.22 1995/12/11 23:37:35 mcooper Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: rdistd.c,v 1.4 1998/06/26 21:20:51 millert Exp $";
+#endif
static char sccsid[] = "@(#)rdistd.c";
@@ -61,6 +66,7 @@ char localmsglist[] = "syslog=ferror";
/*
* The Beginning
*/
+int
main(argc, argv, envp)
int argc;
char **argv;
@@ -102,7 +108,7 @@ main(argc, argv, envp)
rem_w = fileno(stdout);
/* Set logging */
- if (cp = msgparseopts(localmsglist, TRUE))
+ if ((cp = msgparseopts(localmsglist, TRUE)))
fatalerr("Bad message logging option (%s): %s",
localmsglist, cp);
diff --git a/usr.bin/rdistd/server.c b/usr.bin/rdistd/server.c
index 1fd3152adf1..9781d7952fa 100644
--- a/usr.bin/rdistd/server.c
+++ b/usr.bin/rdistd/server.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: server.c,v 1.6 1998/05/18 19:12:53 deraadt Exp $ */
+/* $OpenBSD: server.c,v 1.7 1998/06/26 21:20:53 millert Exp $ */
/*
* Copyright (c) 1983 Regents of the University of California.
@@ -33,8 +33,13 @@
* SUCH DAMAGE.
*/
#ifndef lint
+#if 0
static char RCSid[] =
-"$OpenBSD: server.c,v 1.6 1998/05/18 19:12:53 deraadt Exp $";
+"$From: server.c,v 6.85 1996/03/12 22:55:38 mcooper Exp $";
+#else
+static char RCSid[] =
+"$OpenBSD: server.c,v 1.7 1998/06/26 21:20:53 millert Exp $";
+#endif
static char sccsid[] = "@(#)server.c 5.3 (Berkeley) 6/7/86";
@@ -246,7 +251,7 @@ static int fchog(fd, file, owner, group, mode)
/*
* Invalid cached values so we need to do a new lookup.
*/
- if (gr = mygetgroup(group)) {
+ if ((gr = mygetgroup(group))) {
last_gid = gid = gr->gr_gid;
strcpy(last_group, gr->gr_name);
} else {
@@ -356,7 +361,7 @@ static int removefile(statb)
optarget = ptarget;
len = ptarget - target;
- while (dp = readdir(d)) {
+ while ((dp = readdir(d))) {
if ((D_NAMLEN(dp) == 1 && dp->d_name[0] == '.') ||
(D_NAMLEN(dp) == 2 && dp->d_name[0] == '.' &&
dp->d_name[1] == '.'))
@@ -370,7 +375,7 @@ static int removefile(statb)
ptarget = optarget;
*ptarget++ = '/';
cp = dp->d_name;;
- while (*ptarget++ = *cp++)
+ while ((*ptarget++ = *cp++))
;
ptarget--;
if (lstat(target, &stb) < 0) {
@@ -430,7 +435,7 @@ static void doclean(cp)
optarget = ptarget;
len = ptarget - target;
- while (dp = readdir(d)) {
+ while ((dp = readdir(d))) {
if ((D_NAMLEN(dp) == 1 && dp->d_name[0] == '.') ||
(D_NAMLEN(dp) == 2 && dp->d_name[0] == '.' &&
dp->d_name[1] == '.'))
@@ -444,7 +449,7 @@ static void doclean(cp)
ptarget = optarget;
*ptarget++ = '/';
cp = dp->d_name;;
- while (*ptarget++ = *cp++)
+ while ((*ptarget++ = *cp++))
;
ptarget--;
if (lstat(target, &stb) < 0) {
@@ -702,20 +707,20 @@ static char *savetarget(file)
if (strlen(file) + sizeof(SAVE_SUFFIX) + 1 > MAXPATHLEN) {
error("%s: Cannot save: Save name too long", file);
- return((char *) NULL);
+ return(NULL);
}
(void) sprintf(savefile, "%s%s", file, SAVE_SUFFIX);
if (unlink(savefile) != 0 && errno != ENOENT) {
message(MT_NOTICE, "%s: remove failed: %s", savefile, SYSERR);
- return((char *) NULL);
+ return(NULL);
}
if (rename(file, savefile) != 0 && errno != ENOENT) {
error("%s -> %s: rename failed: %s",
file, savefile, SYSERR);
- return((char *) NULL);
+ return(NULL);
}
return(savefile);
@@ -1038,7 +1043,7 @@ static void recvdir(opts, mode, owner, group)
o = (owner[0] == ':') ? opts & DO_NUMCHKOWNER :
opts;
- if (cp = getusername(stb.st_uid, target, o))
+ if ((cp = getusername(stb.st_uid, target, o)))
if (strcmp(owner, cp))
(void) strcpy(lowner, cp);
}
@@ -1047,7 +1052,7 @@ static void recvdir(opts, mode, owner, group)
o = (group[0] == ':') ? opts & DO_NUMCHKGROUP :
opts;
- if (cp = getgroupname(stb.st_gid, target, o))
+ if ((cp = getgroupname(stb.st_gid, target, o)))
if (strcmp(group, cp))
(void) strcpy(lgroup, cp);
}
@@ -1101,8 +1106,8 @@ static void recvdir(opts, mode, owner, group)
if (s < 0) {
if (errno == ENOENT) {
if (mkdir(target, mode) == 0 ||
- chkparent(target, opts) == 0 &&
- mkdir(target, mode) == 0) {
+ (chkparent(target, opts) == 0 &&
+ mkdir(target, mode) == 0)) {
message(MT_NOTICE, "%s: mkdir", target);
(void) fchog(-1, target, owner, group, mode);
ack();
@@ -1162,8 +1167,9 @@ static void recvlink(new, opts, mode, size)
if (IS_ON(opts, DO_COMPARE)) {
char tbuf[MAXPATHLEN];
- if ((i = readlink(target, tbuf, sizeof(tbuf)-1)) >= 0 &&
- i == size && strncmp(buf, tbuf, (int) size) == 0) {
+ if ((i = readlink(target, tbuf, sizeof(tbuf)-1)) != -1)
+ tbuf[i] = '\0';
+ if (i != -1 && i == size && strncmp(buf, tbuf, (size_t) size) == 0) {
(void) unlink(new);
ack();
return;
@@ -1245,7 +1251,7 @@ static void hardlink(cmd)
return;
}
- newname = strtok((char *)NULL, " ");
+ newname = strtok(NULL, " ");
if (newname == NULL) {
error("hardlink: new name not specified");
return;
@@ -1309,9 +1315,9 @@ static void setconfig(cmd)
if (!fromhost) {
fromhost = strdup(cp);
message(MT_SYSLOG, "startup for %s", fromhost);
-#if defined(SETARGS)
+#if defined(SETARGS) || defined(HAVE_SETPROCTITLE)
setproctitle("serving %s", cp);
-#endif /* SETARGS */
+#endif /* SETARGS || HAVE_SETPROCTITLE */
}
break;
@@ -1332,7 +1338,7 @@ static void setconfig(cmd)
break;
case SC_LOGGING: /* Logging options */
- if (estr = msgparseopts(cp, TRUE)) {
+ if ((estr = msgparseopts(cp, TRUE))) {
fatalerr("Bad message option string (%s): %s",
cp, estr);
return;
@@ -1418,7 +1424,7 @@ static void recvit(cmd, type)
/*
* Get file group name
*/
- group = strtok((char *)NULL, " ");
+ group = strtok(NULL, " ");
if (group == NULL) {
error("recvit: group name not delimited");
return;
@@ -1449,7 +1455,7 @@ static void recvit(cmd, type)
sptarget[catname] = ptarget;
if (catname++) {
*ptarget++ = '/';
- while (*ptarget++ = *file++)
+ while ((*ptarget++ = *file++))
;
ptarget--;
}