-/* $OpenBSD: cat.c,v 1.6 1996/09/28 20:52:50 imp Exp $ */
+/* $OpenBSD: cat.c,v 1.7 1996/12/14 12:17:33 mickey Exp $ */
/* $NetBSD: cat.c,v 1.11 1995/09/07 06:12:54 jtc Exp $ */
/*
#if 0
static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95";
#else
-static char rcsid[] = "$OpenBSD: cat.c,v 1.6 1996/09/28 20:52:50 imp Exp $";
+static char rcsid[] = "$OpenBSD: cat.c,v 1.7 1996/12/14 12:17:33 mickey Exp $";
#endif
#endif /* not lint */
err(1, "%s", filename);
bsize = MAX(sbuf.st_blksize, 1024);
if ((buf = malloc((u_int)bsize)) == NULL)
- err(1, NULL);
+ err(1, "buffer");
}
while ((nr = read(rfd, buf, bsize)) > 0)
for (off = 0; nr; nr -= nw, off += nw)
-/* $OpenBSD: chio.c,v 1.4 1996/11/02 03:47:10 deraadt Exp $ */
+/* $OpenBSD: chio.c,v 1.5 1996/12/14 12:17:35 mickey Exp $ */
/* $NetBSD: chio.c,v 1.1.1.1 1996/04/03 00:34:38 thorpej Exp $ */
/*
char **argv;
{
int ch, i;
- char *cp;
while ((ch = getopt(argc, argv, "f:")) != -1) {
switch (ch) {
struct changer_params data;
u_int8_t *statusp;
int i, count, chet, schet, echet;
- char *cmdname, *description;
+ char *description;
+
+#ifdef lint
+ count = 0;
+ description = NULL;
+#endif
/*
* On a status command, we expect the following:
-/* $OpenBSD: chmod.c,v 1.3 1996/08/02 12:40:50 deraadt Exp $ */
+/* $OpenBSD: chmod.c,v 1.4 1996/12/14 12:17:37 mickey Exp $ */
/* $NetBSD: chmod.c,v 1.12 1995/03/21 09:02:09 cgd Exp $ */
/*
#if 0
static char sccsid[] = "@(#)chmod.c 8.8 (Berkeley) 4/1/94";
#else
-static char rcsid[] = "$OpenBSD: chmod.c,v 1.3 1996/08/02 12:40:50 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: chmod.c,v 1.4 1996/12/14 12:17:37 mickey Exp $";
#endif
#endif /* not lint */
int oct, omode;
int Hflag, Lflag, Pflag, Rflag, ch, fflag, fts_options, hflag, rval;
char *ep, *mode;
-
+#ifdef lint
+ set = NULL;
+ omode = 0;
+#endif
Hflag = Lflag = Pflag = Rflag = fflag = hflag = 0;
while ((ch = getopt(argc, argv, "HLPRXfgorstuwx")) != -1)
switch (ch) {
-/* $OpenBSD: cp.c,v 1.4 1996/10/28 02:55:05 tholo Exp $ */
+/* $OpenBSD: cp.c,v 1.5 1996/12/14 12:17:38 mickey Exp $ */
/* $NetBSD: cp.c,v 1.14 1995/09/07 06:14:51 jtc Exp $ */
/*
#if 0
static char sccsid[] = "@(#)cp.c 8.5 (Berkeley) 4/29/95";
#else
-static char rcsid[] = "$OpenBSD: cp.c,v 1.4 1996/10/28 02:55:05 tholo Exp $";
+static char rcsid[] = "$OpenBSD: cp.c,v 1.5 1996/12/14 12:17:38 mickey Exp $";
#endif
#endif /* not lint */
FTSENT *curr;
int base, dne, nlen, rval;
char *p, *target_mid;
-
+#ifdef lint
+ base = 0;
+#endif
if ((ftsp = fts_open(argv, fts_options, mastercmp)) == NULL)
err(1, NULL);
for (rval = 0; (curr = fts_read(ftsp)) != NULL;) {
-/* $OpenBSD: alloc.c,v 1.2 1996/06/23 14:19:12 deraadt Exp $ */
+/* $OpenBSD: alloc.c,v 1.3 1996/12/14 12:17:40 mickey Exp $ */
/* $NetBSD: alloc.c,v 1.6 1995/03/21 09:02:23 cgd Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)alloc.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: alloc.c,v 1.2 1996/06/23 14:19:12 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: alloc.c,v 1.3 1996/12/14 12:17:40 mickey Exp $";
#endif
#endif /* not lint */
struct command *t;
{
memtop = (char *) sbrk(0);
- (void) fprintf(cshout, "Allocated memory from 0x%lx to 0x%lx (%ld).\n",
+ (void) fprintf(cshout, "Allocated memory from 0x%lx to 0x%lx (%d).\n",
(unsigned long) membot, (unsigned long) memtop, memtop - membot);
}
-/* $OpenBSD: printf.c,v 1.4 1996/09/15 22:00:26 millert Exp $ */
+/* $OpenBSD: printf.c,v 1.5 1996/12/14 12:17:41 mickey Exp $ */
/* $NetBSD: printf.c,v 1.6 1995/03/21 09:03:15 cgd Exp $ */
/*
* SUCH DAMAGE.
*/
-#if !defined(BUILTIN) && !defined(SHELL)
+#if !defined(BUILTIN)
#ifndef lint
static char copyright[] =
"@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)printf.c 8.1 (Berkeley) 7/20/93";
#else
-static char rcsid[] = "$OpenBSD: printf.c,v 1.4 1996/09/15 22:00:26 millert Exp $";
+static char rcsid[] = "$OpenBSD: printf.c,v 1.5 1996/12/14 12:17:41 mickey Exp $";
#endif
#endif /* not lint */
#include <sys/types.h>
-#include <err.h>
#include <errno.h>
#include <limits.h>
-#ifdef SHELL
-#define EOF -1
-#else
#include <stdio.h>
-#endif
#include <stdlib.h>
#include <string.h>
-
-/*
- * XXX
- * This *has* to go away. TK.
- */
-#ifdef SHELL
-#define main printfcmd
-#define warnx(a, b, c) { \
- char buf[64]; \
- (void)snprintf(buf, sizeof(buf), a, b, c); \
- error(buf); \
-}
-#include "../../bin/sh/bltin/bltin.h"
-#endif
+#include <err.h>
#define PF(f, func) { \
if (fieldwidth) \
register char *store;
register int value, c;
- for (store = fmt; c = *fmt; ++fmt, ++store) {
+ for (store = fmt; (c = *fmt) != 0; ++fmt, ++store) {
if (c != '\\') {
*store = c;
continue;
-/* $OpenBSD: proc.c,v 1.2 1996/06/23 14:19:28 deraadt Exp $ */
+/* $OpenBSD: proc.c,v 1.3 1996/12/14 12:17:42 mickey Exp $ */
/* $NetBSD: proc.c,v 1.9 1995/04/29 23:21:33 mycroft Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)proc.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: proc.c,v 1.2 1996/06/23 14:19:28 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: proc.c,v 1.3 1996/12/14 12:17:42 mickey Exp $";
#endif
#endif /* not lint */
#else
# include <varargs.h>
#endif
+#include <err.h>
#include "csh.h"
#include "dir.h"
}
if (np)
return (np);
- stderror(ERR_NAME | cp[1] == '?' ? ERR_JOBPAT : ERR_NOSUCHJOB);
+ stderror(ERR_NAME | (cp[1] == '?' ? ERR_JOBPAT : ERR_NOSUCHJOB));
/* NOTREACHED */
return (0);
}
-/* $OpenBSD: time.c,v 1.2 1996/06/23 14:19:31 deraadt Exp $ */
+/* $OpenBSD: time.c,v 1.3 1996/12/14 12:17:44 mickey Exp $ */
/* $NetBSD: time.c,v 1.7 1995/03/21 13:55:25 mycroft Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)time.c 8.1 (Berkeley) 5/31/93";
#else
-static char rcsid[] = "$OpenBSD: time.c,v 1.2 1996/06/23 14:19:31 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: time.c,v 1.3 1996/12/14 12:17:44 mickey Exp $";
#endif
#endif /* not lint */
struct timeval td;
timersub(t1, t0, &td);
- (void) fprintf(cshout, "%d.%01d", td.tv_sec, td.tv_usec / 100000);
+ (void) fprintf(cshout, "%ld.%01ld", td.tv_sec, td.tv_usec / 100000);
}
#define P2DIG(i) (void) fprintf(cshout, "%d%d", (i) / 10, (i) % 10)
-/* $OpenBSD: netdate.c,v 1.4 1996/08/26 23:31:26 deraadt Exp $ */
+/* $OpenBSD: netdate.c,v 1.5 1996/12/14 12:17:45 mickey Exp $ */
/* $NetBSD: netdate.c,v 1.10 1995/09/07 06:21:06 jtc Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)netdate.c 8.2 (Berkeley) 4/28/95";
#else
-static char rcsid[] = "$OpenBSD: netdate.c,v 1.4 1996/08/26 23:31:26 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: netdate.c,v 1.5 1996/12/14 12:17:45 mickey Exp $";
#endif
#endif /* not lint */
#include <stdio.h>
#include <string.h>
#include <unistd.h>
+#include <rpc/rpc.h> /* bindresvport() proto */
#include "extern.h"
-/* $OpenBSD: args.c,v 1.4 1996/06/23 14:19:45 deraadt Exp $ */
+/* $OpenBSD: args.c,v 1.5 1996/12/14 12:17:47 mickey Exp $ */
/* $NetBSD: args.c,v 1.7 1996/03/01 01:18:58 jtc Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)args.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: args.c,v 1.4 1996/06/23 14:19:45 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: args.c,v 1.5 1996/12/14 12:17:47 mickey Exp $";
#endif
#endif /* not lint */
in.dbsz = out.dbsz = 512;
- while (oper = *++argv) {
+ while ((oper = *++argv) != NULL) {
oper = strdup(oper);
if ((arg = strchr(oper, '=')) == NULL)
errx(1, "unknown operand %s", oper);
-/* $OpenBSD: conv.c,v 1.3 1996/06/23 14:19:46 deraadt Exp $ */
+/* $OpenBSD: conv.c,v 1.4 1996/12/14 12:17:48 mickey Exp $ */
/* $NetBSD: conv.c,v 1.6 1996/02/20 19:29:02 jtc Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)conv.c 8.3 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: conv.c,v 1.3 1996/06/23 14:19:46 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: conv.c,v 1.4 1996/12/14 12:17:48 mickey Exp $";
#endif
#endif /* not lint */
u_char *inp;
const u_char *t;
- if (t = ctab)
+ if ((t = ctab) != NULL)
for (inp = in.dbp - (cnt = in.dbrcnt); cnt--; ++inp)
*inp = t[*inp];
block()
{
static int intrunc;
- int ch, cnt, maxlen;
+ int ch = -1, cnt, maxlen;
u_char *inp, *outp;
const u_char *t;
*/
for (inp = in.dbp - in.dbcnt, outp = out.dbp; in.dbcnt;) {
maxlen = MIN(cbsz, in.dbcnt);
- if (t = ctab)
+ if ((t = ctab) != NULL)
for (cnt = 0;
cnt < maxlen && (ch = *inp++) != '\n'; ++cnt)
*outp++ = t[ch];
const u_char *t;
/* Translation and case conversion. */
- if (t = ctab)
+ if ((t = ctab) != NULL)
for (cnt = in.dbrcnt, inp = in.dbp; cnt--;)
*--inp = t[*inp];
/*
-/* $OpenBSD: dd.c,v 1.3 1996/06/23 14:19:47 deraadt Exp $ */
+/* $OpenBSD: dd.c,v 1.4 1996/12/14 12:17:49 mickey Exp $ */
/* $NetBSD: dd.c,v 1.6 1996/02/20 19:29:06 jtc Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)dd.c 8.5 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: dd.c,v 1.3 1996/06/23 14:19:47 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: dd.c,v 1.4 1996/12/14 12:17:49 mickey Exp $";
#endif
#endif /* not lint */
*/
if (!(ddflags & (C_BLOCK|C_UNBLOCK))) {
if ((in.db = malloc(out.dbsz + in.dbsz - 1)) == NULL)
- err(1, NULL);
+ err(1, "input buffer");
out.db = in.db;
} else if ((in.db =
malloc((u_int)(MAX(in.dbsz, cbsz) + cbsz))) == NULL ||
(out.db = malloc((u_int)(out.dbsz + cbsz))) == NULL)
- err(1, NULL);
+ err(1, "output buffer");
in.dbp = in.db;
out.dbp = out.db;
* Truncate the output file; ignore errors because it fails on some
* kinds of output files, tapes, for example.
*/
- if (ddflags & (C_OF | C_SEEK | C_NOTRUNC) == (C_OF | C_SEEK))
+ if ((ddflags & (C_OF | C_SEEK | C_NOTRUNC)) == (C_OF | C_SEEK))
(void)ftruncate(out.fd, (off_t)out.offset * out.dbsz);
/*
-/* $OpenBSD: misc.c,v 1.2 1996/06/23 14:19:49 deraadt Exp $ */
+/* $OpenBSD: misc.c,v 1.3 1996/12/14 12:17:50 mickey Exp $ */
/* $NetBSD: misc.c,v 1.4 1995/03/21 09:04:10 cgd Exp $ */
/*-
#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/23 14:19:49 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: misc.c,v 1.3 1996/12/14 12:17:50 mickey Exp $";
#endif
#endif /* not lint */
secs = 1;
/* Use snprintf(3) so that we don't reenter stdio(3). */
(void)snprintf(buf, sizeof(buf),
- "%u+%u records in\n%u+%u records out\n",
+ "%lu+%lu records in\n%lu+%lu records out\n",
st.in_full, st.in_part, st.out_full, st.out_part);
(void)write(STDERR_FILENO, buf, strlen(buf));
if (st.swab) {
- (void)snprintf(buf, sizeof(buf), "%u odd length swab %s\n",
+ (void)snprintf(buf, sizeof(buf), "%lu odd length swab %s\n",
st.swab, (st.swab == 1) ? "block" : "blocks");
(void)write(STDERR_FILENO, buf, strlen(buf));
}
if (st.trunc) {
- (void)snprintf(buf, sizeof(buf), "%u truncated %s\n",
+ (void)snprintf(buf, sizeof(buf), "%lu truncated %s\n",
st.trunc, (st.trunc == 1) ? "block" : "blocks");
(void)write(STDERR_FILENO, buf, strlen(buf));
}
(void)snprintf(buf, sizeof(buf),
- "%u bytes transferred in %u secs (%u bytes/sec)\n",
+ "%lu bytes transferred in %lu secs (%lu bytes/sec)\n",
st.bytes, secs, st.bytes / secs);
(void)write(STDERR_FILENO, buf, strlen(buf));
}
-/* $OpenBSD: df.c,v 1.5 1996/12/07 09:09:06 deraadt Exp $ */
+/* $OpenBSD: df.c,v 1.6 1996/12/14 12:17:52 mickey Exp $ */
/* $NetBSD: df.c,v 1.21.2.1 1995/11/01 00:06:11 jtc Exp $ */
/*
#if 0
static char sccsid[] = "@(#)df.c 8.7 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: df.c,v 1.5 1996/12/07 09:09:06 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: df.c,v 1.6 1996/12/14 12:17:52 mickey Exp $";
#endif
#endif /* not lint */
which = IN_LIST;
/* Count the number of types. */
- for (i = 1, nextcp = fslist; nextcp = strchr(nextcp, ','); i++)
+ for (i = 1, nextcp = fslist; (nextcp = strchr(nextcp, ',')) != NULL; i++)
++nextcp;
/* Build an array of that many types. */
if ((av = typelist = malloc((i + 1) * sizeof(char *))) == NULL)
err(1, NULL);
av[0] = fslist;
- for (i = 1, nextcp = fslist; nextcp = strchr(nextcp, ','); i++) {
+ for (i = 1, nextcp = fslist; (nextcp = strchr(nextcp, ',')) != NULL; i++) {
*nextcp = '\0';
av[i] = ++nextcp;
}
-/* $OpenBSD: glbl.c,v 1.4 1996/10/12 19:38:34 millert Exp $ */
+/* $OpenBSD: glbl.c,v 1.5 1996/12/14 12:17:53 mickey Exp $ */
/* $NetBSD: glbl.c,v 1.2 1995/03/21 09:04:41 cgd Exp $ */
/* glob.c: This file contains the global command routines for the ed line
#if 0
static char *rcsid = "@(#)glob.c,v 1.1 1994/02/01 00:34:40 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: glbl.c,v 1.4 1996/10/12 19:38:34 millert Exp $";
+static char rcsid[] = "$OpenBSD: glbl.c,v 1.5 1996/12/14 12:17:53 mickey Exp $";
#endif
#endif /* not lint */
for (; *ibufp;)
if ((status = extract_addr_range()) < 0 ||
(status = exec_command()) < 0 ||
- status > 0 && (status = display_lines(
- current_addr, current_addr, status)) < 0)
+ (status > 0 && (status = display_lines(
+ current_addr, current_addr, status)) < 0))
return status;
}
return 0;
-/* $OpenBSD: io.c,v 1.5 1996/12/12 12:37:53 mickey Exp $ */
+/* $OpenBSD: io.c,v 1.6 1996/12/14 12:17:54 mickey Exp $ */
/* $NetBSD: io.c,v 1.2 1995/03/21 09:04:43 cgd Exp $ */
/* io.c: This file contains the i/o routines for the ed line editor */
#if 0
static char *rcsid = "@(#)io.c,v 1.1 1994/02/01 00:34:41 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: io.c,v 1.5 1996/12/12 12:37:53 mickey Exp $";
+static char rcsid[] = "$OpenBSD: io.c,v 1.6 1996/12/14 12:17:54 mickey Exp $";
#endif
#endif /* not lint */
return ERR;
if (appended && size && o_isbinary && o_newline_added)
fputs("newline inserted\n", stderr);
- else if (newline_added && (!appended || !isbinary && !o_isbinary))
+ else if (newline_added && (!appended || (!isbinary && !o_isbinary)))
fputs("newline appended\n", stderr);
if (isbinary && newline_added && !appended)
size += 1;
register int c;
register int i = 0;
- while (((c = des ? get_des_char(fp) : getc(fp)) != EOF || !feof(fp) &&
- !ferror(fp)) && c != '\n') {
+ while (((c = des ? get_des_char(fp) : getc(fp)) != EOF || (!feof(fp) &&
+ !ferror(fp) && c != '\n'))) {
REALLOC(sbuf, sbufsz, i + 1, ERR);
if (!(sbuf[i++] = c))
isbinary = 1;
int gflag;
{
int col = 0;
+#ifndef BACKWARDS
int lc = 0;
+#endif
char *cp;
if (gflag & GNP) {
-/* $OpenBSD: main.c,v 1.4 1996/10/12 19:38:38 millert Exp $ */
+/* $OpenBSD: main.c,v 1.5 1996/12/14 12:17:56 mickey Exp $ */
/* $NetBSD: main.c,v 1.3 1995/03/21 09:04:44 cgd Exp $ */
/* main.c: This file contains the main control and user-interface routines
#if 0
static char *rcsid = "@(#)main.c,v 1.1 1994/02/01 00:34:42 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.4 1996/10/12 19:38:38 millert Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.5 1996/12/14 12:17:56 mickey Exp $";
#endif
#endif /* not lint */
#ifdef _POSIX_SOURCE
if (status = sigsetjmp(env, 1))
#else
- if (status = setjmp(env))
+ if ((status = setjmp(env)) != 0)
#endif
{
fputs("\n?\n", stderr);
isglobal = 0;
if ((status = extract_addr_range()) >= 0 &&
(status = exec_command()) >= 0)
- if (!status || status &&
+ if (!status || (status &&
(status = display_lines(current_addr, current_addr,
- status)) >= 0)
+ status)) >= 0))
continue;
switch (status) {
case EOF:
return ERR;
else if (build_active_list(c == 'g' || c == 'G') < 0)
return ERR;
- else if (n = (c == 'G' || c == 'V'))
+ else if ((n = (c == 'G' || c == 'V')))
GET_COMMAND_SUFFIX();
isglobal++;
if (exec_global(n, gflag) < 0)
break;
case '=':
GET_COMMAND_SUFFIX();
- printf("%d\n", addr_cnt ? second_addr : addr_last);
+ printf("%ld\n", addr_cnt ? second_addr : addr_last);
break;
case '!':
if (addr_cnt > 0) {
if (!pat) return ERR;
do {
- if (n = dir ? INC_MOD(n, addr_last) : DEC_MOD(n, addr_last)) {
+ if ((n = dir ? INC_MOD(n, addr_last) : DEC_MOD(n, addr_last))) {
lp = get_addressed_line_node(n);
if ((s = get_sbuf_line(lp)) == NULL)
return ERR;
REALLOC(file, filesz, MAXPATHLEN + 1, NULL);
/* assert: no trailing escape */
- while (file[i++] = (*s == '\\') ? *++s : *s)
+ while ((file[i++] = (*s == '\\') ? *++s : *s) != '\0')
s++;
return file;
}
-/* $OpenBSD: re.c,v 1.4 1996/10/12 19:38:40 millert Exp $ */
+/* $OpenBSD: re.c,v 1.5 1996/12/14 12:17:57 mickey Exp $ */
/* $NetBSD: re.c,v 1.14 1995/03/21 09:04:48 cgd Exp $ */
/* re.c: This file contains the regular expression interface routines for
#if 0
static char *rcsid = "@(#)re.c,v 1.6 1994/02/01 00:34:43 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: re.c,v 1.4 1996/10/12 19:38:40 millert Exp $";
+static char rcsid[] = "$OpenBSD: re.c,v 1.5 1996/12/14 12:17:57 mickey Exp $";
#endif
#endif /* not lint */
return NULL;
}
patlock = 0;
- if (n = regcomp(exp, exps, 0)) {
+ if ((n = regcomp(exp, exps, 0)) != 0) {
regerror(n, exp, errmsg, sizeof errmsg);
free(exp);
return exp = NULL;
-/* $OpenBSD: sub.c,v 1.4 1996/10/12 19:38:42 millert Exp $ */
+/* $OpenBSD: sub.c,v 1.5 1996/12/14 12:17:58 mickey Exp $ */
/* $NetBSD: sub.c,v 1.4 1995/03/21 09:04:50 cgd Exp $ */
/* sub.c: This file contains the substitution routines for the ed
#if 0
static char *rcsid = "@(#)sub.c,v 1.1 1994/02/01 00:34:44 alm Exp";
#else
-static char rcsid[] = "$OpenBSD: sub.c,v 1.4 1996/10/12 19:38:42 millert Exp $";
+static char rcsid[] = "$OpenBSD: sub.c,v 1.5 1996/12/14 12:17:58 mickey Exp $";
#endif
#endif /* not lint */
;
else if (!isglobal) {
while ((n = get_tty_line()) == 0 ||
- n > 0 && ibuf[n - 1] != '\n')
+ (n > 0 && ibuf[n - 1] != '\n'))
clearerr(stdin);
if (n < 0)
return NULL;
off += i;
}
txt += rm[0].rm_eo;
- } while (*txt && (!changed || (gflag & GSG) && rm[0].rm_eo) &&
+ } while (*txt && (!changed || ((gflag & GSG) && rm[0].rm_eo)) &&
!regexec(pat, txt, SE_MAX, rm, REG_NOTBOL));
i = eot - txt;
REALLOC(rbuf, rbufsz, off + i + 2, ERR);
-/* $OpenBSD: expr.c,v 1.4 1996/09/15 22:27:38 millert Exp $ */
+/* $OpenBSD: expr.c,v 1.5 1996/12/14 12:17:59 mickey Exp $ */
/* $NetBSD: expr.c,v 1.3.6.1 1996/06/04 20:41:47 cgd Exp $ */
/*
return;
}
-void
+__dead void
error()
{
errx(2, "syntax error");
{
struct val *l, *r;
enum token op;
- int v, li, ri;
+ int v = 0, li, ri;
l = eval3();
while ((op = token) == EQ || op == NE || op == LT || op == GT || op == LE || op == GE) {
case NE:
v = (li != ri);
break;
+ default:
+ break;
}
} else {
to_string(l);
case NE:
v = (strcoll(l->u.s, r->u.s) != 0);
break;
+ default:
+ break;
}
}
-/* $OpenBSD: edit.c,v 1.3 1996/10/01 02:05:33 downsj Exp $ */
+/* $OpenBSD: edit.c,v 1.4 1996/12/14 12:18:07 mickey Exp $ */
/*
* Command line editing - common code
# include <sys/stream.h> /* needed for <sys/ptem.h> */
# include <sys/ptem.h> /* needed for struct winsize */
#endif /* OS_SCO */
+#include <sys/ioctl.h>
#include <ctype.h>
#include "ksh_stat.h"
-/* $OpenBSD: ln.c,v 1.3 1996/08/02 12:40:56 deraadt Exp $ */
+/* $OpenBSD: ln.c,v 1.4 1996/12/14 12:18:01 mickey Exp $ */
/* $NetBSD: ln.c,v 1.10 1995/03/21 09:06:10 cgd Exp $ */
/*
#if 0
static char sccsid[] = "@(#)ln.c 8.2 (Berkeley) 3/31/94";
#else
-static char rcsid[] = "$OpenBSD: ln.c,v 1.3 1996/08/02 12:40:56 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ln.c,v 1.4 1996/12/14 12:18:01 mickey Exp $";
#endif
#endif /* not lint */
}
/* If the source is a directory, append the target's name. */
- if (isdir || !stat(source, &sb) && S_ISDIR(sb.st_mode)) {
+ if (isdir || (!stat(source, &sb) && S_ISDIR(sb.st_mode))) {
if ((p = strrchr(target, '/')) == NULL)
p = target;
else
* If the file exists, and -f was specified, unlink it.
* Attempt the link.
*/
- if (fflag && unlink(source) < 0 && errno != ENOENT ||
+ if ((fflag && unlink(source) < 0 && errno != ENOENT) ||
(*linkf)(target, source)) {
warn("%s", source);
return (1);
-/* $OpenBSD: ls.c,v 1.4 1996/08/02 12:40:57 deraadt Exp $ */
+/* $OpenBSD: ls.c,v 1.5 1996/12/14 12:18:03 mickey Exp $ */
/* $NetBSD: ls.c,v 1.16 1996/02/14 05:58:53 jtc Exp $ */
/*
#if 0
static char sccsid[] = "@(#)ls.c 8.7 (Berkeley) 8/5/94";
#else
-static char rcsid[] = "$OpenBSD: ls.c,v 1.4 1996/08/02 12:40:57 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ls.c,v 1.5 1996/12/14 12:18:03 mickey Exp $";
#endif
#endif /* not lint */
int entries, needstats;
char *user, *group, *flags, buf[20]; /* 32 bits == 10 digits */
+#ifdef lint
+ flags = NULL;
+#endif
+
/*
* If list is NULL there are two possibilities: that the parent
* directory p has no children, or that fts_children() returned an
-/* $OpenBSD: print.c,v 1.3 1996/08/02 11:45:01 deraadt Exp $ */
+/* $OpenBSD: print.c,v 1.4 1996/12/14 12:18:04 mickey Exp $ */
/* $NetBSD: print.c,v 1.14 1995/09/07 06:43:00 jtc Exp $ */
/*
#if 0
static char sccsid[] = "@(#)print.c 8.5 (Berkeley) 7/28/94";
#else
-static char rcsid[] = "$OpenBSD: print.c,v 1.3 1996/08/02 11:45:01 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: print.c,v 1.4 1996/12/14 12:18:04 mickey Exp $";
#endif
#endif /* not lint */
continue;
sp = p->fts_statp;
if (f_inode)
- (void)printf("%*lu ", dp->s_inode, sp->st_ino);
+ (void)printf("%*u ", dp->s_inode, sp->st_ino);
if (f_size)
(void)printf("%*qd ",
dp->s_block, howmany(sp->st_blocks, blocksize));
dp->s_block);
if ((base += numrows) >= num)
break;
- while ((cnt = (chcnt + TAB & ~(TAB - 1))) <= endcol) {
+ while ((cnt = (chcnt + (TAB & ~(TAB - 1)))) <= endcol) {
(void)putchar('\t');
chcnt = cnt;
}
sp = p->fts_statp;
chcnt = 0;
if (f_inode)
- chcnt += printf("%*lu ", (int)inodefield, sp->st_ino);
+ chcnt += printf("%*u ", (int)inodefield, sp->st_ino);
if (f_size)
chcnt += printf("%*qd ",
(int)sizefield, howmany(sp->st_blocks, blocksize));
-/* $OpenBSD: mv.c,v 1.4 1996/08/02 12:41:00 deraadt Exp $ */
+/* $OpenBSD: mv.c,v 1.5 1996/12/14 12:18:05 mickey Exp $ */
/* $NetBSD: mv.c,v 1.9 1995/03/21 09:06:52 cgd Exp $ */
/*
#if 0
static char sccsid[] = "@(#)mv.c 8.2 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: mv.c,v 1.4 1996/08/02 12:41:00 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: mv.c,v 1.5 1996/12/14 12:18:05 mickey Exp $";
#endif
#endif /* not lint */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <pwd.h>
+#include <grp.h>
#include "pathnames.h"
-/* $OpenBSD: edit.c,v 1.3 1996/10/01 02:05:33 downsj Exp $ */
+/* $OpenBSD: edit.c,v 1.4 1996/12/14 12:18:07 mickey Exp $ */
/*
* Command line editing - common code
# include <sys/stream.h> /* needed for <sys/ptem.h> */
# include <sys/ptem.h> /* needed for struct winsize */
#endif /* OS_SCO */
+#include <sys/ioctl.h>
#include <ctype.h>
#include "ksh_stat.h"
-/* $OpenBSD: print.c,v 1.2 1996/06/23 14:20:50 deraadt Exp $ */
+/* $OpenBSD: print.c,v 1.3 1996/12/14 12:18:09 mickey Exp $ */
/* $NetBSD: print.c,v 1.27 1995/09/29 21:58:12 cgd Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)print.c 8.6 (Berkeley) 4/16/94";
#else
-static char rcsid[] = "$OpenBSD: print.c,v 1.2 1996/06/23 14:20:50 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: print.c,v 1.3 1996/12/14 12:18:09 mickey Exp $";
#endif
#endif /* not lint */
#include <string.h>
#include <tzfile.h>
#include <unistd.h>
+#include <pwd.h>
#include "ps.h"
left = -1;
if (needenv) {
argv = kvm_getenvv(kd, ki->ki_p, termwidth);
- if (p = argv) {
+ if ((p = argv) != NULL) {
while (*p) {
fmt_puts(*p, &left);
p++;
if (needcomm) {
if (!commandonly) {
argv = kvm_getargv(kd, ki->ki_p, termwidth);
- if (p = argv) {
+ if ((p = argv) != NULL) {
while (*p) {
fmt_puts(*p, &left);
p++;
VAR *v;
v = ve->var;
- (void)printf("%*d", v->width,
+ (void)printf("%*ld", v->width,
k->ki_u.u_valid ? k->ki_u.u_ru.ru_majflt : 0);
}
if (v->flag & LJUST)
*cp++ = '-';
*cp++ = '*';
- while (*cp++ = *fcp++);
+ while ((*cp++ = *fcp++));
/*
* Note that the "INF127" check is nonsensical for types
-/* $OpenBSD: ps.c,v 1.5 1996/08/06 19:33:47 deraadt Exp $ */
+/* $OpenBSD: ps.c,v 1.6 1996/12/14 12:18:10 mickey Exp $ */
/* $NetBSD: ps.c,v 1.15 1995/05/18 20:33:25 mycroft Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)ps.c 8.4 (Berkeley) 4/2/94";
#else
-static char rcsid[] = "$OpenBSD: ps.c,v 1.5 1996/08/06 19:33:47 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: ps.c,v 1.6 1996/12/14 12:18:10 mickey Exp $";
#endif
#endif /* not lint */
* if there's a trailing number, and not a preceding 'p' (pid) or
* 't' (tty) flag, then assume it's a pid and insert a 'p' flag.
*/
- if (isdigit(*cp) && (cp == s || cp[-1] != 't' && cp[-1] != 'p' &&
- (cp - 1 == s || cp[-2] != 't')))
+ if (isdigit(*cp) && (cp == s || (cp[-1] != 't' && cp[-1] != 'p' &&
+ (cp - 1 == s || cp[-2] != 't'))))
*ns++ = 'p';
(void)strcpy(ns, cp); /* and append the number */
-/* $OpenBSD: pwd.c,v 1.3 1996/08/02 12:41:03 deraadt Exp $ */
+/* $OpenBSD: pwd.c,v 1.4 1996/12/14 12:18:12 mickey Exp $ */
/* $NetBSD: pwd.c,v 1.7 1995/03/21 09:08:18 cgd Exp $ */
/*
#if 0
static char sccsid[] = "@(#)pwd.c 8.3 (Berkeley) 4/1/94";
#else
-static char rcsid[] = "$OpenBSD: pwd.c,v 1.3 1996/08/02 12:41:03 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: pwd.c,v 1.4 1996/12/14 12:18:12 mickey Exp $";
#endif
#endif /* not lint */
usage();
if ((p = getcwd(NULL, 0)) == NULL)
- err(1, NULL);
+ err(1, "getcwd");
(void)printf("%s\n", p);
exit(0);
}
/* $NetBSD: rcp.c,v 1.9 1995/03/21 08:19:06 cgd Exp $ */
-/* $OpenBSD: rcp.c,v 1.6 1996/08/02 12:41:04 deraadt Exp $ */
+/* $OpenBSD: rcp.c,v 1.7 1996/12/14 12:18:13 mickey Exp $ */
/*
* Copyright (c) 1983, 1990, 1992, 1993
#ifdef KERBEROS
int kerberos __P((char **, char *, char *, char *));
void oldw __P((const char *, ...));
+/* XXX from ../../usr.bin/rlogin/krcmd.c */
+int krcmd __P((char **, u_short, char *, char *, int *, char *));
+int krcmd_mutual __P((char **, u_short, char *, char *, int *,
+ char *, CREDENTIALS *, Key_schedule));
#endif
int response __P((void));
void rsource __P((char *, struct stat *));
(void)signal(SIGPIPE, lostconn);
- if (targ = colon(argv[argc - 1])) /* Dest is remote host. */
+ if ((targ = colon(argv[argc - 1]))) /* Dest is remote host. */
toremote(targ, argc, argv);
else {
tolocal(argc, argv); /* Dest is local host. */
if (*targ == 0)
targ = ".";
- if (thost = strchr(argv[argc - 1], '@')) {
+ if ((thost = strchr(argv[argc - 1], '@'))) {
/* user@host */
*thost++ = 0;
tuser = argv[argc - 1];
closedir(dirp);
return;
}
- while (dp = readdir(dirp)) {
+ while ((dp = readdir(dirp)) != NULL) {
if (dp->d_ino == 0)
continue;
if (!strcmp(dp->d_name, ".") || !strcmp(dp->d_name, ".."))
BUF *bp;
off_t i, j;
int amt, count, exists, first, mask, mode, ofd, omode;
- int setimes, size, targisdir, wrerrno;
+ int setimes, size, targisdir, wrerrno = 0;
char ch, *cp, *np, *targ, *why, *vect[1], buf[BUFSIZ];
#define atime tv[0]
-/* $OpenBSD: rm.c,v 1.3 1996/08/02 12:41:05 deraadt Exp $ */
+/* $OpenBSD: rm.c,v 1.4 1996/12/14 12:18:15 mickey Exp $ */
/* $NetBSD: rm.c,v 1.19 1995/09/07 06:48:50 jtc Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)rm.c 8.8 (Berkeley) 4/27/95";
#else
-static char rcsid[] = "$OpenBSD: rm.c,v 1.3 1996/08/02 12:41:05 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: rm.c,v 1.4 1996/12/14 12:18:15 mickey Exp $";
#endif
#endif /* not lint */
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
+#include <pwd.h>
+#include <grp.h>
int dflag, eval, fflag, iflag, Pflag, Wflag, stdin_ok;
switch (p->fts_info) {
case FTS_DP:
case FTS_DNR:
- if (!rmdir(p->fts_accpath) || fflag && errno == ENOENT)
+ if (!rmdir(p->fts_accpath) ||
+ (fflag && errno == ENOENT))
continue;
break;
case FTS_W:
if (!undelete(p->fts_accpath) ||
- fflag && errno == ENOENT)
+ (fflag && errno == ENOENT))
continue;
break;
default:
if (Pflag)
rm_overwrite(p->fts_accpath, NULL);
- if (!unlink(p->fts_accpath) || fflag && errno == ENOENT)
+ if (!unlink(p->fts_accpath) ||
+ (fflag && errno == ENOENT))
continue;
}
warn("%s", p->fts_path);
* Since POSIX.2 defines basename as the final portion of a path after
* trailing slashes have been removed, we'll remove them here.
*/
-#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || (a)[1] == '.' && !(a)[2]))
+#define ISDOT(a) ((a)[0] == '.' && (!(a)[1] || ((a)[1] == '.' && !(a)[2])))
void
checkdot(argv)
char **argv;
-/* $OpenBSD: rmail.c,v 1.3 1996/08/02 12:41:06 deraadt Exp $ */
+/* $OpenBSD: rmail.c,v 1.4 1996/12/14 12:18:17 mickey Exp $ */
/* $NetBSD: rmail.c,v 1.8 1995/09/07 06:51:50 jtc Exp $ */
/*
#if 0
static char sccsid[] = "@(#)rmail.c 8.3 (Berkeley) 5/15/95";
#else
-static char rcsid[] = "$OpenBSD: rmail.c,v 1.3 1996/08/02 12:41:06 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: rmail.c,v 1.4 1996/12/14 12:18:17 mickey Exp $";
#endif
#endif /* not lint */
char *from_path, *from_sys, *from_user;
char *args[100], buf[2048], lbuf[2048];
+#ifdef lint
+ fplen = fptlen = 0;
+ addrp = NULL;
+#endif
+
debug = 0;
domain = "UUCP"; /* Default "domain". */
while ((ch = getopt(argc, argv, "D:T")) != EOF)
-/* $OpenBSD: arith.y,v 1.2 1996/06/23 14:21:08 deraadt Exp $ */
+/* $OpenBSD: arith.y,v 1.3 1996/12/14 12:18:19 mickey Exp $ */
%token ARITH_NUM ARITH_LPAREN ARITH_RPAREN
%left ARITH_OR
#if 0
static char sccsid[] = "@(#)arith.y 8.3 (Berkeley) 5/4/95";
#else
-static char sccsid[] = "$OpenBSD: arith.y,v 1.2 1996/06/23 14:21:08 deraadt Exp $";
+static char sccsid[] = "$OpenBSD: arith.y,v 1.3 1996/12/14 12:18:19 mickey Exp $";
#endif
#endif /* not lint */
char *arith_buf, *arith_startbuf;
+int yyparse __P((void));
+int yylex __P((void));
+
int
arith(s)
char *s;
-/* $OpenBSD: miscbltin.c,v 1.2 1996/06/23 14:21:22 deraadt Exp $ */
+/* $OpenBSD: miscbltin.c,v 1.3 1996/12/14 12:18:20 mickey Exp $ */
/* $NetBSD: miscbltin.c,v 1.15 1995/06/12 19:44:16 jtc Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)miscbltin.c 8.4 (Berkeley) 5/4/95";
#else
-static char rcsid[] = "$OpenBSD: miscbltin.c,v 1.2 1996/06/23 14:21:22 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: miscbltin.c,v 1.3 1996/12/14 12:18:20 mickey Exp $";
#endif
#endif /* not lint */
char **argv;
{
register int c;
- rlim_t val;
+ rlim_t val = 0;
enum { SOFT = 0x1, HARD = 0x2 }
how = SOFT | HARD;
const struct limits *l;
-/* $OpenBSD: options.c,v 1.6 1996/11/24 23:18:44 millert Exp $ */
+/* $OpenBSD: options.c,v 1.7 1996/12/14 12:18:21 mickey Exp $ */
/* $NetBSD: options.c,v 1.19 1996/11/06 01:17:11 christos Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 5/4/95";
#else
-static char rcsid[] = "$OpenBSD: options.c,v 1.6 1996/11/24 23:18:44 millert Exp $";
+static char rcsid[] = "$OpenBSD: options.c,v 1.7 1996/12/14 12:18:21 mickey Exp $";
#endif
#endif /* not lint */
int argc;
char **argv;
{
- char **optbase;
+ char **optbase = shellparam.p;
if (argc < 3)
error("Usage: getopts optstring var [arg]");
- else if (argc == 3)
- optbase = shellparam.p;
else
optbase = &argv[3];
-/* $OpenBSD: parser.c,v 1.6 1996/12/01 05:09:51 millert Exp $ */
+/* $OpenBSD: parser.c,v 1.7 1996/12/14 12:18:23 mickey Exp $ */
/* $NetBSD: parser.c,v 1.31 1996/11/25 20:22:00 christos Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)parser.c 8.7 (Berkeley) 5/16/95";
#else
-static char rcsid[] = "$OpenBSD: parser.c,v 1.6 1996/12/01 05:09:51 millert Exp $";
+static char rcsid[] = "$OpenBSD: parser.c,v 1.7 1996/12/14 12:18:23 mickey Exp $";
#endif
#endif /* not lint */
struct jmploc *volatile savehandler;
int savelen;
int saveprompt;
-
+#ifdef lint
+ saveprompt = 0;
+#endif
savepbq = parsebackquote;
if (setjmp(jmploc.loc)) {
if (str)
-/* $OpenBSD: redir.c,v 1.3 1996/10/20 00:55:03 millert Exp $ */
+/* $OpenBSD: redir.c,v 1.4 1996/12/14 12:18:24 mickey Exp $ */
/* $NetBSD: redir.c,v 1.12 1995/05/11 21:30:10 christos Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)redir.c 8.2 (Berkeley) 5/4/95";
#else
-static char rcsid[] = "$OpenBSD: redir.c,v 1.3 1996/10/20 00:55:03 millert Exp $";
+static char rcsid[] = "$OpenBSD: redir.c,v 1.4 1996/12/14 12:18:24 mickey Exp $";
#endif
#endif /* not lint */
struct redirtab *sv;
int i;
int fd;
- char memory[10]; /* file descriptors to write to memory */
-
+ char memory[10]; /* file descriptors to write to memory */
+#ifdef lint
+ sv = NULL;
+#endif
for (i = 10 ; --i >= 0 ; )
memory[i] = 0;
memory[1] = flags & REDIR_BACKQ;
-/* $OpenBSD: var.c,v 1.3 1996/10/20 00:55:08 millert Exp $ */
+/* $OpenBSD: var.c,v 1.4 1996/12/14 12:18:25 mickey Exp $ */
/* $NetBSD: var.c,v 1.13 1995/05/11 21:30:39 christos Exp $ */
/*-
#if 0
static char sccsid[] = "@(#)var.c 8.3 (Berkeley) 5/4/95";
#else
-static char rcsid[] = "$OpenBSD: var.c,v 1.3 1996/10/20 00:55:08 millert Exp $";
+static char rcsid[] = "$OpenBSD: var.c,v 1.4 1996/12/14 12:18:25 mickey Exp $";
#endif
#endif /* not lint */
{
struct jmploc jmploc;
struct jmploc *volatile savehandler = handler;
- int err = 0;
+ int err;
if (setjmp(jmploc.loc))
err = 1;
else {
+ err = 0;
handler = &jmploc;
setvar(name, val, flags);
}
-/* $OpenBSD: test.c,v 1.2 1996/06/23 14:21:58 deraadt Exp $ */
+/* $OpenBSD: test.c,v 1.3 1996/12/14 12:18:27 mickey Exp $ */
/* $NetBSD: test.c,v 1.15 1995/03/21 07:04:06 cgd Exp $ */
/*
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: test.c,v 1.2 1996/06/23 14:21:58 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: test.c,v 1.3 1996/12/14 12:18:27 mickey Exp $";
#endif
#include <sys/types.h>
return res;
}
-static void
+static __dead void
syntax(op, msg)
char *op;
char *msg;