summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2001-07-12 05:17:34 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2001-07-12 05:17:34 +0000
commit937c9a0f84db15a0a64ed0419a42da3a34d96cde (patch)
treeb6b3bfb6f6bbc506426154fc8294316054abb45f
parent4e5dd980fd1238d635621b9bba7d99533aababd6 (diff)
first pass at a -Wall cleanup
-rw-r--r--usr.bin/awk/b.c8
-rw-r--r--usr.bin/cap_mkdb/cap_mkdb.c6
-rw-r--r--usr.bin/checknr/checknr.c115
-rw-r--r--usr.bin/chpass/edit.c6
-rw-r--r--usr.bin/cmp/misc.c8
-rw-r--r--usr.bin/cmp/regular.c7
-rw-r--r--usr.bin/cmp/special.c7
-rw-r--r--usr.bin/colcrt/colcrt.c23
-rw-r--r--usr.bin/colrm/colrm.c6
-rw-r--r--usr.bin/column/column.c14
-rw-r--r--usr.bin/du/du.c6
-rw-r--r--usr.bin/elf2olf/elf2olf.c25
-rw-r--r--usr.bin/error/error.h38
-rw-r--r--usr.bin/error/filter.c10
-rw-r--r--usr.bin/error/input.c8
-rw-r--r--usr.bin/error/main.c8
-rw-r--r--usr.bin/error/subr.c56
-rw-r--r--usr.bin/error/touch.c28
-rw-r--r--usr.bin/file2c/file2c.c3
-rw-r--r--usr.bin/find/ls.c8
-rw-r--r--usr.bin/find/main.c11
-rw-r--r--usr.bin/finger/lprint.c6
-rw-r--r--usr.bin/fmt/fmt.c6
-rw-r--r--usr.bin/from/from.c13
-rw-r--r--usr.bin/fstat/fstat.c13
-rw-r--r--usr.bin/ftp/cmds.c10
-rw-r--r--usr.bin/ftp/util.c10
-rw-r--r--usr.bin/getconf/getconf.c5
-rw-r--r--usr.bin/getopt/getopt.c6
-rw-r--r--usr.bin/hexdump/conv.c7
-rw-r--r--usr.bin/hexdump/display.c14
-rw-r--r--usr.bin/hexdump/hexdump.c5
-rw-r--r--usr.bin/hexdump/hexsyntax.c9
-rw-r--r--usr.bin/hexdump/odsyntax.c6
-rw-r--r--usr.bin/id/id.c10
-rw-r--r--usr.bin/ipcs/ipcs.c16
-rw-r--r--usr.bin/kdump/kdump.c11
-rw-r--r--usr.bin/ktrace/ktrace.c10
-rw-r--r--usr.bin/ktrace/subr.c5
-rw-r--r--usr.bin/last/last.c33
-rw-r--r--usr.bin/lastcomm/lastcomm.c23
-rw-r--r--usr.bin/tcopy/tcopy.c23
-rw-r--r--usr.bin/telnet/commands.c4
-rw-r--r--usr.bin/time/time.c5
-rw-r--r--usr.bin/tip/aculib/biz22.c10
-rw-r--r--usr.bin/tip/cmds.c9
-rw-r--r--usr.bin/tip/log.c7
-rw-r--r--usr.bin/tip/remote.c7
-rw-r--r--usr.bin/top/machine.c10
-rw-r--r--usr.bin/ul/ul.c63
-rw-r--r--usr.bin/uname/uname.c6
-rw-r--r--usr.bin/uniq/uniq.c6
-rw-r--r--usr.bin/uuencode/uuencode.c6
-rw-r--r--usr.bin/vgrind/vfontedpr.c6
-rw-r--r--usr.bin/w/w.c9
-rw-r--r--usr.bin/wc/wc.c10
-rw-r--r--usr.bin/yacc/reader.c6
57 files changed, 498 insertions, 308 deletions
diff --git a/usr.bin/awk/b.c b/usr.bin/awk/b.c
index 5b881b63570..b3cacd4515f 100644
--- a/usr.bin/awk/b.c
+++ b/usr.bin/awk/b.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: b.c,v 1.8 1999/12/08 23:09:45 millert Exp $ */
+/* $OpenBSD: b.c,v 1.9 2001/07/12 05:16:53 deraadt Exp $ */
/****************************************************************
Copyright (C) Lucent Technologies 1997
All Rights Reserved
@@ -492,13 +492,14 @@ int pmatch(fa *f, char *p0) /* longest match, for sub */
s = ns;
else
s = cgoto(f, s, *q);
- if (s == 1) /* no transition */
+ if (s == 1) { /* no transition */
if (patlen >= 0) {
patbeg = (char *) p;
return(1);
}
else
goto nextin; /* no match */
+ }
} while (*q++ != 0);
if (f->out[s])
patlen = q-p-1; /* don't count $ */
@@ -543,12 +544,13 @@ int nematch(fa *f, char *p0) /* non-empty match, for sub */
s = ns;
else
s = cgoto(f, s, *q);
- if (s == 1) /* no transition */
+ if (s == 1) { /* no transition */
if (patlen > 0) {
patbeg = (char *) p;
return(1);
} else
goto nnextin; /* no nonempty match */
+ }
} while (*q++ != 0);
if (f->out[s])
patlen = q-p-1; /* don't count $ */
diff --git a/usr.bin/cap_mkdb/cap_mkdb.c b/usr.bin/cap_mkdb/cap_mkdb.c
index 4fa82f655ad..3e3b5ea65dc 100644
--- a/usr.bin/cap_mkdb/cap_mkdb.c
+++ b/usr.bin/cap_mkdb/cap_mkdb.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cap_mkdb.c,v 1.7 2001/06/18 18:17:58 millert Exp $ */
+/* $OpenBSD: cap_mkdb.c,v 1.8 2001/07/12 05:16:56 deraadt Exp $ */
/* $NetBSD: cap_mkdb.c,v 1.5 1995/09/02 05:47:12 jtc Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)cap_mkdb.c 8.2 (Berkeley) 4/27/95";
#endif
-static char rcsid[] = "$OpenBSD: cap_mkdb.c,v 1.7 2001/06/18 18:17:58 millert Exp $";
+static char rcsid[] = "$OpenBSD: cap_mkdb.c,v 1.8 2001/07/12 05:16:56 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -188,7 +188,7 @@ db_build(ifiles)
/* Find the end of the name field. */
if ((p = strchr(bp, info ? ',' : ':')) == NULL) {
- warnx("no name field: %.*s", MIN(len, 20), bp);
+ warnx("no name field: %.*s", (int)MIN(len, 20), bp);
continue;
}
diff --git a/usr.bin/checknr/checknr.c b/usr.bin/checknr/checknr.c
index 723fca15e38..b1d4e72ce94 100644
--- a/usr.bin/checknr/checknr.c
+++ b/usr.bin/checknr/checknr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checknr.c,v 1.4 2000/11/21 13:43:52 aaron Exp $ */
+/* $OpenBSD: checknr.c,v 1.5 2001/07/12 05:16:56 deraadt Exp $ */
/* $NetBSD: checknr.c,v 1.4 1995/03/26 04:10:19 glass Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)checknr.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: checknr.c,v 1.4 2000/11/21 13:43:52 aaron Exp $";
+static char rcsid[] = "$OpenBSD: checknr.c,v 1.5 2001/07/12 05:16:56 deraadt Exp $";
#endif
#endif /* not lint */
@@ -74,6 +74,19 @@ struct stkstr {
} stk[MAXSTK];
int stktop;
+void usage(void);
+void addmac(char *);
+void process(FILE *);
+void pe(int);
+int eq(char *, char *);
+void complain(int);
+void prop(int);
+void chkcmd(char *, char *);
+void addcmd(char *);
+void nomatch(char *);
+void checkknown(char *);
+int binsrch(char *);
+
/*
* The kinds of opening and closing brackets.
*/
@@ -83,53 +96,53 @@ struct brstr {
} br[MAXBR] = {
/* A few bare bones troff commands */
#define SZ 0
- "sz", "sz", /* also \s */
+ { "sz", "sz" }, /* also \s */
#define FT 1
- "ft", "ft", /* also \f */
+ { "ft", "ft" }, /* also \f */
/* the -mm package */
- "AL", "LE",
- "AS", "AE",
- "BL", "LE",
- "BS", "BE",
- "DF", "DE",
- "DL", "LE",
- "DS", "DE",
- "FS", "FE",
- "ML", "LE",
- "NS", "NE",
- "RL", "LE",
- "VL", "LE",
+ { "AL", "LE" },
+ { "AS", "AE" },
+ { "BL", "LE" },
+ { "BS", "BE" },
+ { "DF", "DE" },
+ { "DL", "LE" },
+ { "DS", "DE" },
+ { "FS", "FE" },
+ { "ML", "LE" },
+ { "NS", "NE" },
+ { "RL", "LE" },
+ { "VL", "LE" },
/* the -ms package */
- "AB", "AE",
- "BD", "DE",
- "CD", "DE",
- "DS", "DE",
- "FS", "FE",
- "ID", "DE",
- "KF", "KE",
- "KS", "KE",
- "LD", "DE",
- "LG", "NL",
- "QS", "QE",
- "RS", "RE",
- "SM", "NL",
- "XA", "XE",
- "XS", "XE",
+ { "AB", "AE" },
+ { "BD", "DE" },
+ { "CD", "DE" },
+ { "DS", "DE" },
+ { "FS", "FE" },
+ { "ID", "DE" },
+ { "KF", "KE" },
+ { "KS", "KE" },
+ { "LD", "DE" },
+ { "LG", "NL" },
+ { "QS", "QE" },
+ { "RS", "RE" },
+ { "SM", "NL" },
+ { "XA", "XE" },
+ { "XS", "XE" },
/* The -me package */
- "(b", ")b",
- "(c", ")c",
- "(d", ")d",
- "(f", ")f",
- "(l", ")l",
- "(q", ")q",
- "(x", ")x",
- "(z", ")z",
+ { "(b", ")b" },
+ { "(c", ")c" },
+ { "(d", ")d" },
+ { "(f", ")f" },
+ { "(l", ")l" },
+ { "(q", ")q" },
+ { "(x", ")x" },
+ { "(z", ")z" },
/* Things needed by preprocessors */
- "EQ", "EN",
- "TS", "TE",
+ { "EQ", "EN" },
+ { "TS", "TE" },
/* Refer */
- "[", "]",
- 0, 0
+ { "[", "]" },
+ { 0, },
};
/*
@@ -181,6 +194,7 @@ int slot; /* slot in knowncmds found by binsrch */
char *malloc();
+int
main(argc, argv)
int argc;
char **argv;
@@ -261,6 +275,7 @@ char **argv;
exit(0);
}
+void
usage()
{
(void)fprintf(stderr,
@@ -269,6 +284,7 @@ usage()
exit(1);
}
+void
process(f)
FILE *f;
{
@@ -365,6 +381,7 @@ FILE *f;
}
}
+void
complain(i)
{
pe(stk[i].lno);
@@ -373,7 +390,9 @@ complain(i)
printf("\n");
}
+void
prop(i)
+ int i;
{
if (stk[i].pl == 0)
printf(".%s", br[stk[i].opno].opbr);
@@ -390,11 +409,12 @@ prop(i)
}
}
+void
chkcmd(line, mac)
char *line;
char *mac;
{
- register int i, n;
+ register int i;
/*
* Check to see if it matches top of stack.
@@ -427,6 +447,7 @@ char *mac;
}
}
+void
nomatch(mac)
char *mac;
{
@@ -472,6 +493,7 @@ char *mac;
}
/* eq: are two strings equal? */
+int
eq(s1, s2)
char *s1, *s2;
{
@@ -479,6 +501,7 @@ char *s1, *s2;
}
/* print the first part of an error message, given the line number */
+void
pe(lineno)
int lineno;
{
@@ -487,6 +510,7 @@ int lineno;
printf("%d: ", lineno);
}
+void
checkknown(mac)
char *mac;
{
@@ -505,6 +529,7 @@ char *mac;
/*
* We have a .de xx line in "line". Add xx to the list of known commands.
*/
+void
addcmd(line)
char *line;
{
@@ -536,6 +561,7 @@ char *line;
* me someday?) Anyway, I claim that .de is fairly rare in user
* nroff programs, and the register loop below is pretty fast.
*/
+void
addmac(mac)
char *mac;
{
@@ -568,6 +594,7 @@ printf("after: %s %s %s %s %s, %d cmds\n", knowncmds[slot-2], knowncmds[slot-1],
* Do a binary search in knowncmds for mac.
* If found, return the index. If not, return -1.
*/
+int
binsrch(mac)
char *mac;
{
diff --git a/usr.bin/chpass/edit.c b/usr.bin/chpass/edit.c
index 7e9d94a5baa..87b07686803 100644
--- a/usr.bin/chpass/edit.c
+++ b/usr.bin/chpass/edit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: edit.c,v 1.20 2000/09/26 16:00:08 aaron Exp $ */
+/* $OpenBSD: edit.c,v 1.21 2001/07/12 05:16:57 deraadt Exp $ */
/* $NetBSD: edit.c,v 1.6 1996/05/15 21:50:45 jtc Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)edit.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: edit.c,v 1.20 2000/09/26 16:00:08 aaron Exp $";
+static char rcsid[] = "$OpenBSD: edit.c,v 1.21 2001/07/12 05:16:57 deraadt Exp $";
#endif
#endif /* not lint */
@@ -230,7 +230,7 @@ bad: (void)fclose(fp);
if (snprintf(buf, sizeof(buf),
"%s:%s:%u:%u:%s:%ld:%ld:%s:%s:%s",
pw->pw_name, pw->pw_passwd, pw->pw_uid, pw->pw_gid, pw->pw_class,
- pw->pw_change, pw->pw_expire, pw->pw_gecos, pw->pw_dir,
+ (long)pw->pw_change, (long)pw->pw_expire, pw->pw_gecos, pw->pw_dir,
pw->pw_shell) >= 1023 ||
strlen(buf) + alen >= 1023) {
warnx("entries too long");
diff --git a/usr.bin/cmp/misc.c b/usr.bin/cmp/misc.c
index 4614a249518..9b06d853514 100644
--- a/usr.bin/cmp/misc.c
+++ b/usr.bin/cmp/misc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: misc.c,v 1.2 1996/06/26 05:32:06 deraadt Exp $ */
+/* $OpenBSD: misc.c,v 1.3 2001/07/12 05:16:58 deraadt Exp $ */
/* $NetBSD: misc.c,v 1.2 1995/09/08 03:22:58 tls Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: misc.c,v 1.2 1996/06/26 05:32:06 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: misc.c,v 1.3 2001/07/12 05:16:58 deraadt Exp $";
#endif
#endif /* not lint */
@@ -65,7 +65,7 @@ diffmsg(file1, file2, byte, line)
off_t byte, line;
{
if (!sflag)
- (void)printf("%s %s differ: char %qd, line %qd\n",
- file1, file2, byte, line);
+ (void)printf("%s %s differ: char %lld, line %lld\n",
+ file1, file2, (long long)byte, (long long)line);
exit(DIFF_EXIT);
}
diff --git a/usr.bin/cmp/regular.c b/usr.bin/cmp/regular.c
index a4130caa4fc..258634ae723 100644
--- a/usr.bin/cmp/regular.c
+++ b/usr.bin/cmp/regular.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: regular.c,v 1.5 2000/10/12 13:33:47 deraadt Exp $ */
+/* $OpenBSD: regular.c,v 1.6 2001/07/12 05:16:58 deraadt Exp $ */
/* $NetBSD: regular.c,v 1.2 1995/09/08 03:22:59 tls Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)regular.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: regular.c,v 1.5 2000/10/12 13:33:47 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: regular.c,v 1.6 2001/07/12 05:16:58 deraadt Exp $";
#endif
#endif /* not lint */
@@ -95,7 +95,8 @@ c_regular(fd1, file1, skip1, len1, fd2, file2, skip2, len2)
if ((ch = *p1) != *p2) {
if (lflag) {
dfound = 1;
- (void)printf("%6qd %3o %3o\n", byte, ch, *p2);
+ (void)printf("%6lld %3o %3o\n", (long long)byte,
+ ch, *p2);
} else
diffmsg(file1, file2, byte, line);
/* NOTREACHED */
diff --git a/usr.bin/cmp/special.c b/usr.bin/cmp/special.c
index a6f01dc9a03..3c389bd1c27 100644
--- a/usr.bin/cmp/special.c
+++ b/usr.bin/cmp/special.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: special.c,v 1.3 1999/08/03 16:02:44 mickey Exp $ */
+/* $OpenBSD: special.c,v 1.4 2001/07/12 05:16:58 deraadt Exp $ */
/* $NetBSD: special.c,v 1.2 1995/09/08 03:23:00 tls Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)special.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: special.c,v 1.3 1999/08/03 16:02:44 mickey Exp $";
+static char rcsid[] = "$OpenBSD: special.c,v 1.4 2001/07/12 05:16:58 deraadt Exp $";
#endif
#endif /* not lint */
@@ -83,7 +83,8 @@ c_special(fd1, file1, skip1, fd2, file2, skip2)
if (ch1 != ch2) {
if (lflag) {
dfound = 1;
- (void)printf("%6qd %3o %3o\n", byte, ch1, ch2);
+ (void)printf("%6lld %3o %3o\n", (long long)byte,
+ ch1, ch2);
} else
diffmsg(file1, file2, byte, line);
/* NOTREACHED */
diff --git a/usr.bin/colcrt/colcrt.c b/usr.bin/colcrt/colcrt.c
index 5d5a8aef283..74abe8ec321 100644
--- a/usr.bin/colcrt/colcrt.c
+++ b/usr.bin/colcrt/colcrt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: colcrt.c,v 1.2 1996/06/26 05:32:12 deraadt Exp $ */
+/* $OpenBSD: colcrt.c,v 1.3 2001/07/12 05:16:59 deraadt Exp $ */
/* $NetBSD: colcrt.c,v 1.3 1995/03/26 05:31:00 glass Exp $ */
/*
@@ -44,11 +44,16 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)colcrt.c 8.1 (Berkeley) 6/6/93";
#else
-static char rcsid[] = "$OpenBSD: colcrt.c,v 1.2 1996/06/26 05:32:12 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: colcrt.c,v 1.3 2001/07/12 05:16:59 deraadt Exp $";
#endif
#endif /* not lint */
+#include <sys/types.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <string.h>
#include <stdio.h>
+
/*
* colcrt - replaces col for crts with new nroff esp. when using tbl.
* Bill Joy UCB July 14, 1977
@@ -74,11 +79,16 @@ char printall;
char *progname;
FILE *f;
+void pflush(int);
+int plus(char, char);
+void move(int, int);
+
+int
main(argc, argv)
int argc;
char *argv[];
{
- register c;
+ register int c;
register char *cp, *dp;
argc--;
@@ -187,19 +197,21 @@ main(argc, argv)
exit(0);
}
+int
plus(c, d)
char c, d;
{
- return (c == '|' && d == '-' || d == '_');
+ return ((c == '|' && d == '-') || d == '_');
}
int first;
+void
pflush(ol)
int ol;
{
- register int i, j;
+ register int i;
register char *cp;
char lastomit;
int l;
@@ -230,6 +242,7 @@ pflush(ol)
first = 1;
}
+void
move(l, m)
int l, m;
{
diff --git a/usr.bin/colrm/colrm.c b/usr.bin/colrm/colrm.c
index 0c164a7d57c..59ca5a668c8 100644
--- a/usr.bin/colrm/colrm.c
+++ b/usr.bin/colrm/colrm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: colrm.c,v 1.3 1997/01/15 23:42:21 millert Exp $ */
+/* $OpenBSD: colrm.c,v 1.4 2001/07/12 05:16:59 deraadt Exp $ */
/* $NetBSD: colrm.c,v 1.4 1995/09/02 05:51:37 jtc Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)colrm.c 8.2 (Berkeley) 5/4/95";
#endif
-static char rcsid[] = "$OpenBSD: colrm.c,v 1.3 1997/01/15 23:42:21 millert Exp $";
+static char rcsid[] = "$OpenBSD: colrm.c,v 1.4 2001/07/12 05:16:59 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -121,7 +121,7 @@ main(argc, argv)
break;
}
- if ((!start || column < start || stop && column > stop) &&
+ if ((!start || column < start || (stop && column > stop)) &&
putchar(ch) == EOF)
check(stdout);
}
diff --git a/usr.bin/column/column.c b/usr.bin/column/column.c
index 593ab3b9f92..ed9672b729b 100644
--- a/usr.bin/column/column.c
+++ b/usr.bin/column/column.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: column.c,v 1.5 1999/12/09 00:48:03 millert Exp $ */
+/* $OpenBSD: column.c,v 1.6 2001/07/12 05:16:59 deraadt Exp $ */
/* $NetBSD: column.c,v 1.4 1995/09/02 05:53:03 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)column.c 8.4 (Berkeley) 5/4/95";
#endif
-static char rcsid[] = "$OpenBSD: column.c,v 1.5 1999/12/09 00:48:03 millert Exp $";
+static char rcsid[] = "$OpenBSD: column.c,v 1.6 2001/07/12 05:16:59 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -85,7 +85,7 @@ main(argc, argv)
char *p;
if (ioctl(1, TIOCGWINSZ, &win) == -1 || !win.ws_col) {
- if (p = getenv("COLUMNS"))
+ if ((p = getenv("COLUMNS")))
termwidth = atoi(p);
} else
termwidth = win.ws_col;
@@ -115,7 +115,7 @@ main(argc, argv)
if (!*argv)
input(stdin);
else for (; *argv; ++argv)
- if (fp = fopen(*argv, "r")) {
+ if ((fp = fopen(*argv, "r"))) {
input(fp);
(void)fclose(fp);
} else {
@@ -156,7 +156,7 @@ c_columnate()
endcol = maxlength;
putchar('\n');
} else {
- while ((cnt = (chcnt + TAB & ~(TAB - 1))) <= endcol) {
+ while ((cnt = ((chcnt + TAB) & ~(TAB - 1))) <= endcol) {
(void)putchar('\t');
chcnt = cnt;
}
@@ -186,7 +186,7 @@ r_columnate()
chcnt += printf("%s", list[base]);
if ((base += numrows) >= entries)
break;
- while ((cnt = (chcnt + TAB & ~(TAB - 1))) <= endcol) {
+ while ((cnt = ((chcnt + TAB) & ~(TAB - 1))) <= endcol) {
(void)putchar('\t');
chcnt = cnt;
}
@@ -226,7 +226,7 @@ maketbl()
cols = emalloc((maxcols = DEFCOLS) * sizeof(char *));
lens = emalloc(maxcols * sizeof(int));
for (cnt = 0, lp = list; cnt < entries; ++cnt, ++lp, ++t) {
- for (coloff = 0, p = *lp; cols[coloff] = strtok(p, separator);
+ for (coloff = 0, p = *lp; (cols[coloff] = strtok(p, separator));
p = NULL)
if (++coloff == maxcols) {
if (!(cols = realloc(cols, (u_int)maxcols +
diff --git a/usr.bin/du/du.c b/usr.bin/du/du.c
index 9fb19af78f3..606267a6600 100644
--- a/usr.bin/du/du.c
+++ b/usr.bin/du/du.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: du.c,v 1.8 2001/05/02 23:26:53 pjanzen Exp $ */
+/* $OpenBSD: du.c,v 1.9 2001/07/12 05:17:00 deraadt Exp $ */
/* $NetBSD: du.c,v 1.11 1996/10/18 07:20:35 thorpej Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)du.c 8.5 (Berkeley) 5/4/95";
#else
-static char rcsid[] = "$OpenBSD: du.c,v 1.8 2001/05/02 23:26:53 pjanzen Exp $";
+static char rcsid[] = "$OpenBSD: du.c,v 1.9 2001/07/12 05:17:00 deraadt Exp $";
#endif
#endif /* not lint */
@@ -299,7 +299,7 @@ prtout(size, path, hflag)
double bytes;
if (!hflag)
- (void)printf("%qd\t%s\n", size, path);
+ (void)printf("%lld\t%s\n", (long long)size, path);
else {
bytes = (double)size * 512.0;
unit = unit_adjust(&bytes);
diff --git a/usr.bin/elf2olf/elf2olf.c b/usr.bin/elf2olf/elf2olf.c
index af8c1931c64..4adc68ae0a7 100644
--- a/usr.bin/elf2olf/elf2olf.c
+++ b/usr.bin/elf2olf/elf2olf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: elf2olf.c,v 1.4 1997/01/15 23:42:46 millert Exp $ */
+/* $OpenBSD: elf2olf.c,v 1.5 2001/07/12 05:17:01 deraadt Exp $ */
/*
* Copyright (c) 1996 Erik Theisen. All rights reserved.
*
@@ -30,7 +30,7 @@ static char copyright[] =
#endif /* not lint */
#ifndef lint
-static char rcsid[] = "@(#) $Id: elf2olf.c,v 1.4 1997/01/15 23:42:46 millert Exp $";
+static char rcsid[] = "@(#) $Id: elf2olf.c,v 1.5 2001/07/12 05:17:01 deraadt Exp $";
#endif
#include <stdlib.h>
@@ -59,6 +59,9 @@ char *os_namev[] = ONAMEV;
#define word(x,y)((y == ELFDATA2LSB) ? ntohl(htonl(x)) : ntohl(x))
#define half(x,y)((y == ELFDATA2LSB) ? ntohs(htons(x)) : ntohs(x))
+void usage(void);
+void pwarn(char *, char *, int);
+
int
main(int argc, char*argv[])
{
@@ -73,7 +76,7 @@ main(int argc, char*argv[])
Elf32_Shdr shdr;
int e;
- if (progname = strrchr(*argv, '/'))
+ if ((progname = strrchr(*argv, '/')))
++progname;
else
progname = *argv;
@@ -163,14 +166,14 @@ main(int argc, char*argv[])
else if (word(shdr.sh_type, e) == SHT_DYNAMIC)
ehdr.e_ident[OI_DYNAMIC] = ODYNAMIC;
} else
- warn(progname, *argv, errno);
+ pwarn(progname, *argv, errno);
} /* while less than number of section headers */
/* We're ready to modify */
okay = 1;
} else /* Bogus section header table seek */
- warn(progname, *argv, errno);
+ pwarn(progname, *argv, errno);
} else { /* olf2elf */
ehdr.e_ident[EI_MAG0] = ELFMAG0;
@@ -184,7 +187,7 @@ main(int argc, char*argv[])
okay = 1;
} /* olf2elf */
} else /* Bogus non-ELF file encountered */
- warn(progname, *argv, ENOEXEC);
+ pwarn(progname, *argv, ENOEXEC);
/*
* Do It.
@@ -207,22 +210,23 @@ main(int argc, char*argv[])
printf("OLF %s => ELF.\n", *argv);
}
} else /* bad write */
- warn(progname, *argv, errno);
+ pwarn(progname, *argv, errno);
} else /* bad seek */
- warn(progname, *argv, errno);
+ pwarn(progname, *argv, errno);
} /* okay? */
fsync(fd);
close(fd);
} else /* couldn't handle file */
- warn(progname, *argv, errno);
+ pwarn(progname, *argv, errno);
} while (*(++argv) != NULL);
return (retval);
}
-warn(name, fname, errval)
+void
+pwarn(name, fname, errval)
char *name;
char *fname;
int errval;
@@ -231,6 +235,7 @@ warn(name, fname, errval)
retval = 1;
}
+void
usage()
{
register int i;
diff --git a/usr.bin/error/error.h b/usr.bin/error/error.h
index 6281704f9ff..a692cb6d184 100644
--- a/usr.bin/error/error.h
+++ b/usr.bin/error/error.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: error.h,v 1.4 1998/11/16 06:22:28 deraadt Exp $ */
+/* $OpenBSD: error.h,v 1.5 2001/07/12 05:17:01 deraadt Exp $ */
/* $NetBSD: error.h,v 1.3 1995/09/02 06:15:25 jtc Exp $ */
/*
@@ -220,7 +220,43 @@ char next_lastchar();
char **wordvsplice();
int wordvcmp();
boolean persperdexplode();
+
/*
* Printing hacks
*/
char *plural(), *verbform();
+
+void getignored(char *);
+void eaterrors(int *, Eptr **);
+void printerrors(boolean, int, Eptr []);
+void wordvbuild(char *, int *, char ***);
+Errorclass discardit(Eptr);
+void erroradd(int, char **, Errorclass, Errorclass);
+void arrayify(int *, Eptr **, Eptr);
+Errorclass catchall(void);
+char * substitute(char *, char, char);
+void clob_last(char *, char);
+int f77(void);
+void wordvprint(FILE *, int, char *[]);
+void wordvbuild(char *, int *, char ***);
+void findfiles(int, Eptr *, int *, Eptr ***);
+boolean touchfiles(int, Eptr **, int *, char ***);
+void forkvi(int, char **);
+void try(char *, int, char **);
+void filenames(int, Eptr **);
+int countfiles(Eptr *);
+void errorprint(FILE *, Eptr, boolean);
+void hackfile(char *, Eptr **, int, int);
+void execvarg(int, int *, char ***);
+int nopertain(Eptr **);
+int oktotouch(char *);
+boolean preview(char *, int, Eptr **, int);
+int settotouch(char *);
+void diverterrors(char *, int, Eptr **, int, boolean, int);
+int writetouched(int);
+boolean edit(char *);
+void insert(int);
+void text(Eptr, boolean);
+int mustoverwrite(FILE *, FILE *);
+int mustwrite(char *, int, FILE *);
+int position(char *, char);
diff --git a/usr.bin/error/filter.c b/usr.bin/error/filter.c
index 4e96e1ae0df..f01df5cae04 100644
--- a/usr.bin/error/filter.c
+++ b/usr.bin/error/filter.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filter.c,v 1.5 1999/12/04 00:16:52 deraadt Exp $ */
+/* $OpenBSD: filter.c,v 1.6 2001/07/12 05:17:02 deraadt Exp $ */
/* $NetBSD: filter.c,v 1.3 1995/09/02 06:15:28 jtc Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)filter.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: filter.c,v 1.5 1999/12/04 00:16:52 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: filter.c,v 1.6 2001/07/12 05:17:02 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -63,6 +63,7 @@ int lexsort();
* Read the file ERRORNAME of the names of functions in lint
* to ignore complaints about.
*/
+void
getignored(auxname)
char *auxname;
{
@@ -163,8 +164,9 @@ int search_ignore(key)
* and the linenumber the second.
* Return the new categorization of the error class.
*/
-Errorclass discardit(errorp)
- reg Eptr errorp;
+Errorclass
+discardit(errorp)
+ Eptr errorp;
{
int language;
reg int i;
diff --git a/usr.bin/error/input.c b/usr.bin/error/input.c
index da92c7e2a0a..75aa24cc5b6 100644
--- a/usr.bin/error/input.c
+++ b/usr.bin/error/input.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: input.c,v 1.2 1996/06/26 05:32:43 deraadt Exp $ */
+/* $OpenBSD: input.c,v 1.3 2001/07/12 05:17:02 deraadt Exp $ */
/* $NetBSD: input.c,v 1.4 1995/09/10 15:55:13 christos Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)input.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: input.c,v 1.2 1996/06/26 05:32:43 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: input.c,v 1.3 2001/07/12 05:17:02 deraadt Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -71,11 +71,11 @@ Errorclass mod2();
* Eat all of the lines in the input file, attempting to categorize
* them by their various flavors
*/
+void
eaterrors(r_errorc, r_errorv)
int *r_errorc;
Eptr **r_errorv;
{
- extern boolean piflag;
Errorclass errorclass = C_SYNC;
char *line;
char *inbuffer;
@@ -123,6 +123,7 @@ eaterrors(r_errorc, r_errorv)
/*
* create a new error entry, given a zero based array and count
*/
+void
erroradd(errorlength, errorv, errorclass, errorsubclass)
int errorlength;
char **errorv;
@@ -414,6 +415,7 @@ char *F77_fatal[3] = {"Compiler", "error", "line"};
char *F77_error[3] = {"Error", "on", "line"};
char *F77_warning[3] = {"Warning", "on", "line"};
char *F77_no_ass[3] = {"Error.","No","assembly."};
+int
f77()
{
char **nwordv;
diff --git a/usr.bin/error/main.c b/usr.bin/error/main.c
index 676c8d18b81..fbf498fb412 100644
--- a/usr.bin/error/main.c
+++ b/usr.bin/error/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.5 2000/08/12 02:32:49 aaron Exp $ */
+/* $OpenBSD: main.c,v 1.6 2001/07/12 05:17:02 deraadt Exp $ */
/* $NetBSD: main.c,v 1.3 1995/09/02 06:15:37 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: main.c,v 1.5 2000/08/12 02:32:49 aaron Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.6 2001/07/12 05:17:02 deraadt Exp $";
#endif /* not lint */
#include <signal.h>
@@ -53,6 +53,7 @@ static char rcsid[] = "$OpenBSD: main.c,v 1.5 2000/08/12 02:32:49 aaron Exp $";
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
+#include <err.h>
#include "error.h"
#include "pathnames.h"
@@ -226,8 +227,10 @@ main(argc, argv)
if (touchfiles(nfiles, files, &ed_argc, &ed_argv) && edit_files)
forkvi(ed_argc, ed_argv);
+ exit(0);
}
+void
forkvi(argc, argv)
int argc;
char **argv;
@@ -254,6 +257,7 @@ forkvi(argc, argv)
fprintf(stdout, "Can't find any editors.\n");
}
+void
try(name, argc, argv)
char *name;
int argc;
diff --git a/usr.bin/error/subr.c b/usr.bin/error/subr.c
index 639f8315ae4..6c05fa12b50 100644
--- a/usr.bin/error/subr.c
+++ b/usr.bin/error/subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr.c,v 1.6 1999/12/06 00:32:47 deraadt Exp $ */
+/* $OpenBSD: subr.c,v 1.7 2001/07/12 05:17:02 deraadt Exp $ */
/* $NetBSD: subr.c,v 1.4 1995/09/10 15:55:15 christos Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)subr.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: subr.c,v 1.6 1999/12/06 00:32:47 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: subr.c,v 1.7 2001/07/12 05:17:02 deraadt Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -116,8 +116,8 @@ char *strsave(instring)
* (one based)
*/
int position(string, ch)
- reg char *string;
- reg char ch;
+ char *string;
+ char ch;
{
reg int i;
if (string)
@@ -180,6 +180,7 @@ char next_lastchar(string)
return('\0');
}
+void
clob_last(string, newstuff)
char *string, newstuff;
{
@@ -269,29 +270,30 @@ static char mod2incomment[] = MOD2INCOMMENT;
static char mod2outcomment[] = MOD2OUTCOMMENT;
struct lang_desc lang_table[] = {
- /*INUNKNOWN 0*/ "unknown", cincomment, coutcomment,
- /*INCPP 1*/ "cpp", cincomment, coutcomment,
- /*INCC 2*/ "cc", cincomment, coutcomment,
- /*INAS 3*/ "as", ASINCOMMENT, newline,
- /*INLD 4*/ "ld", cincomment, coutcomment,
- /*INLINT 5*/ "lint", cincomment, coutcomment,
- /*INF77 6*/ "f77", fincomment, foutcomment,
- /*INPI 7*/ "pi", piincomment, pioutcomment,
- /*INPC 8*/ "pc", piincomment, pioutcomment,
- /*INFRANZ 9*/ "franz",lispincomment, newline,
- /*INLISP 10*/ "lisp", lispincomment, newline,
- /*INVAXIMA 11*/ "vaxima",lispincomment,newline,
- /*INRATFOR 12*/ "ratfor",fincomment, foutcomment,
- /*INLEX 13*/ "lex", cincomment, coutcomment,
- /*INYACC 14*/ "yacc", cincomment, coutcomment,
- /*INAPL 15*/ "apl", ".lm", newline,
- /*INMAKE 16*/ "make", ASINCOMMENT, newline,
- /*INRI 17*/ "ri", riincomment, rioutcomment,
- /*INTROFF 18*/ "troff",troffincomment,troffoutcomment,
- /*INMOD2 19*/ "mod2", mod2incomment, mod2outcomment,
- 0, 0, 0
+ { /*INUNKNOWN 0*/ "unknown", cincomment, coutcomment },
+ { /*INCPP 1*/ "cpp", cincomment, coutcomment },
+ { /*INCC 2*/ "cc", cincomment, coutcomment },
+ { /*INAS 3*/ "as", ASINCOMMENT, newline },
+ { /*INLD 4*/ "ld", cincomment, coutcomment },
+ { /*INLINT 5*/ "lint", cincomment, coutcomment },
+ { /*INF77 6*/ "f77", fincomment, foutcomment },
+ { /*INPI 7*/ "pi", piincomment, pioutcomment },
+ { /*INPC 8*/ "pc", piincomment, pioutcomment },
+ { /*INFRANZ 9*/ "franz",lispincomment, newline },
+ { /*INLISP 10*/ "lisp", lispincomment, newline },
+ { /*INVAXIMA 11*/ "vaxima",lispincomment,newline },
+ { /*INRATFOR 12*/ "ratfor",fincomment, foutcomment },
+ { /*INLEX 13*/ "lex", cincomment, coutcomment },
+ { /*INYACC 14*/ "yacc", cincomment, coutcomment },
+ { /*INAPL 15*/ "apl", ".lm", newline },
+ { /*INMAKE 16*/ "make", ASINCOMMENT, newline },
+ { /*INRI 17*/ "ri", riincomment, rioutcomment },
+ { /*INTROFF 18*/ "troff",troffincomment,troffoutcomment },
+ { /*INMOD2 19*/ "mod2", mod2incomment, mod2outcomment },
+ { 0, 0, 0 }
};
+void
printerrors(look_at_subclass, errorc, errorv)
boolean look_at_subclass;
int errorc;
@@ -314,6 +316,7 @@ printerrors(look_at_subclass, errorc, errorv)
}
}
+void
wordvprint(fyle, wordc, wordv)
FILE *fyle;
int wordc;
@@ -333,6 +336,7 @@ wordvprint(fyle, wordc, wordv)
* Given a string, parse it into a number of words, and build
* a wordc wordv combination pointing into it.
*/
+void
wordvbuild(string, r_wordc, r_wordv)
char *string;
int *r_wordc;
@@ -386,7 +390,7 @@ int wordvcmp(wordv1, wordc, wordv2)
for (i = 0; i < wordc; i++){
if (wordv1[i] == 0 || wordv2[i] == 0)
return(-1);
- if (back = strcmp(wordv1[i], wordv2[i])){
+ if ((back = strcmp(wordv1[i], wordv2[i]))){
return(back);
}
}
diff --git a/usr.bin/error/touch.c b/usr.bin/error/touch.c
index 78573dd5ee2..3c47798654f 100644
--- a/usr.bin/error/touch.c
+++ b/usr.bin/error/touch.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: touch.c,v 1.7 1999/12/04 00:09:22 deraadt Exp $ */
+/* $OpenBSD: touch.c,v 1.8 2001/07/12 05:17:02 deraadt Exp $ */
/* $NetBSD: touch.c,v 1.3 1995/09/02 06:15:54 jtc Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)touch.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: touch.c,v 1.7 1999/12/04 00:09:22 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: touch.c,v 1.8 2001/07/12 05:17:02 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -49,6 +49,7 @@ static char rcsid[] = "$OpenBSD: touch.c,v 1.7 1999/12/04 00:09:22 deraadt Exp $
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
+#include <err.h>
#include "error.h"
#include "pathnames.h"
@@ -61,6 +62,7 @@ static char rcsid[] = "$OpenBSD: touch.c,v 1.7 1999/12/04 00:09:22 deraadt Exp $
#define FILEITERATE(fi, lb) for (fi = lb; fi <= nfiles; fi++)
int touchstatus = Q_YES;
+void
findfiles(nerrors, errors, r_nfiles, r_files)
int nerrors;
Eptr *errors;
@@ -148,14 +150,14 @@ char *class_table[] = {
int class_count[C_LAST - C_FIRST] = {0};
+void
filenames(nfiles, files)
int nfiles;
Eptr **files;
{
reg int fi;
- char *sep = " ";
- extern char *class_table[];
- int someerrors;
+ char *sep = " ";
+ int someerrors;
/*
* first, simply dump out errors that
@@ -279,10 +281,12 @@ boolean touchfiles(nfiles, files, r_edargc, r_edargv)
}
}
+void
hackfile(name, files, ix, nerrors)
char *name;
Eptr **files;
int ix;
+ int nerrors;
{
boolean previewed;
int errordest; /* where errors go*/
@@ -389,6 +393,7 @@ int settotouch(name)
return(dest);
}
+void
diverterrors(name, dest, files, ix, previewed, nterrors)
char *name;
int dest;
@@ -485,6 +490,7 @@ int oktotouch(filename)
* We fill in the initial search string.
* We fill in the arguments, and the null.
*/
+void
execvarg(n_pissed_on, r_argc, r_argv)
int n_pissed_on;
int *r_argc;
@@ -555,6 +561,8 @@ boolean edit(name)
* Position to the line (before, after) the line given by place
*/
char edbuf[BUFSIZ];
+
+void
insert(place)
int place;
{
@@ -566,9 +574,10 @@ insert(place)
}
}
+void
text(p, use_all)
- reg Eptr p;
- boolean use_all;
+ Eptr p;
+ boolean use_all;
{
int offset = use_all ? 0 : 2;
@@ -585,6 +594,7 @@ text(p, use_all)
* write the touched file to its temporary copy,
* then bring the temporary in over the local file
*/
+int
writetouched(overwrite)
int overwrite;
{
@@ -659,6 +669,7 @@ int mustoverwrite(preciousfile, tmpfile)
/*
* return 0 on catastrophe
*/
+int
mustwrite(base, n, preciousfile)
char *base;
int n;
@@ -671,7 +682,7 @@ mustwrite(base, n, preciousfile)
nwrote = fwrite(base, 1, n, preciousfile);
if (nwrote == n)
return(1);
- err(NULL);
+ warn(NULL);
switch(inquire(terse
? "Botch overwriting: retry? "
: "Botch overwriting the source file: retry? ")){
@@ -717,6 +728,7 @@ onintr()
/*NOTREACHED*/
}
+void
errorprint(place, errorp, print_all)
FILE *place;
Eptr errorp;
diff --git a/usr.bin/file2c/file2c.c b/usr.bin/file2c/file2c.c
index b5405b351a4..21c9c63cac3 100644
--- a/usr.bin/file2c/file2c.c
+++ b/usr.bin/file2c/file2c.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file2c.c,v 1.1 1996/08/26 07:47:06 downsj Exp $ */
+/* $OpenBSD: file2c.c,v 1.2 2001/07/12 05:17:03 deraadt Exp $ */
/*
* ----------------------------------------------------------------------------
* "THE BEER-WARE LICENSE" (Revision 42):
@@ -19,7 +19,6 @@ main(argc, argv)
char **argv;
{
int i,j,k;
- char s[10];
if (argc > 1)
printf("%s\n",argv[1]);
diff --git a/usr.bin/find/ls.c b/usr.bin/find/ls.c
index c8e2163622e..739c28c8cb9 100644
--- a/usr.bin/find/ls.c
+++ b/usr.bin/find/ls.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ls.c,v 1.7 2001/02/05 07:55:36 deraadt Exp $ */
+/* $OpenBSD: ls.c,v 1.8 2001/07/12 05:17:03 deraadt Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -35,7 +35,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)ls.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$OpenBSD: ls.c,v 1.7 2001/02/05 07:55:36 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ls.c,v 1.8 2001/07/12 05:17:03 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -65,7 +65,7 @@ printlong(name, accpath, sb)
{
char modep[15], *user_from_uid(), *group_from_gid();
- (void)printf("%6u %4qd ", sb->st_ino, sb->st_blocks);
+ (void)printf("%6u %4lld ", sb->st_ino, (long long)sb->st_blocks);
(void)strmode(sb->st_mode, modep);
(void)printf("%s %3u %-*.*s %-*.*s ", modep, sb->st_nlink,
NAME_WIDTH, UT_NAMESIZE, user_from_uid(sb->st_uid, 0),
@@ -75,7 +75,7 @@ printlong(name, accpath, sb)
(void)printf("%3d, %3d ", major(sb->st_rdev),
minor(sb->st_rdev));
else
- (void)printf("%8qd ", sb->st_size);
+ (void)printf("%8lld ", (long long)sb->st_size);
printtime(sb->st_mtime);
(void)printf("%s", name);
if (S_ISLNK(sb->st_mode))
diff --git a/usr.bin/find/main.c b/usr.bin/find/main.c
index c03a38b08eb..769a074f7ef 100644
--- a/usr.bin/find/main.c
+++ b/usr.bin/find/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.8 1999/03/17 17:36:30 espie Exp $ */
+/* $OpenBSD: main.c,v 1.9 2001/07/12 05:17:04 deraadt Exp $ */
/*-
* Copyright (c) 1990, 1993
@@ -35,7 +35,7 @@
#ifndef lint
/*static char sccsid[] = "@(#)main.c 8.1 (Berkeley) 6/6/93";*/
-static char rcsid[] = "$OpenBSD: main.c,v 1.8 1999/03/17 17:36:30 espie Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.9 2001/07/12 05:17:04 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -48,6 +48,7 @@ static char rcsid[] = "$OpenBSD: main.c,v 1.8 1999/03/17 17:36:30 espie Exp $";
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <time.h>
#include "find.h"
@@ -67,10 +68,14 @@ main(argc, argv)
int argc;
char *argv[];
{
- struct sigaction sa = { show_path, SA_RESTART, NULL };
+ struct sigaction sa;
char **p, **paths;
int ch;
+ memset(&sa, 0, sizeof sa);
+ sa.sa_handler = show_path;
+ sa.sa_flags = SA_RESTART;
+
(void)time(&now); /* initialize the time-of-day */
p = paths = (char **) emalloc(sizeof(char *) * argc);
diff --git a/usr.bin/finger/lprint.c b/usr.bin/finger/lprint.c
index 830223a4db2..b340f30202d 100644
--- a/usr.bin/finger/lprint.c
+++ b/usr.bin/finger/lprint.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lprint.c,v 1.4 1997/05/30 23:35:52 kstailey Exp $ */
+/* $OpenBSD: lprint.c,v 1.5 2001/07/12 05:17:04 deraadt Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -38,7 +38,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)lprint.c 5.13 (Berkeley) 10/31/90";*/
-static char rcsid[] = "$OpenBSD: lprint.c,v 1.4 1997/05/30 23:35:52 kstailey Exp $";
+static char rcsid[] = "$OpenBSD: lprint.c,v 1.5 2001/07/12 05:17:04 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -169,7 +169,7 @@ lprint(pn)
delta = gmtime(&w->idletime);
if (delta->tm_yday || delta->tm_hour || delta->tm_min) {
cpr += printf("%-*s idle ",
- maxlen - strlen(w->tty) + 1, ",");
+ (int)(maxlen - strlen(w->tty) + 1), ",");
if (delta->tm_yday > 0) {
cpr += printf("%d day%s ",
delta->tm_yday,
diff --git a/usr.bin/fmt/fmt.c b/usr.bin/fmt/fmt.c
index a6051fe1f81..120fc4891fd 100644
--- a/usr.bin/fmt/fmt.c
+++ b/usr.bin/fmt/fmt.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fmt.c,v 1.16 2000/06/25 15:35:42 pjanzen Exp $ */
+/* $OpenBSD: fmt.c,v 1.17 2001/07/12 05:17:05 deraadt Exp $ */
/* Sensible version of fmt
*
@@ -168,7 +168,7 @@
#ifndef lint
static const char rcsid[] =
- "$OpenBSD: fmt.c,v 1.16 2000/06/25 15:35:42 pjanzen Exp $";
+ "$OpenBSD: fmt.c,v 1.17 2001/07/12 05:17:05 deraadt Exp $";
static const char copyright[] =
"Copyright (c) 1997 Gareth McCaughan. All rights reserved.\n";
#endif /* not lint */
@@ -562,7 +562,7 @@ output_word(size_t indent0, size_t indent1, const char *word, size_t length, siz
if (indent>0) output_indent(indent);
fwrite(output_buffer, 1, x0, stdout);
if (x0==0 || (new_x <= max_length && new_x-goal_length <= goal_length-x)) {
- printf("%*s", pending_spaces, "");
+ printf("%*s", (int)pending_spaces, "");
goto write_out_word;
}
else {
diff --git a/usr.bin/from/from.c b/usr.bin/from/from.c
index b914edfcd8f..b05b3500adf 100644
--- a/usr.bin/from/from.c
+++ b/usr.bin/from/from.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: from.c,v 1.6 2000/01/18 04:57:55 millert Exp $ */
+/* $OpenBSD: from.c,v 1.7 2001/07/12 05:17:06 deraadt Exp $ */
/* $NetBSD: from.c,v 1.6 1995/09/01 01:39:10 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)from.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: from.c,v 1.6 2000/01/18 04:57:55 millert Exp $";
+static char rcsid[] = "$OpenBSD: from.c,v 1.7 2001/07/12 05:17:06 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -54,8 +54,12 @@ static char rcsid[] = "$OpenBSD: from.c,v 1.6 2000/01/18 04:57:55 millert Exp $"
#include <stdlib.h>
#include <unistd.h>
#include <paths.h>
+#include <string.h>
#include <err.h>
+int match(char *, char *);
+
+int
main(argc, argv)
int argc;
char **argv;
@@ -102,7 +106,7 @@ main(argc, argv)
if (!(file = getenv("MAIL"))) {
if (!(pwd = getpwuid(getuid())))
errx(1, "no password file entry for you");
- if (file = getenv("USER")) {
+ if ((file = getenv("USER"))) {
(void)snprintf(buf, sizeof(buf),
"%s/%s", _PATH_MAILDIR, file);
file = buf;
@@ -132,8 +136,9 @@ main(argc, argv)
exit(0);
}
+int
match(line, sender)
- register char *line, *sender;
+ char *line, *sender;
{
register char ch, pch, first, *p, *t;
diff --git a/usr.bin/fstat/fstat.c b/usr.bin/fstat/fstat.c
index 36ef4dfabef..aa26789d322 100644
--- a/usr.bin/fstat/fstat.c
+++ b/usr.bin/fstat/fstat.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: fstat.c,v 1.30 2001/06/22 22:43:20 pvalchev Exp $ */
+/* $OpenBSD: fstat.c,v 1.31 2001/07/12 05:17:06 deraadt Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -41,7 +41,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)fstat.c 8.1 (Berkeley) 6/6/93";*/
-static char *rcsid = "$OpenBSD: fstat.c,v 1.30 2001/06/22 22:43:20 pvalchev Exp $";
+static char *rcsid = "$OpenBSD: fstat.c,v 1.31 2001/07/12 05:17:06 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -150,6 +150,8 @@ int ext2fs_filestat __P((struct vnode *, struct filestat *));
int isofs_filestat __P((struct vnode *, struct filestat *));
int msdos_filestat __P((struct vnode *, struct filestat *));
int nfs_filestat __P((struct vnode *, struct filestat *));
+int xfs_filestat __P((struct vnode *, struct filestat *));
+int null_filestat __P((struct vnode *, struct filestat *));
void dofiles __P((struct kinfo_proc *));
void getinetproto __P((int));
void socktrans __P((struct socket *, int));
@@ -460,7 +462,8 @@ vtrans(vp, i, flag, offset)
return;
}
if (nflg)
- (void)printf(" %2d,%-2d", major(fst.fsid), minor(fst.fsid));
+ (void)printf(" %2ld,%-2ld", (long)major(fst.fsid),
+ (long)minor(fst.fsid));
else
(void)printf(" %-8s", getmnton(vn.v_mount));
if (nflg)
@@ -489,9 +492,9 @@ vtrans(vp, i, flag, offset)
break;
}
default:
- printf(" %8qd", fst.size);
+ printf(" %8lld", (long long)fst.size);
if (oflg)
- printf(":%-8qd", offset);
+ printf(":%-8lld", (long long)offset);
}
if (filename && !fsflg)
printf(" %s", filename);
diff --git a/usr.bin/ftp/cmds.c b/usr.bin/ftp/cmds.c
index 7c863daad36..783f76723ad 100644
--- a/usr.bin/ftp/cmds.c
+++ b/usr.bin/ftp/cmds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmds.c,v 1.36 2001/06/26 23:43:59 lebel Exp $ */
+/* $OpenBSD: cmds.c,v 1.37 2001/07/12 05:17:07 deraadt Exp $ */
/* $NetBSD: cmds.c,v 1.27 1997/08/18 10:20:15 lukem Exp $ */
/*
@@ -67,7 +67,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.6 (Berkeley) 10/9/94";
#else
-static char rcsid[] = "$OpenBSD: cmds.c,v 1.36 2001/06/26 23:43:59 lebel Exp $";
+static char rcsid[] = "$OpenBSD: cmds.c,v 1.37 2001/07/12 05:17:07 deraadt Exp $";
#endif
#endif /* not lint */
@@ -2064,9 +2064,9 @@ restart(argc, argv)
if (nrestart_point == QUAD_MAX || *ep != '\0')
fputs("restart: invalid offset.\n", ttyout);
else {
- fprintf(ttyout, "Restarting at %qd. Execute get, put or"
+ fprintf(ttyout, "Restarting at %lld. Execute get, put or"
"append to initiate transfer\n",
- nrestart_point);
+ (long long)nrestart_point);
restart_point = nrestart_point;
}
}
@@ -2161,7 +2161,7 @@ sizecmd(argc, argv)
}
size = remotesize(argv[1], 1);
if (size != -1)
- fprintf(ttyout, "%s\t%qd\n", argv[1], size);
+ fprintf(ttyout, "%s\t%lld\n", argv[1], (long long)size);
code = size;
}
diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c
index c31d2ee5164..1572a1cf74d 100644
--- a/usr.bin/ftp/util.c
+++ b/usr.bin/ftp/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.25 2001/06/18 21:20:17 millert Exp $ */
+/* $OpenBSD: util.c,v 1.26 2001/07/12 05:17:08 deraadt Exp $ */
/* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */
/*
@@ -35,7 +35,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: util.c,v 1.25 2001/06/18 21:20:17 millert Exp $";
+static char rcsid[] = "$OpenBSD: util.c,v 1.26 2001/07/12 05:17:08 deraadt Exp $";
#endif /* not lint */
/*
@@ -702,7 +702,7 @@ progressmeter(flag)
abbrevsize >>= 10;
}
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),
- " %5qd %c%c ", (quad_t)abbrevsize, prefixes[i],
+ " %5lld %c%c ", (long long)abbrevsize, prefixes[i],
prefixes[i] == ' ' ? ' ' : 'B');
timersub(&now, &lastupdate, &wait);
@@ -791,8 +791,8 @@ ptransfer(siginfo)
if (bs > (1024 * 1024))
meg = 1;
(void)snprintf(buf, sizeof(buf),
- "%qd byte%s %s in %.2f seconds (%.2f %sB/s)\n",
- (quad_t)bytes, bytes == 1 ? "" : "s", direction, elapsed,
+ "%lld byte%s %s in %.2f seconds (%.2f %sB/s)\n",
+ (long long)bytes, bytes == 1 ? "" : "s", direction, elapsed,
bs / (1024.0 * (meg ? 1024.0 : 1.0)), meg ? "M" : "K");
if (siginfo && bytes > 0 && elapsed > 0.0 && filesize >= 0
&& bytes + restart_point <= filesize) {
diff --git a/usr.bin/getconf/getconf.c b/usr.bin/getconf/getconf.c
index f99bbae896e..b2546a8c53b 100644
--- a/usr.bin/getconf/getconf.c
+++ b/usr.bin/getconf/getconf.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: getconf.c,v 1.4 2001/03/01 21:15:41 aaron Exp $ */
+/* $OpenBSD: getconf.c,v 1.5 2001/07/12 05:17:08 deraadt Exp $ */
/*-
* Copyright (c) 1996 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: getconf.c,v 1.4 2001/03/01 21:15:41 aaron Exp $";
+static char rcsid[] = "$OpenBSD: getconf.c,v 1.5 2001/07/12 05:17:08 deraadt Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -49,6 +49,7 @@ static char rcsid[] = "$OpenBSD: getconf.c,v 1.4 2001/03/01 21:15:41 aaron Exp $
#include <limits.h>
#include <locale.h>
#include <unistd.h>
+#include <err.h>
#include <errno.h>
static void usage __P((void));
diff --git a/usr.bin/getopt/getopt.c b/usr.bin/getopt/getopt.c
index 30740547687..7ec53acc066 100644
--- a/usr.bin/getopt/getopt.c
+++ b/usr.bin/getopt/getopt.c
@@ -1,11 +1,13 @@
-/* $OpenBSD: getopt.c,v 1.3 1997/01/15 23:42:32 millert Exp $ */
+/* $OpenBSD: getopt.c,v 1.4 2001/07/12 05:17:09 deraadt Exp $ */
#ifndef lint
-static char rcsid[] = "$OpenBSD: getopt.c,v 1.3 1997/01/15 23:42:32 millert Exp $";
+static char rcsid[] = "$OpenBSD: getopt.c,v 1.4 2001/07/12 05:17:09 deraadt Exp $";
#endif /* not lint */
#include <stdio.h>
+#include <unistd.h>
+int
main(argc, argv)
int argc;
char *argv[];
diff --git a/usr.bin/hexdump/conv.c b/usr.bin/hexdump/conv.c
index 58b067206d0..017695c657b 100644
--- a/usr.bin/hexdump/conv.c
+++ b/usr.bin/hexdump/conv.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: conv.c,v 1.2 1996/06/26 05:34:17 deraadt Exp $ */
+/* $OpenBSD: conv.c,v 1.3 2001/07/12 05:17:10 deraadt Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -35,13 +35,15 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)conv.c 5.4 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$OpenBSD: conv.c,v 1.2 1996/06/26 05:34:17 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: conv.c,v 1.3 2001/07/12 05:17:10 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <ctype.h>
+#include <stdio.h>
#include "hexdump.h"
+void
conv_c(pr, p)
PR *pr;
u_char *p;
@@ -92,6 +94,7 @@ strpr: *pr->cchar = 's';
}
}
+void
conv_u(pr, p)
PR *pr;
u_char *p;
diff --git a/usr.bin/hexdump/display.c b/usr.bin/hexdump/display.c
index 987fb99d618..9584ee59dc1 100644
--- a/usr.bin/hexdump/display.c
+++ b/usr.bin/hexdump/display.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: display.c,v 1.5 1998/12/16 01:28:24 deraadt Exp $ */
+/* $OpenBSD: display.c,v 1.6 2001/07/12 05:17:10 deraadt Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -35,7 +35,7 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)display.c 5.11 (Berkeley) 3/9/91";*/
-static char rcsid[] = "$OpenBSD: display.c,v 1.5 1998/12/16 01:28:24 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: display.c,v 1.6 2001/07/12 05:17:10 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -134,6 +134,7 @@ static off_t savaddress; /* saved address/offset in stream */
} \
}
+void
display()
{
extern FU *endfu;
@@ -145,7 +146,7 @@ display()
off_t saveaddress;
u_char savech, *savebp, *get();
- while (bp = get())
+ while ((bp = get()))
for (fs = fshead, savebp = bp, saveaddress = address; fs;
fs = fs->nextfs, bp = savebp, address = saveaddress)
for (fu = fs->nextfu; fu; fu = fu->nextfu) {
@@ -188,6 +189,7 @@ display()
}
}
+void
bpad(pr)
PR *pr;
{
@@ -202,7 +204,8 @@ bpad(pr)
*pr->cchar = 's';
for (p1 = pr->fmt; *p1 != '%'; ++p1);
for (p2 = ++p1; *p1 && strchr(spec, *p1); ++p1);
- while (*p2++ = *p1++);
+ while ((*p2++ = *p1++))
+ ;
}
static char **_argv;
@@ -281,6 +284,7 @@ get()
extern off_t skip; /* bytes to skip */
+int
next(argv)
char **argv;
{
@@ -317,6 +321,7 @@ next(argv)
/* NOTREACHED */
}
+void
doskip(fname, statok)
char *fname;
int statok;
@@ -356,6 +361,7 @@ emalloc(size)
return(p);
}
+void
nomem()
{
(void)fprintf(stderr, "hexdump: %s.\n", strerror(errno));
diff --git a/usr.bin/hexdump/hexdump.c b/usr.bin/hexdump/hexdump.c
index 1530d5bc0b5..6d16a5a6a80 100644
--- a/usr.bin/hexdump/hexdump.c
+++ b/usr.bin/hexdump/hexdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hexdump.c,v 1.4 1996/06/26 05:34:18 deraadt Exp $ */
+/* $OpenBSD: hexdump.c,v 1.5 2001/07/12 05:17:10 deraadt Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@@ -41,7 +41,7 @@ char copyright[] =
#ifndef lint
/*static char sccsid[] = "from: @(#)hexdump.c 5.5 (Berkeley) 6/1/90";*/
-static char rcsid[] = "$OpenBSD: hexdump.c,v 1.4 1996/06/26 05:34:18 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: hexdump.c,v 1.5 2001/07/12 05:17:10 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -54,6 +54,7 @@ int blocksize; /* data block size */
int exitval; /* final exit value */
int length = -1; /* max bytes to read */
+int
main(argc, argv)
int argc;
char **argv;
diff --git a/usr.bin/hexdump/hexsyntax.c b/usr.bin/hexdump/hexsyntax.c
index a0d6feb224a..000f3161ca9 100644
--- a/usr.bin/hexdump/hexsyntax.c
+++ b/usr.bin/hexdump/hexsyntax.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hexsyntax.c,v 1.3 1997/01/15 23:42:34 millert Exp $ */
+/* $OpenBSD: hexsyntax.c,v 1.4 2001/07/12 05:17:10 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -35,15 +35,19 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)hexsyntax.c 5.2 (Berkeley) 5/8/90";*/
-static char rcsid[] = "$OpenBSD: hexsyntax.c,v 1.3 1997/01/15 23:42:34 millert Exp $";
+static char rcsid[] = "$OpenBSD: hexsyntax.c,v 1.4 2001/07/12 05:17:10 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <stdio.h>
+#include <stdlib.h>
+#include <limits.h>
+#include <unistd.h>
#include "hexdump.h"
off_t skip; /* bytes to skip */
+void
newsyntax(argc, argvp)
int argc;
char ***argvp;
@@ -125,6 +129,7 @@ newsyntax(argc, argvp)
*argvp += optind;
}
+void
usage()
{
(void)fprintf(stderr,
diff --git a/usr.bin/hexdump/odsyntax.c b/usr.bin/hexdump/odsyntax.c
index 9a918c34da0..4cc87a4ed83 100644
--- a/usr.bin/hexdump/odsyntax.c
+++ b/usr.bin/hexdump/odsyntax.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: odsyntax.c,v 1.3 1997/01/15 23:42:34 millert Exp $ */
+/* $OpenBSD: odsyntax.c,v 1.4 2001/07/12 05:17:10 deraadt Exp $ */
/*-
* Copyright (c) 1990 The Regents of the University of California.
@@ -35,11 +35,12 @@
#ifndef lint
/*static char sccsid[] = "from: @(#)odsyntax.c 5.4 (Berkeley) 3/8/91";*/
-static char rcsid[] = "$OpenBSD: odsyntax.c,v 1.3 1997/01/15 23:42:34 millert Exp $";
+static char rcsid[] = "$OpenBSD: odsyntax.c,v 1.4 2001/07/12 05:17:10 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
#include <stdlib.h>
+#include <ctype.h>
#include <stdio.h>
#include "hexdump.h"
@@ -152,6 +153,7 @@ oldsyntax(argc, argvp)
#define ishexdigit(c) \
(c >= '0' && c <= '9' || c >= 'a' && c <= 'f' || c >= 'A' && c <= 'F')
+void
odoffset(argc, argvp)
int argc;
char ***argvp;
diff --git a/usr.bin/id/id.c b/usr.bin/id/id.c
index 705e72e6883..553f65acd7c 100644
--- a/usr.bin/id/id.c
+++ b/usr.bin/id/id.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: id.c,v 1.8 1999/08/18 12:23:01 aaron Exp $ */
+/* $OpenBSD: id.c,v 1.9 2001/07/12 05:17:11 deraadt Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -41,7 +41,7 @@ static char copyright[] =
#ifndef lint
/*static char sccsid[] = "@(#)id.c 8.3 (Berkeley) 4/28/95";*/
-static char rcsid[] = "$OpenBSD: id.c,v 1.8 1999/08/18 12:23:01 aaron Exp $";
+static char rcsid[] = "$OpenBSD: id.c,v 1.9 2001/07/12 05:17:11 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -172,16 +172,18 @@ pretty(pw)
else
(void)printf("uid\t%u\n", rid);
- if ((eid = geteuid()) != rid)
+ if ((eid = geteuid()) != rid) {
if ((pw = getpwuid(eid)))
(void)printf("euid\t%s\n", pw->pw_name);
else
(void)printf("euid\t%u\n", eid);
- if ((rid = getgid()) != (eid = getegid()))
+ }
+ if ((rid = getgid()) != (eid = getegid())) {
if ((gr = getgrgid(rid)))
(void)printf("rgid\t%s\n", gr->gr_name);
else
(void)printf("rgid\t%u\n", rid);
+ }
(void)printf("groups\t");
group(NULL, 1);
}
diff --git a/usr.bin/ipcs/ipcs.c b/usr.bin/ipcs/ipcs.c
index fb1475e3889..64134e79af6 100644
--- a/usr.bin/ipcs/ipcs.c
+++ b/usr.bin/ipcs/ipcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ipcs.c,v 1.12 2001/02/14 17:48:01 tholo Exp $ */
+/* $OpenBSD: ipcs.c,v 1.13 2001/07/12 05:17:11 deraadt Exp $ */
/* $NetBSD: ipcs.c,v 1.10.6.1 1996/06/07 01:53:47 thorpej Exp $ */
/*
@@ -42,6 +42,8 @@
#include <err.h>
#include <fcntl.h>
#include <kvm.h>
+#include <pwd.h>
+#include <grp.h>
#include <limits.h>
#include <nlist.h>
#include <paths.h>
@@ -131,7 +133,6 @@ main(argc, argv)
int display = SHMINFO | MSGINFO | SEMINFO;
int option = 0;
char *core = NULL, *namelist = NULL;
- char errbuf[_POSIX2_LINE_MAX];
int i;
while ((i = getopt(argc, argv, "MmQqSsabC:cN:optT")) != -1)
@@ -273,7 +274,7 @@ main(argc, argv)
cvt_time(msqptr->msg_rtime, rtime_buf);
cvt_time(msqptr->msg_ctime, ctime_buf);
- printf("q %6d %10d %s %8s %8s",
+ printf("q %6d %10ld %s %8s %8s",
IXSEQ_TO_IPCID(i, msqptr->msg_perm),
msqptr->msg_perm.key,
fmt_perm(msqptr->msg_perm.mode),
@@ -286,12 +287,12 @@ main(argc, argv)
group_from_gid(msqptr->msg_perm.cgid, 0));
if (option & OUTSTANDING)
- printf(" %6d %6d",
+ printf(" %6lu %6lu",
msqptr->msg_cbytes,
msqptr->msg_qnum);
if (option & BIGGEST)
- printf(" %6d",
+ printf(" %6lu",
msqptr->msg_qbytes);
if (option & PID)
@@ -372,7 +373,7 @@ main(argc, argv)
cvt_time(shmptr->shm_dtime, dtime_buf);
cvt_time(shmptr->shm_ctime, ctime_buf);
- printf("m %6d %10d %s %8s %8s",
+ printf("m %6d %10ld %s %8s %8s",
IXSEQ_TO_IPCID(i, shmptr->shm_perm),
shmptr->shm_perm.key,
fmt_perm(shmptr->shm_perm.mode),
@@ -469,12 +470,11 @@ main(argc, argv)
if ((xsema[i].sem_perm.mode & SEM_ALLOC) != 0) {
char ctime_buf[100], otime_buf[100];
struct semid_ds *semaptr = &xsema[i];
- int j, value;
cvt_time(semaptr->sem_otime, otime_buf);
cvt_time(semaptr->sem_ctime, ctime_buf);
- printf("s %6d %10d %s %8s %8s",
+ printf("s %6d %10ld %s %8s %8s",
IXSEQ_TO_IPCID(i, semaptr->sem_perm),
semaptr->sem_perm.key,
fmt_perm(semaptr->sem_perm.mode),
diff --git a/usr.bin/kdump/kdump.c b/usr.bin/kdump/kdump.c
index 70b7dc7d34a..ae4c1dd4c03 100644
--- a/usr.bin/kdump/kdump.c
+++ b/usr.bin/kdump/kdump.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: kdump.c,v 1.10 1999/09/25 19:35:47 kstailey Exp $ */
+/* $OpenBSD: kdump.c,v 1.11 2001/07/12 05:17:12 deraadt Exp $ */
/*-
* Copyright (c) 1988, 1993
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)kdump.c 8.4 (Berkeley) 4/28/95";
#endif
-static char *rcsid = "$OpenBSD: kdump.c,v 1.10 1999/09/25 19:35:47 kstailey Exp $";
+static char *rcsid = "$OpenBSD: kdump.c,v 1.11 2001/07/12 05:17:12 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -240,6 +240,7 @@ main(argc, argv)
}
}
+int
fread_tail(buf, size, num)
char *buf;
int num, size;
@@ -253,6 +254,7 @@ fread_tail(buf, size, num)
return (i);
}
+void
dumpheader(kth)
struct ktr_header *kth;
{
@@ -319,6 +321,7 @@ ioctldecode(cmd)
printf(")");
}
+void
ktrsyscall(ktr)
register struct ktr_syscall *ktr;
{
@@ -492,6 +495,7 @@ ktrgenio(ktr, len)
(void)printf("\"\n");
}
+void
ktrpsig(psig)
struct ktr_psig *psig;
{
@@ -503,6 +507,7 @@ ktrpsig(psig)
(u_long)psig->action, psig->mask, psig->code);
}
+void
ktrcsw(cs)
struct ktr_csw *cs;
{
@@ -510,6 +515,7 @@ ktrcsw(cs)
cs->user ? "user" : "kernel");
}
+void
usage()
{
@@ -518,6 +524,7 @@ usage()
exit(1);
}
+void
setemul(name)
char *name;
{
diff --git a/usr.bin/ktrace/ktrace.c b/usr.bin/ktrace/ktrace.c
index e7747debb42..a3aa28d606c 100644
--- a/usr.bin/ktrace/ktrace.c
+++ b/usr.bin/ktrace/ktrace.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ktrace.c,v 1.9 2000/06/30 16:00:15 millert Exp $ */
+/* $OpenBSD: ktrace.c,v 1.10 2001/07/12 05:17:13 deraadt Exp $ */
/* $NetBSD: ktrace.c,v 1.4 1995/08/31 23:01:44 jtc Exp $ */
/*-
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ktrace.c 8.2 (Berkeley) 4/28/95";
#endif
-static char *rcsid = "$OpenBSD: ktrace.c,v 1.9 2000/06/30 16:00:15 millert Exp $";
+static char *rcsid = "$OpenBSD: ktrace.c,v 1.10 2001/07/12 05:17:13 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -56,6 +56,7 @@ static char *rcsid = "$OpenBSD: ktrace.c,v 1.9 2000/06/30 16:00:15 millert Exp $
#include <err.h>
#include <fcntl.h>
+#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
@@ -64,12 +65,14 @@ static char *rcsid = "$OpenBSD: ktrace.c,v 1.9 2000/06/30 16:00:15 millert Exp $
void no_ktrace __P((int));
void usage __P((void));
+int
main(argc, argv)
int argc;
char **argv;
{
enum { NOTSET, CLEAR, CLEARALL } clear;
- int append, ch, fd, inherit, ops, pid, pidset, trpoints;
+ int append, ch, fd, inherit, ops, pidset, trpoints;
+ pid_t pid;
char *tracefile;
mode_t omask;
struct stat sb;
@@ -168,6 +171,7 @@ main(argc, argv)
exit(0);
}
+int
rpid(p)
char *p;
{
diff --git a/usr.bin/ktrace/subr.c b/usr.bin/ktrace/subr.c
index 6351577b5b0..5965c3c5789 100644
--- a/usr.bin/ktrace/subr.c
+++ b/usr.bin/ktrace/subr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: subr.c,v 1.2 1996/06/26 05:34:47 deraadt Exp $ */
+/* $OpenBSD: subr.c,v 1.3 2001/07/12 05:17:13 deraadt Exp $ */
/* $NetBSD: subr.c,v 1.6 1995/08/31 23:01:45 jtc Exp $ */
/*-
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)subr.c 8.2 (Berkeley) 4/28/95";
#endif
-static char *rcsid = "$OpenBSD: subr.c,v 1.2 1996/06/26 05:34:47 deraadt Exp $";
+static char *rcsid = "$OpenBSD: subr.c,v 1.3 2001/07/12 05:17:13 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -52,6 +52,7 @@ static char *rcsid = "$OpenBSD: subr.c,v 1.2 1996/06/26 05:34:47 deraadt Exp $";
#include "ktrace.h"
+int
getpoints(s)
char *s;
{
diff --git a/usr.bin/last/last.c b/usr.bin/last/last.c
index d6bd21e9c6a..383af2529b6 100644
--- a/usr.bin/last/last.c
+++ b/usr.bin/last/last.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: last.c,v 1.14 2001/02/06 22:10:09 fgsch Exp $ */
+/* $OpenBSD: last.c,v 1.15 2001/07/12 05:17:13 deraadt Exp $ */
/* $NetBSD: last.c,v 1.6 1994/12/24 16:49:02 cgd Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)last.c 8.2 (Berkeley) 4/2/94";
#endif
-static char rcsid[] = "$OpenBSD: last.c,v 1.14 2001/02/06 22:10:09 fgsch Exp $";
+static char rcsid[] = "$OpenBSD: last.c,v 1.15 2001/07/12 05:17:13 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -288,21 +288,21 @@ wtmp()
*/
if (want(bp, NO)) {
if (seconds) {
- printf("%-*.*s %-*.*s %-*.*s %ld \n",
- NAME_WIDTH, UT_NAMESIZE,
- bp->ut_name, UT_LINESIZE,
- UT_LINESIZE, bp->ut_line,
- HOST_WIDTH, UT_HOSTSIZE,
- bp->ut_host, bp->ut_time);
+ printf("%-*.*s %-*.*s %-*.*s %ld \n",
+ NAME_WIDTH, UT_NAMESIZE,
+ bp->ut_name, UT_LINESIZE,
+ UT_LINESIZE, bp->ut_line,
+ HOST_WIDTH, UT_HOSTSIZE,
+ bp->ut_host, bp->ut_time);
} else {
ct = ctime(&bp->ut_time);
- printf("%-*.*s %-*.*s %-*.*s %10.10s %*.*s \n",
- NAME_WIDTH, UT_NAMESIZE,
- bp->ut_name, UT_LINESIZE,
- UT_LINESIZE, bp->ut_line,
- HOST_WIDTH, UT_HOSTSIZE,
- bp->ut_host, ct, timesize,
- timesize, ct + 11);
+ printf("%-*.*s %-*.*s %-*.*s %10.10s %*.*s \n",
+ NAME_WIDTH, UT_NAMESIZE,
+ bp->ut_name, UT_LINESIZE,
+ UT_LINESIZE, bp->ut_line,
+ HOST_WIDTH, UT_HOSTSIZE,
+ bp->ut_host, ct, timesize,
+ timesize, ct + 11);
}
if (maxrec != -1 && !--maxrec)
return;
@@ -436,7 +436,7 @@ want(bp, check)
{
ARG *step;
- if (check)
+ if (check) {
/*
* when uucp and ftp log in over a network, the entry in
* the utmp file is the name plus their process id. See
@@ -446,6 +446,7 @@ want(bp, check)
bp->ut_line[3] = '\0';
else if (!strncmp(bp->ut_line, "uucp", sizeof("uucp") - 1))
bp->ut_line[4] = '\0';
+ }
if (snaptime) /* if snaptime is set, return NO */
return (NO);
diff --git a/usr.bin/lastcomm/lastcomm.c b/usr.bin/lastcomm/lastcomm.c
index 48c746939d4..48c592a1f45 100644
--- a/usr.bin/lastcomm/lastcomm.c
+++ b/usr.bin/lastcomm/lastcomm.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: lastcomm.c,v 1.6 1997/06/02 02:39:42 flipk Exp $ */
+/* $OpenBSD: lastcomm.c,v 1.7 2001/07/12 05:17:15 deraadt Exp $ */
/* $NetBSD: lastcomm.c,v 1.9 1995/10/22 01:43:42 ghudson Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)lastcomm.c 8.2 (Berkeley) 4/29/95";
#endif
-static char rcsid[] = "$OpenBSD: lastcomm.c,v 1.6 1997/06/02 02:39:42 flipk Exp $";
+static char rcsid[] = "$OpenBSD: lastcomm.c,v 1.7 2001/07/12 05:17:15 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -137,16 +137,17 @@ main(argc, argv)
{
t = expand(ab.ac_utime) + expand(ab.ac_stime);
(void)printf("%-*.*s %-7s %-*.*s %-*.*s %6.2f secs %.16s",
- fldsiz(acct, ac_comm), fldsiz(acct, ac_comm),
- ab.ac_comm, flagbits(ab.ac_flag), UT_NAMESIZE,
- UT_NAMESIZE, user_from_uid(ab.ac_uid, 0),
- UT_LINESIZE, UT_LINESIZE, getdev(ab.ac_tty),
- t / (double)AHZ, ctime(&ab.ac_btime));
+ (int)fldsiz(acct, ac_comm),
+ (int)fldsiz(acct, ac_comm),
+ ab.ac_comm, flagbits(ab.ac_flag), UT_NAMESIZE,
+ UT_NAMESIZE, user_from_uid(ab.ac_uid, 0),
+ UT_LINESIZE, UT_LINESIZE, getdev(ab.ac_tty),
+ t / (double)AHZ, ctime(&ab.ac_btime));
delta = expand(ab.ac_etime) / (double)AHZ;
- printf(" (%1.0lf:%02.0lf:%05.2lf)\n",
- delta / SECSPERHOUR,
- fmod(delta, SECSPERHOUR) / SECSPERMIN,
- fmod(delta, SECSPERMIN));
+ printf(" (%1.0lf:%02.0f:%05.2f)\n",
+ delta / SECSPERHOUR,
+ fmod(delta, SECSPERHOUR) / SECSPERMIN,
+ fmod(delta, SECSPERMIN));
}
if (size == 0)
diff --git a/usr.bin/tcopy/tcopy.c b/usr.bin/tcopy/tcopy.c
index 7964d9678fb..abb0d166731 100644
--- a/usr.bin/tcopy/tcopy.c
+++ b/usr.bin/tcopy/tcopy.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tcopy.c,v 1.5 2000/06/30 16:00:22 millert Exp $ */
+/* $OpenBSD: tcopy.c,v 1.6 2001/07/12 05:17:21 deraadt Exp $ */
/* $NetBSD: tcopy.c,v 1.5 1997/04/15 07:23:08 lukem Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)tcopy.c 8.3 (Berkeley) 1/23/95";
#endif
-static char rcsid[] = "$OpenBSD: tcopy.c,v 1.5 2000/06/30 16:00:22 millert Exp $";
+static char rcsid[] = "$OpenBSD: tcopy.c,v 1.6 2001/07/12 05:17:21 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -172,8 +172,8 @@ main(argc, argv)
fprintf(msg, "record %ld\n", lastrec);
}
if (nread != 0)
- fprintf(msg, "file %d: block size %d: ",
- filen, nread);
+ fprintf(msg, "file %d: block size %ld: ",
+ filen, (long)nread);
(void) fflush(stdout);
lastrec = record;
}
@@ -195,8 +195,8 @@ r1: guesslen = 0;
": %s", strerror(error));
else
fprintf(stderr,
- "write (%d) != read (%d)\n",
- nw, nread);
+ "write (%d) != read (%ld)\n",
+ nw, (long)nread);
fprintf(stderr, "copy aborted\n");
exit(5);
}
@@ -209,8 +209,8 @@ r1: guesslen = 0;
break;
}
fprintf(msg,
- "file %d: eof after %ld records: %qd bytes\n",
- filen, record, size);
+ "file %d: eof after %ld records: %lld bytes\n",
+ filen, record, (long long)size);
needeof = 1;
filen++;
tsize += size;
@@ -219,7 +219,7 @@ r1: guesslen = 0;
}
lastnread = nread;
}
- fprintf(msg, "total length: %qd bytes\n", tsize);
+ fprintf(msg, "total length: %lld bytes\n", (long long)tsize);
(void)signal(SIGINT, oldsig);
if (op == COPY || op == COPYVERIFY) {
writeop(outp, MTWEOF);
@@ -293,13 +293,14 @@ void
intr(signo)
int signo;
{
- if (record)
+ if (record) {
if (record - lastrec > 1)
fprintf(msg, "records %ld to %ld\n", lastrec, record);
else
fprintf(msg, "record %ld\n", lastrec);
+ }
fprintf(msg, "interrupt at file %d: record %ld\n", filen, record);
- fprintf(msg, "total length: %qd bytes\n", tsize + size);
+ fprintf(msg, "total length: %lld bytes\n", (long long)(tsize + size));
exit(1);
}
diff --git a/usr.bin/telnet/commands.c b/usr.bin/telnet/commands.c
index 7bef2df33cd..278df40709a 100644
--- a/usr.bin/telnet/commands.c
+++ b/usr.bin/telnet/commands.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: commands.c,v 1.36 2001/07/09 07:04:54 deraadt Exp $ */
+/* $OpenBSD: commands.c,v 1.37 2001/07/12 05:17:22 deraadt Exp $ */
/* $NetBSD: commands.c,v 1.14 1996/03/24 22:03:48 jtk Exp $ */
/*
@@ -2709,7 +2709,7 @@ help(argc, argv)
printf("Commands may be abbreviated. Commands are:\r\n\r\n");
for (c = cmdtab; c->name; c++)
if (c->help) {
- printf("%-*s\t%s\r\n", HELPINDENT, c->name,
+ printf("%-*s\t%s\r\n", (int)HELPINDENT, c->name,
c->help);
}
return 0;
diff --git a/usr.bin/time/time.c b/usr.bin/time/time.c
index 677b0575882..6e19fabc1d8 100644
--- a/usr.bin/time/time.c
+++ b/usr.bin/time/time.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: time.c,v 1.8 2001/06/13 17:43:38 art Exp $ */
+/* $OpenBSD: time.c,v 1.9 2001/07/12 05:17:23 deraadt Exp $ */
/* $NetBSD: time.c,v 1.7 1995/06/27 00:34:00 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)time.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: time.c,v 1.8 2001/06/13 17:43:38 art Exp $";
+static char rcsid[] = "$OpenBSD: time.c,v 1.9 2001/07/12 05:17:23 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -55,6 +55,7 @@ static char rcsid[] = "$OpenBSD: time.c,v 1.8 2001/06/13 17:43:38 art Exp $";
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
+#include <err.h>
#include <unistd.h>
#include <errno.h>
diff --git a/usr.bin/tip/aculib/biz22.c b/usr.bin/tip/aculib/biz22.c
index acfb291a4cf..768dfb75da7 100644
--- a/usr.bin/tip/aculib/biz22.c
+++ b/usr.bin/tip/aculib/biz22.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: biz22.c,v 1.4 1997/04/02 01:47:05 millert Exp $ */
+/* $OpenBSD: biz22.c,v 1.5 2001/07/12 05:17:24 deraadt Exp $ */
/* $NetBSD: biz22.c,v 1.6 1997/02/11 09:24:11 mrg Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)biz22.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: biz22.c,v 1.4 1997/04/02 01:47:05 millert Exp $";
+static char rcsid[] = "$OpenBSD: biz22.c,v 1.5 2001/07/12 05:17:24 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
@@ -97,8 +97,8 @@ biz_dialer(num, mod)
if (timeout) {
char line[80];
- (void)sprintf(line, "%d second dial timeout",
- number(value(DIALTIMEOUT)));
+ (void)sprintf(line, "%ld second dial timeout",
+ (long)number(value(DIALTIMEOUT)));
logent(value(HOST), num, "biz1022", line);
}
#endif
@@ -123,8 +123,6 @@ biz22f_dialer(num, acu)
biz22_disconnect()
{
- int rw = 2;
-
write(FD, DISCONNECT_CMD, 4);
sleep(2);
tcflush(FD, TCIOFLUSH);
diff --git a/usr.bin/tip/cmds.c b/usr.bin/tip/cmds.c
index 96f431b4e0a..9f894bc65ee 100644
--- a/usr.bin/tip/cmds.c
+++ b/usr.bin/tip/cmds.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cmds.c,v 1.9 2001/07/09 07:04:55 deraadt Exp $ */
+/* $OpenBSD: cmds.c,v 1.10 2001/07/12 05:17:23 deraadt Exp $ */
/* $NetBSD: cmds.c,v 1.7 1997/02/11 09:24:03 mrg Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: cmds.c,v 1.9 2001/07/09 07:04:55 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: cmds.c,v 1.10 2001/07/12 05:17:23 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
@@ -374,11 +374,12 @@ out:
stop_t = time(0);
fclose(fd);
signal(SIGINT, f);
- if (boolean(value(VERBOSE)))
+ if (boolean(value(VERBOSE))) {
if (boolean(value(RAWFTP)))
prtime(" chars transferred in ", stop_t-start_t);
else
prtime(" lines transferred in ", stop_t-start_t);
+ }
write(fildes[1], (char *)&ccc, 1);
tcsetattr(0, TCSAFLUSH, &term);
}
@@ -724,7 +725,7 @@ prtime(s, a)
char *s;
time_t a;
{
- register i;
+ register int i;
int nums[3];
for (i = 0; i < 3; i++) {
diff --git a/usr.bin/tip/log.c b/usr.bin/tip/log.c
index 25b7eaa8b10..791cf3bafb6 100644
--- a/usr.bin/tip/log.c
+++ b/usr.bin/tip/log.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: log.c,v 1.3 1997/09/01 23:24:25 deraadt Exp $ */
+/* $OpenBSD: log.c,v 1.4 2001/07/12 05:17:24 deraadt Exp $ */
/* $NetBSD: log.c,v 1.4 1994/12/24 17:56:28 cgd Exp $ */
/*
@@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: log.c,v 1.3 1997/09/01 23:24:25 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: log.c,v 1.4 2001/07/12 05:17:24 deraadt Exp $";
#endif /* not lint */
#include "tip.h"
@@ -63,11 +63,12 @@ logent(group, num, acu, message)
perror("tip: flock");
return;
}
- if ((user = getlogin()) == NOSTR)
+ if ((user = getlogin()) == NOSTR) {
if ((pwd = getpwuid(getuid())) == NOPWD)
user = "???";
else
user = pwd->pw_name;
+ }
t = time(0);
timestamp = ctime(&t);
timestamp[24] = '\0';
diff --git a/usr.bin/tip/remote.c b/usr.bin/tip/remote.c
index 5bccdeee7a6..a7d0b2d9749 100644
--- a/usr.bin/tip/remote.c
+++ b/usr.bin/tip/remote.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: remote.c,v 1.7 1997/09/07 12:23:59 provos Exp $ */
+/* $OpenBSD: remote.c,v 1.8 2001/07/12 05:17:24 deraadt Exp $ */
/* $NetBSD: remote.c,v 1.5 1997/04/20 00:02:45 mellon Exp $ */
/*
@@ -45,7 +45,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: remote.c,v 1.7 1997/09/07 12:23:59 provos Exp $";
+static char rcsid[] = "$OpenBSD: remote.c,v 1.8 2001/07/12 05:17:24 deraadt Exp $";
#endif /* not lint */
#include <stdio.h>
@@ -82,7 +82,7 @@ getremcap(host)
int stat;
rempath = getenv("REMOTE");
- if (rempath != NULL)
+ if (rempath != NULL) {
if (*rempath != '/')
/* we have an entry */
cgetset(rempath);
@@ -90,6 +90,7 @@ getremcap(host)
db_array[1] = rempath;
db_array[2] = _PATH_REMOTE;
}
+ }
if ((stat = cgetent(&bp, db_array, host)) < 0) {
if (DV ||
diff --git a/usr.bin/top/machine.c b/usr.bin/top/machine.c
index a15ec570f29..4389092911e 100644
--- a/usr.bin/top/machine.c
+++ b/usr.bin/top/machine.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: machine.c,v 1.24 2001/06/03 06:46:47 angelos Exp $ */
+/* $OpenBSD: machine.c,v 1.25 2001/07/12 05:17:26 deraadt Exp $ */
/*
* top - a top users display for Unix
@@ -47,7 +47,6 @@
#include <err.h>
#endif
-static int getkval __P((unsigned long, int *, int, char *));
static int swapmode __P((int *, int *));
#include "top.h"
@@ -95,10 +94,6 @@ char *state_abbrev[] = {
static int stathz;
-/* these are offsets obtained via nlist and used in the get_ functions */
-
-static unsigned long cp_time_offset;
-
/* these are for calculating cpu state percentages */
static long cp_time[CPUSTATES];
static long cp_old[CPUSTATES];
@@ -163,8 +158,7 @@ int
machine_init(statics)
struct statics *statics;
{
- char errbuf[_POSIX2_LINE_MAX];
- int pagesize, i = 0;
+ int pagesize;
stathz = getstathz();
if (stathz == -1)
diff --git a/usr.bin/ul/ul.c b/usr.bin/ul/ul.c
index b6d7c461eb6..ce7dce80a1e 100644
--- a/usr.bin/ul/ul.c
+++ b/usr.bin/ul/ul.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ul.c,v 1.5 2000/03/22 15:38:23 markus Exp $ */
+/* $OpenBSD: ul.c,v 1.6 2001/07/12 05:17:27 deraadt Exp $ */
/* $NetBSD: ul.c,v 1.3 1994/12/07 00:28:24 jtc Exp $ */
/*
@@ -44,12 +44,16 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)ul.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: ul.c,v 1.5 2000/03/22 15:38:23 markus Exp $";
+static char rcsid[] = "$OpenBSD: ul.c,v 1.6 2001/07/12 05:17:27 deraadt Exp $";
#endif /* not lint */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <unistd.h>
+#include <stdlib.h>
+#include <curses.h>
+#include <term.h>
#define IESC '\033'
#define SO '\016'
@@ -83,9 +87,25 @@ int halfpos;
int upln;
int iflag;
-int outchar();
-#define PRINT(s) if (s == NULL) /* void */; else tputs(s, 1, outchar)
-
+int outchar(int);
+void initcap(void);
+void initbuf(void);
+void mfilter(FILE *);
+void reverse(void);
+void fwd(void);
+void flushln(void);
+void msetmode(int);
+void outc(int);
+void overstrike(void);
+void iattr(void);
+
+#define PRINT(s) \
+ do { \
+ if (s) \
+ tputs(s, 1, outchar); \
+ } while (0)
+
+int
main(argc, argv)
int argc;
char **argv;
@@ -138,7 +158,7 @@ main(argc, argv)
must_overstrike = 1;
initbuf();
if (optind == argc)
- filter(stdin);
+ mfilter(stdin);
else for (; optind<argc; optind++) {
f = fopen(argv[optind],"r");
if (f == NULL) {
@@ -146,16 +166,17 @@ main(argc, argv)
exit(1);
}
- filter(f);
+ mfilter(f);
fclose(f);
}
exit(0);
}
-filter(f)
+void
+mfilter(f)
FILE *f;
{
- register c;
+ int c;
while ((c = getc(f)) != EOF && col < MAXBUF) switch(c) {
@@ -265,17 +286,17 @@ filter(f)
flushln();
}
+void
flushln()
{
- register lastmode;
- register i;
+ int lastmode, i;
int hadmodes = 0;
lastmode = NORMAL;
for (i=0; i<maxcol; i++) {
if (obuf[i].c_mode != lastmode) {
hadmodes++;
- setmode(obuf[i].c_mode);
+ msetmode(obuf[i].c_mode);
lastmode = obuf[i].c_mode;
}
if (obuf[i].c_char == '\0') {
@@ -287,7 +308,7 @@ flushln()
outc(obuf[i].c_char);
}
if (lastmode != NORMAL) {
- setmode(0);
+ msetmode(0);
}
if (must_overstrike && hadmodes)
overstrike();
@@ -304,6 +325,7 @@ flushln()
* For terminals that can overstrike, overstrike underlines and bolds.
* We don't do anything with halfline ups and downs, or Greek.
*/
+void
overstrike()
{
register int i;
@@ -341,6 +363,7 @@ overstrike()
}
}
+void
iattr()
{
register int i;
@@ -364,6 +387,7 @@ iattr()
putchar('\n');
}
+void
initbuf()
{
@@ -373,9 +397,10 @@ initbuf()
mode &= ALTSET;
}
+void
fwd()
{
- register oldcol, oldmax;
+ int oldcol, oldmax;
oldcol = col;
oldmax = maxcol;
@@ -384,6 +409,7 @@ fwd()
maxcol = oldmax;
}
+void
reverse()
{
upln++;
@@ -393,6 +419,7 @@ reverse()
upln++;
}
+void
initcap()
{
static char tcapbuf[512];
@@ -446,14 +473,17 @@ initcap()
must_use_uc = (UNDER_CHAR && !ENTER_UNDERLINE);
}
+int
outchar(c)
int c;
{
putchar(c & 0177);
+ return (0);
}
static int curmode = 0;
+void
outc(c)
int c;
{
@@ -464,12 +494,13 @@ outc(c)
}
}
-setmode(newmode)
+void
+msetmode(newmode)
int newmode;
{
if (!iflag) {
if (curmode != NORMAL && newmode != NORMAL)
- setmode(NORMAL);
+ msetmode(NORMAL);
switch (newmode) {
case NORMAL:
switch(curmode) {
diff --git a/usr.bin/uname/uname.c b/usr.bin/uname/uname.c
index ac2f0a09a0d..469a5f2aca5 100644
--- a/usr.bin/uname/uname.c
+++ b/usr.bin/uname/uname.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uname.c,v 1.4 1998/06/15 15:58:57 deraadt Exp $ */
+/* $OpenBSD: uname.c,v 1.5 2001/07/12 05:17:27 deraadt Exp $ */
/*
* Copyright (c) 1994 Winning Strategies, Inc.
@@ -32,7 +32,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: uname.c,v 1.4 1998/06/15 15:58:57 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: uname.c,v 1.5 2001/07/12 05:17:27 deraadt Exp $";
#endif /* not lint */
#include <sys/param.h>
@@ -139,7 +139,7 @@ main(argc, argv)
len = sizeof(buf);
if (sysctl(mib, 2, &buf, &len, NULL, 0) == -1)
err(1, "sysctl");
- printf("%.*s", len, buf);
+ printf("%.*s", (int)len, buf);
}
putchar('\n');
diff --git a/usr.bin/uniq/uniq.c b/usr.bin/uniq/uniq.c
index 82c0cfa572d..b1b0cd9c252 100644
--- a/usr.bin/uniq/uniq.c
+++ b/usr.bin/uniq/uniq.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uniq.c,v 1.6 2000/06/30 16:00:22 millert Exp $ */
+/* $OpenBSD: uniq.c,v 1.7 2001/07/12 05:17:28 deraadt Exp $ */
/* $NetBSD: uniq.c,v 1.7 1995/08/31 22:03:48 jtc Exp $ */
/*
@@ -47,7 +47,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)uniq.c 8.3 (Berkeley) 5/4/95";
#endif
-static char rcsid[] = "$OpenBSD: uniq.c,v 1.6 2000/06/30 16:00:22 millert Exp $";
+static char rcsid[] = "$OpenBSD: uniq.c,v 1.7 2001/07/12 05:17:28 deraadt Exp $";
#endif /* not lint */
#include <errno.h>
@@ -221,7 +221,7 @@ obsolete(argv)
int len;
char *ap, *p, *start;
- while (ap = *++argv) {
+ while ((ap = *++argv)) {
/* Return if "--" or not an option of any form. */
if (ap[0] != '-') {
if (ap[0] != '+')
diff --git a/usr.bin/uuencode/uuencode.c b/usr.bin/uuencode/uuencode.c
index 6bb2218e02c..d5091cd7ed5 100644
--- a/usr.bin/uuencode/uuencode.c
+++ b/usr.bin/uuencode/uuencode.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: uuencode.c,v 1.2 1996/06/26 05:42:24 deraadt Exp $ */
+/* $OpenBSD: uuencode.c,v 1.3 2001/07/12 05:17:28 deraadt Exp $ */
/* $NetBSD: uuencode.c,v 1.7 1994/11/17 07:41:15 jtc Exp $ */
/*-
@@ -42,7 +42,7 @@ char copyright[] =
#if 0
static char sccsid[] = "@(#)uuencode.c 8.2 (Berkeley) 4/2/94";
#endif
-static char rcsid[] = "$OpenBSD: uuencode.c,v 1.2 1996/06/26 05:42:24 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: uuencode.c,v 1.3 2001/07/12 05:17:28 deraadt Exp $";
#endif /* not lint */
/*
@@ -120,7 +120,7 @@ encode()
register char *p;
char buf[80];
- while (n = fread(buf, 1, 45, stdin)) {
+ while ((n = fread(buf, 1, 45, stdin))) {
ch = ENC(n);
if (putchar(ch) == EOF)
break;
diff --git a/usr.bin/vgrind/vfontedpr.c b/usr.bin/vgrind/vfontedpr.c
index fff7fa17776..9cf00d415b0 100644
--- a/usr.bin/vgrind/vfontedpr.c
+++ b/usr.bin/vgrind/vfontedpr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vfontedpr.c,v 1.3 1996/06/26 05:42:30 deraadt Exp $ */
+/* $OpenBSD: vfontedpr.c,v 1.4 2001/07/12 05:17:29 deraadt Exp $ */
/* $NetBSD: vfontedpr.c,v 1.4 1996/03/21 18:08:30 jtc Exp $ */
/*
@@ -44,7 +44,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)vfontedpr.c 8.1 (Berkeley) 6/6/93";
#endif
-static char rcsid[] = "$OpenBSD: vfontedpr.c,v 1.3 1996/06/26 05:42:30 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: vfontedpr.c,v 1.4 2001/07/12 05:17:29 deraadt Exp $";
#endif /* not lint */
#include <sys/types.h>
@@ -703,7 +703,7 @@ iskw(s)
while (++cp, isidchr(*cp))
i++;
- while (cp = *ss++)
+ while ((cp = *ss++))
if (!STRNCMP(s,cp,i) && !isidchr(cp[i]))
return (i);
return (0);
diff --git a/usr.bin/w/w.c b/usr.bin/w/w.c
index 70df624fa4f..1b8b7dbde29 100644
--- a/usr.bin/w/w.c
+++ b/usr.bin/w/w.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: w.c,v 1.33 2001/05/30 20:57:58 smart Exp $ */
+/* $OpenBSD: w.c,v 1.34 2001/07/12 05:17:31 deraadt Exp $ */
/*-
* Copyright (c) 1980, 1991, 1993, 1994
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)w.c 8.4 (Berkeley) 4/16/94";
#else
-static char *rcsid = "$OpenBSD: w.c,v 1.33 2001/05/30 20:57:58 smart Exp $";
+static char *rcsid = "$OpenBSD: w.c,v 1.34 2001/07/12 05:17:31 deraadt Exp $";
#endif
#endif /* not lint */
@@ -305,7 +305,7 @@ main(argc, argv)
}
}
- if (!nflag)
+ if (!nflag) {
if (gethostname(domain, sizeof(domain) - 1) < 0 ||
(p = strchr(domain, '.')) == 0)
domain[0] = '\0';
@@ -313,6 +313,7 @@ main(argc, argv)
domain[sizeof(domain) - 1] = '\0';
memmove(domain, p, strlen(p) + 1);
}
+ }
for (ep = ehead; ep != NULL; ep = ep->next) {
p = *ep->utmp.ut_host ? ep->utmp.ut_host : "-";
@@ -336,7 +337,7 @@ main(argc, argv)
}
if (x) {
(void)snprintf(buf, sizeof(buf), "%s:%.*s", p,
- ep->utmp.ut_host + UT_HOSTSIZE - x, x);
+ (int)(ep->utmp.ut_host + UT_HOSTSIZE - x), x);
p = buf;
}
(void)printf("%-*.*s %-2.2s %-*.*s ",
diff --git a/usr.bin/wc/wc.c b/usr.bin/wc/wc.c
index 2b267a1f51e..ec885181607 100644
--- a/usr.bin/wc/wc.c
+++ b/usr.bin/wc/wc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: wc.c,v 1.4 1999/02/02 03:48:34 millert Exp $ */
+/* $OpenBSD: wc.c,v 1.5 2001/07/12 05:17:31 deraadt Exp $ */
/*
* Copyright (c) 1980, 1987, 1991, 1993
@@ -43,7 +43,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)wc.c 8.2 (Berkeley) 5/2/95";
#else
-static char rcsid[] = "$OpenBSD: wc.c,v 1.4 1999/02/02 03:48:34 millert Exp $";
+static char rcsid[] = "$OpenBSD: wc.c,v 1.5 2001/07/12 05:17:31 deraadt Exp $";
#endif
#endif /* not lint */
@@ -252,11 +252,11 @@ print_counts(lines, words, chars, name)
{
if (doline)
- (void)printf(" %7qd", lines);
+ (void)printf(" %7lld", (long long)lines);
if (doword)
- (void)printf(" %7qd", words);
+ (void)printf(" %7lld", (long long)words);
if (dochar)
- (void)printf(" %7qd", chars);
+ (void)printf(" %7lld", (long long)chars);
(void)printf(" %s\n", name);
}
diff --git a/usr.bin/yacc/reader.c b/usr.bin/yacc/reader.c
index 18fdff56b78..ad85a9f379c 100644
--- a/usr.bin/yacc/reader.c
+++ b/usr.bin/yacc/reader.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: reader.c,v 1.6 1998/11/24 01:21:29 deraadt Exp $ */
+/* $OpenBSD: reader.c,v 1.7 2001/07/12 05:17:33 deraadt Exp $ */
/* $NetBSD: reader.c,v 1.5 1996/03/19 03:21:43 jtc Exp $ */
@@ -82,6 +82,7 @@ char *name_pool;
char line_format[] = "#line %d \"%s\"\n";
+void
cachec(c)
int c;
{
@@ -97,6 +98,7 @@ int c;
}
+void
get_line()
{
register FILE *f = input_file;
@@ -161,6 +163,7 @@ dup_line()
}
+void
skip_comment()
{
register char *s;
@@ -318,6 +321,7 @@ keyword()
}
+void
copy_ident()
{
register int c;