Add { and } to shut up egcs. Reformat the more questionable code.

This commit is contained in:
ross 1998-08-25 20:59:36 +00:00
parent 029a64cc29
commit f670fa10c5
40 changed files with 256 additions and 182 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: regular.c,v 1.6 1997/12/09 10:59:54 mrg Exp $ */
/* $NetBSD: regular.c,v 1.7 1998/08/25 20:59:36 ross Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)regular.c 8.3 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: regular.c,v 1.6 1997/12/09 10:59:54 mrg Exp $");
__RCSID("$NetBSD: regular.c,v 1.7 1998/08/25 20:59:36 ross Exp $");
#endif
#endif /* not lint */
@ -87,7 +87,7 @@ c_regular(fd1, file1, skip1, len1, fd2, file2, skip2, len2)
dfound = 0;
for (byte = line = 1; length--; ++p1, ++p2, ++byte) {
if ((ch = *p1) != *p2)
if ((ch = *p1) != *p2) {
if (lflag) {
dfound = 1;
(void)printf("%6qd %3o %3o\n", (long long)byte,
@ -95,6 +95,7 @@ c_regular(fd1, file1, skip1, len1, fd2, file2, skip2, len2)
} else
diffmsg(file1, file2, byte, line);
/* NOTREACHED */
}
if (ch == '\n')
++line;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: special.c,v 1.5 1997/10/19 14:06:10 mrg Exp $ */
/* $NetBSD: special.c,v 1.6 1998/08/25 20:59:36 ross Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)special.c 8.3 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: special.c,v 1.5 1997/10/19 14:06:10 mrg Exp $");
__RCSID("$NetBSD: special.c,v 1.6 1998/08/25 20:59:36 ross Exp $");
#endif
#endif /* not lint */
@ -81,7 +81,7 @@ c_special(fd1, file1, skip1, fd2, file2, skip2)
ch2 = getc(fp2);
if (ch1 == EOF || ch2 == EOF)
break;
if (ch1 != ch2)
if (ch1 != ch2) {
if (lflag) {
dfound = 1;
(void)printf("%6qd %3o %3o\n", (long long)byte,
@ -89,6 +89,7 @@ c_special(fd1, file1, skip1, fd2, file2, skip2)
} else
diffmsg(file1, file2, byte, line);
/* NOTREACHED */
}
if (ch1 == '\n')
++line;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: ctags.c,v 1.5 1997/10/18 13:18:31 lukem Exp $ */
/* $NetBSD: ctags.c,v 1.6 1998/08/25 20:59:36 ross Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994, 1995\n\
#if 0
static char sccsid[] = "@(#)ctags.c 8.4 (Berkeley) 2/7/95";
#endif
__RCSID("$NetBSD: ctags.c,v 1.5 1997/10/18 13:18:31 lukem Exp $");
__RCSID("$NetBSD: ctags.c,v 1.6 1998/08/25 20:59:36 ross Exp $");
#endif /* not lint */
#include <err.h>
@ -154,7 +154,7 @@ usage: (void)fprintf(stderr,
(void)fclose(inf);
}
if (head)
if (head) {
if (xflag)
put_entries(head);
else {
@ -178,6 +178,7 @@ usage: (void)fprintf(stderr,
system(cmd);
}
}
}
exit(exit_val);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cut.c,v 1.11 1997/10/18 13:21:39 lukem Exp $ */
/* $NetBSD: cut.c,v 1.12 1998/08/25 20:59:36 ross Exp $ */
/*
* Copyright (c) 1989, 1993
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)cut.c 8.3 (Berkeley) 5/4/95";
#endif
__RCSID("$NetBSD: cut.c,v 1.11 1997/10/18 13:21:39 lukem Exp $");
__RCSID("$NetBSD: cut.c,v 1.12 1998/08/25 20:59:36 ross Exp $");
#endif /* not lint */
#include <ctype.h>
@ -215,12 +215,13 @@ c_cut(fp, fname)
if (*pos++)
(void)putchar(ch);
}
if (ch != '\n')
if (ch != '\n') {
if (autostop)
while ((ch = getc(fp)) != EOF && ch != '\n')
(void)putchar(ch);
else
while ((ch = getc(fp)) != EOF && ch != '\n');
}
(void)putchar('\n');
}
}
@ -259,12 +260,14 @@ f_cut(fp, fname)
(void)putchar(sep);
while ((ch = *p++) != '\n' && ch != sep)
(void)putchar(ch);
} else
while ((ch = *p++) != '\n' && ch != sep);
} else {
while ((ch = *p++) != '\n' && ch != sep)
continue;
}
if (ch == '\n')
break;
}
if (ch != '\n')
if (ch != '\n') {
if (autostop) {
if (output)
(void)putchar(sep);
@ -272,6 +275,7 @@ f_cut(fp, fname)
(void)putchar(ch);
} else
for (; (ch = *p) != '\n'; ++p);
}
(void)putchar('\n');
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: finger.c,v 1.11 1998/08/10 03:11:07 perry Exp $ */
/* $NetBSD: finger.c,v 1.12 1998/08/25 20:59:37 ross Exp $ */
/*
* Copyright (c) 1989, 1993
@ -56,7 +56,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95";
#else
__RCSID("$NetBSD: finger.c,v 1.11 1998/08/10 03:11:07 perry Exp $");
__RCSID("$NetBSD: finger.c,v 1.12 1998/08/25 20:59:37 ross Exp $");
#endif
#endif /* not lint */
@ -164,11 +164,12 @@ main(argc, argv)
if (!sflag)
lflag = 1; /* if -s not explicit, force -l */
}
if (entries)
if (entries) {
if (lflag)
lflag_print();
else
sflag_print();
}
return (0);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: odsyntax.c,v 1.8 1997/10/19 02:34:09 lukem Exp $ */
/* $NetBSD: odsyntax.c,v 1.9 1998/08/25 20:59:37 ross Exp $ */
/*-
* Copyright (c) 1990, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)odsyntax.c 8.2 (Berkeley) 5/4/95";
#else
__RCSID("$NetBSD: odsyntax.c,v 1.8 1997/10/19 02:34:09 lukem Exp $");
__RCSID("$NetBSD: odsyntax.c,v 1.9 1998/08/25 20:59:37 ross Exp $");
#endif
#endif /* not lint */
@ -226,7 +226,7 @@ odoffset(argc, argvp)
return;
}
if (*p)
if (*p) {
if (*p == 'B') {
skip *= 1024;
++p;
@ -234,12 +234,11 @@ odoffset(argc, argvp)
skip *= 512;
++p;
}
}
if (*p) {
skip = 0;
return;
}
/*
* If the offset uses a non-octal base, the base of the offset
* is changed as well. This isn't pretty, but it's easy.

View File

@ -41,7 +41,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
#if 0
static char sccsid[] = "@(#)id.c 8.3 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: id.c,v 1.9 1997/10/19 03:18:54 lukem Exp $");
__RCSID("$NetBSD: id.c,v 1.10 1998/08/25 20:59:37 ross Exp $");
#endif
#endif /* not lint */
@ -174,16 +174,18 @@ pretty(pw)
else
(void)printf("uid\t%u\n", rid);
if ((eid = geteuid()) != rid)
if ((eid = geteuid()) != rid) {
if ((pw = getpwuid(eid)) != NULL)
(void)printf("euid\t%s", pw->pw_name);
else
(void)printf("euid\t%u", eid);
if ((rid = getgid()) != (eid = getegid()))
}
if ((rid = getgid()) != (eid = getegid())) {
if ((gr = getgrgid(rid)) != NULL)
(void)printf("rgid\t%s\n", gr->gr_name);
else
(void)printf("rgid\t%u\n", rid);
}
(void)printf("groups\t");
group(NULL, 1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: indent.c,v 1.6 1997/10/19 03:17:17 lukem Exp $ */
/* $NetBSD: indent.c,v 1.7 1998/08/25 20:59:37 ross Exp $ */
/*
* Copyright (c) 1980, 1993
@ -48,7 +48,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985 Sun Microsystems, Inc.\n\
#if 0
static char sccsid[] = "@(#)indent.c 5.17 (Berkeley) 6/7/93";
#else
__RCSID("$NetBSD: indent.c,v 1.6 1997/10/19 03:17:17 lukem Exp $");
__RCSID("$NetBSD: indent.c,v 1.7 1998/08/25 20:59:37 ross Exp $");
#endif
#endif /* not lint */
@ -223,13 +223,14 @@ main(argc, argv)
fprintf(stderr, "indent: usage: indent file [ outfile ] [ options ]\n");
exit(1);
}
if (output == 0)
if (output == 0) {
if (troff)
output = stdout;
else {
out_name = in_name;
bakcopy();
}
}
if (ps.com_ind <= 1)
ps.com_ind = 2; /* dont put normal comments before column 2 */
if (troff) {
@ -977,7 +978,7 @@ check_type:
*e_code++ = ' ';
ps.want_blank = false;
if (is_procname == 0 || !procnames_start_line) {
if (!ps.block_init)
if (!ps.block_init) {
if (troff && !ps.dumped_decl_indent) {
sprintf(e_code, "\n.De %dp+\200p\n", dec_ind * 7);
ps.dumped_decl_indent = 1;
@ -987,6 +988,7 @@ check_type:
CHECK_SIZE_CODE;
*e_code++ = ' ';
}
}
} else {
if (dec_ind && s_code != e_code)
dump_line();

View File

@ -1,4 +1,4 @@
/* $NetBSD: io.c,v 1.7 1998/03/30 02:25:33 mrg Exp $ */
/* $NetBSD: io.c,v 1.8 1998/08/25 20:59:37 ross Exp $ */
/*
* Copyright (c) 1980, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)io.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: io.c,v 1.7 1998/03/30 02:25:33 mrg Exp $");
__RCSID("$NetBSD: io.c,v 1.8 1998/08/25 20:59:37 ross Exp $");
#endif
#endif /* not lint */
@ -89,7 +89,7 @@ dump_line()
if (!inhibit_formatting) {
suppress_blanklines = 0;
ps.bl_line = false;
if (prefix_blankline_requested && not_first_line)
if (prefix_blankline_requested && not_first_line) {
if (swallow_optional_blanklines) {
if (n_real_blanklines == 1)
n_real_blanklines = 0;
@ -97,6 +97,7 @@ dump_line()
if (n_real_blanklines == 0)
n_real_blanklines = 1;
}
}
while (--n_real_blanklines >= 0)
putc('\n', output);
n_real_blanklines = 0;
@ -164,7 +165,7 @@ dump_line()
putc(*p, output);
cur_col = count_spaces(cur_col, s_code);
}
if (s_com != e_com)
if (s_com != e_com) {
if (troff) {
int all_here = 0;
char *p;
@ -244,22 +245,35 @@ dump_line()
cur_col = 1;
++ps.out_lines;
}
while (e_com > com_st && isspace(e_com[-1]))
while (e_com > com_st
&& isspace(e_com[-1]))
e_com--;
cur_col = pad_output(cur_col, target);
if (!ps.box_com) {
if (star_comment_cont && (com_st[1] != '*' || e_com <= com_st + 1))
if (com_st[1] == ' ' && com_st[0] == ' ' && e_com > com_st + 1)
if (star_comment_cont
&& (com_st[1] != '*'
|| e_com <= com_st + 1)) {
if (com_st[1] == ' '
&& com_st[0] == ' '
&& e_com > com_st + 1)
com_st[1] = '*';
else
fwrite(" * ", com_st[0] == '\t' ? 2 : com_st[0] == '*' ? 1 : 3, 1, output);
fwrite(" * ",
com_st[0] == '\t'
? 2
: com_st[0]=='*'
? 1
: 3, 1, output);
}
}
fwrite(com_st, e_com - com_st, 1, output);
fwrite(com_st,
e_com - com_st, 1, output);
ps.comment_delta = ps.n_comment_delta;
cur_col = count_spaces(cur_col, com_st);
++ps.com_lines; /* count lines with
* comments */
}
}
if (ps.use_ff)
putc('\014', output);
else
@ -401,13 +415,15 @@ fill_buffer()
p++;
if (*p == '*')
com = 1;
else
if (*p == 'O')
else {
if (*p == 'O') {
if (*++p == 'N')
p++, com = 1;
else
if (*p == 'F' && *++p == 'F')
p++, com = 2;
}
}
while (*p == ' ' || *p == '\t')
p++;
if (p[0] == '*' && p[1] == '/' && p[2] == '\n' && com) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: lexi.c,v 1.6 1997/10/19 03:17:25 lukem Exp $ */
/* $NetBSD: lexi.c,v 1.7 1998/08/25 20:59:38 ross Exp $ */
/*
* Copyright (c) 1980, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)lexi.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lexi.c,v 1.6 1997/10/19 03:17:25 lukem Exp $");
__RCSID("$NetBSD: lexi.c,v 1.7 1998/08/25 20:59:38 ross Exp $");
#endif
#endif /* not lint */
@ -169,17 +169,20 @@ lexi()
CHECK_SIZE_TOKEN;
*e_token++ = *buf_ptr++;
}
} else
} else {
while (1) {
if (*buf_ptr == '.')
if (*buf_ptr == '.') {
if (seendot)
break;
else
seendot++;
}
CHECK_SIZE_TOKEN;
*e_token++ = *buf_ptr++;
if (!isdigit(*buf_ptr) && *buf_ptr != '.')
if ((*buf_ptr != 'E' && *buf_ptr != 'e') || seenexp)
if (!isdigit(*buf_ptr)
&& *buf_ptr != '.') {
if ((*buf_ptr != 'E'
&& *buf_ptr != 'e') || seenexp)
break;
else {
seenexp++;
@ -189,7 +192,9 @@ lexi()
if (*buf_ptr == '+' || *buf_ptr == '-')
*e_token++ = *buf_ptr++;
}
}
}
}
if (*buf_ptr == 'L' || *buf_ptr == 'l')
*e_token++ = *buf_ptr++;
} else

View File

@ -1,4 +1,4 @@
/* $NetBSD: join.c,v 1.12 1998/02/03 03:47:47 perry Exp $ */
/* $NetBSD: join.c,v 1.13 1998/08/25 20:59:38 ross Exp $ */
/*-
* Copyright (c) 1991 The Regents of the University of California.
@ -48,7 +48,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "from: @(#)join.c 5.1 (Berkeley) 11/18/91";
#else
__RCSID("$NetBSD: join.c,v 1.12 1998/02/03 03:47:47 perry Exp $");
__RCSID("$NetBSD: join.c,v 1.13 1998/08/25 20:59:38 ross Exp $");
#endif
#endif /* not lint */
@ -477,7 +477,7 @@ outfield(lp, fieldno)
{
if (needsep++)
(void)printf("%c", *tabchar);
if (!ferror(stdout))
if (!ferror(stdout)) {
if (lp->fieldcnt < fieldno) {
if (empty != NULL)
(void)printf("%s", empty);
@ -486,6 +486,7 @@ outfield(lp, fieldno)
return;
(void)printf("%s", lp->fields[fieldno]);
}
}
if (ferror(stdout))
err(1, "stdout");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: last.c,v 1.10 1998/07/06 06:51:08 mrg Exp $ */
/* $NetBSD: last.c,v 1.11 1998/08/25 20:59:38 ross Exp $ */
/*
* Copyright (c) 1987, 1993, 1994
@ -44,7 +44,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)last.c 8.2 (Berkeley) 4/2/94";
#endif
__RCSID("$NetBSD: last.c,v 1.10 1998/07/06 06:51:08 mrg Exp $");
__RCSID("$NetBSD: last.c,v 1.11 1998/08/25 20:59:38 ross Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -301,7 +301,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
@ -311,6 +311,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 (!arglist)
return (YES);

View File

@ -1,4 +1,4 @@
/* $NetBSD: login.c,v 1.39 1998/07/26 22:04:37 mycroft Exp $ */
/* $NetBSD: login.c,v 1.40 1998/08/25 20:59:38 ross Exp $ */
/*-
* Copyright (c) 1980, 1987, 1988, 1991, 1993, 1994
@ -44,7 +44,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)login.c 8.4 (Berkeley) 4/2/94";
#endif
__RCSID("$NetBSD: login.c,v 1.39 1998/07/26 22:04:37 mycroft Exp $");
__RCSID("$NetBSD: login.c,v 1.40 1998/08/25 20:59:38 ross Exp $");
#endif /* not lint */
/*
@ -429,7 +429,7 @@ main(argc, argv)
if (pwd->pw_change || pwd->pw_expire)
(void)gettimeofday(&tp, (struct timezone *)NULL);
if (pwd->pw_expire)
if (pwd->pw_expire) {
if (tp.tv_sec >= pwd->pw_expire) {
(void)printf("Sorry -- your account has expired.\n");
sleepexit(1);
@ -437,7 +437,8 @@ main(argc, argv)
_PASSWORD_WARNDAYS * SECSPERDAY && !quietlog)
(void)printf("Warning: your account expires on %s",
ctime(&pwd->pw_expire));
if (pwd->pw_change)
}
if (pwd->pw_change) {
if (pwd->pw_change == _PASSWORD_CHGNOW)
need_chpass = 1;
else if (tp.tv_sec >= pwd->pw_change) {
@ -448,6 +449,7 @@ main(argc, argv)
(void)printf("Warning: your password expires on %s",
ctime(&pwd->pw_change));
}
/* Nothing else left to fail -- really log in. */
memset((void *)&utmp, 0, sizeof(utmp));
(void)time(&utmp.ut_time);
@ -501,12 +503,14 @@ main(argc, argv)
syslog(LOG_INFO, "DIALUP %s, %s", tty, pwd->pw_name);
/* If fflag is on, assume caller/authenticator has logged root login. */
if (rootlogin && fflag == 0)
if (rootlogin && fflag == 0) {
if (hostname)
syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s FROM %s",
username, tty, hostname);
else
syslog(LOG_NOTICE, "ROOT LOGIN (%s) ON %s", username, tty);
syslog(LOG_NOTICE,
"ROOT LOGIN (%s) ON %s", username, tty);
}
#if defined(KERBEROS) || defined(KERBEROS5)
if (!quietlog && notickets == 1)
@ -623,7 +627,7 @@ getloginname()
if (p < nbuf + (NBUFSIZ - 1))
*p++ = ch;
}
if (p > nbuf)
if (p > nbuf) {
if (nbuf[0] == '-')
(void)fprintf(stderr,
"login names may not start with '-'.\n");
@ -632,6 +636,7 @@ getloginname()
username = nbuf;
break;
}
}
}
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: send.c,v 1.8 1997/11/25 17:55:52 bad Exp $ */
/* $NetBSD: send.c,v 1.9 1998/08/25 20:59:38 ross Exp $ */
/*
* Copyright (c) 1980, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)send.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: send.c,v 1.8 1997/11/25 17:55:52 bad Exp $");
__RCSID("$NetBSD: send.c,v 1.9 1998/08/25 20:59:38 ross Exp $");
#endif
#endif /* not lint */
@ -179,12 +179,13 @@ send(mp, obuf, doign, prefix)
* Strip trailing whitespace from prefix
* if line is blank.
*/
if (prefix != NOSTR)
if (prefix != NOSTR) {
if (length > 1)
fputs(prefix, obuf);
else
(void) fwrite(prefix, sizeof *prefix,
prefixlen, obuf);
}
(void) fwrite(line, sizeof *line, length, obuf);
if (ferror(obuf))
return -1;
@ -315,7 +316,7 @@ mail1(hp, printheaders)
*/
if ((mtf = collect(hp, printheaders)) == NULL)
return;
if (value("interactive") != NOSTR)
if (value("interactive") != NOSTR) {
if (value("askcc") != NOSTR || value("askbcc") != NOSTR) {
if (value("askcc") != NOSTR)
grabh(hp, GCC);
@ -325,11 +326,13 @@ mail1(hp, printheaders)
printf("EOT\n");
(void) fflush(stdout);
}
if (fsize(mtf) == 0)
}
if (fsize(mtf) == 0) {
if (hp->h_subject == NOSTR)
printf("No message, no subject; hope that's ok\n");
else
printf("Null message body; hope that's ok\n");
}
/*
* Now, take the user names from the combined
* to and cc lists and do all the alias

View File

@ -1,4 +1,4 @@
/* $NetBSD: man.c,v 1.12 1998/07/06 14:23:32 kleink Exp $ */
/* $NetBSD: man.c,v 1.13 1998/08/25 20:59:39 ross Exp $ */
/*
* Copyright (c) 1987, 1993, 1994, 1995
@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1987, 1993, 1994, 1995\n\
#if 0
static char sccsid[] = "@(#)man.c 8.17 (Berkeley) 1/31/95";
#else
__RCSID("$NetBSD: man.c,v 1.12 1998/07/06 14:23:32 kleink Exp $");
__RCSID("$NetBSD: man.c,v 1.13 1998/08/25 20:59:39 ross Exp $");
#endif
#endif /* not lint */
@ -143,14 +143,15 @@ main(argc, argv)
if (!*argv)
usage();
if (!f_cat && !f_how && !f_where)
if (!f_cat && !f_how && !f_where) {
if (!isatty(1))
f_cat = 1;
else if ((pager = getenv("PAGER")) != NULL)
pager = check_pager(pager);
else
pager = _PATH_PAGER;
else {
if ((pager = getenv("PAGER")) != NULL)
pager = check_pager(pager);
else pager = _PATH_PAGER;
}
}
/* Read the configuration file. */
config(conffile);

View File

@ -1,4 +1,4 @@
/* $NetBSD: if.c,v 1.28 1998/07/12 03:20:14 mrg Exp $ */
/* $NetBSD: if.c,v 1.29 1998/08/25 20:59:39 ross Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)if.c 8.2 (Berkeley) 2/21/94";
#else
__RCSID("$NetBSD: if.c,v 1.28 1998/07/12 03:20:14 mrg Exp $");
__RCSID("$NetBSD: if.c,v 1.29 1998/08/25 20:59:39 ross Exp $");
#endif
#endif /* not lint */
@ -365,7 +365,7 @@ banner:
}
if (dflag)
printf("%5.5s ", "drops");
if (lastif - iftot > 0)
if (lastif - iftot > 0) {
if (bflag) {
printf("%10.10s %8.8s %10.10s %5.5s",
"bytes", " ", "bytes", " ");
@ -373,6 +373,7 @@ banner:
printf("%8.8s %5.5s %8.8s %5.5s %5.5s ",
"packets", "errs", "packets", "errs", "colls");
}
}
if (dflag)
printf(" %5.5s", "drops");
putchar('\n');

View File

@ -1,4 +1,4 @@
/* $NetBSD: inet.c,v 1.33 1998/07/20 21:03:37 sommerfe Exp $ */
/* $NetBSD: inet.c,v 1.34 1998/08/25 20:59:39 ross Exp $ */
/*
* Copyright (c) 1983, 1988, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "from: @(#)inet.c 8.4 (Berkeley) 4/20/94";
#else
__RCSID("$NetBSD: inet.c,v 1.33 1998/07/20 21:03:37 sommerfe Exp $");
__RCSID("$NetBSD: inet.c,v 1.34 1998/08/25 20:59:39 ross Exp $");
#endif
#endif /* not lint */
@ -140,11 +140,12 @@ protopr(off, name)
"Local Address", "Foreign Address", "(state)");
first = 0;
}
if (Aflag)
if (Aflag) {
if (istcp)
printf("%8lx ", (u_long) inpcb.inp_ppcb);
else
printf("%8lx ", (u_long) prev);
}
printf("%-5.5s %6ld %6ld ", name, sockb.so_rcv.sb_cc,
sockb.so_snd.sb_cc);
if (nflag) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: quota.c,v 1.20 1998/07/26 22:17:53 mycroft Exp $ */
/* $NetBSD: quota.c,v 1.21 1998/08/25 20:59:39 ross Exp $ */
/*
* Copyright (c) 1980, 1990, 1993
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1980, 1990, 1993\n\
#if 0
static char sccsid[] = "@(#)quota.c 8.4 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: quota.c,v 1.20 1998/07/26 22:17:53 mycroft Exp $");
__RCSID("$NetBSD: quota.c,v 1.21 1998/08/25 20:59:39 ross Exp $");
#endif
#endif /* not lint */
@ -334,21 +334,25 @@ showquotas(type, id, name)
qup->dqblk.dqb_curinodes >= qup->dqblk.dqb_ihardlimit)
msgi = "File limit reached on";
else if (qup->dqblk.dqb_isoftlimit &&
qup->dqblk.dqb_curinodes >= qup->dqblk.dqb_isoftlimit)
qup->dqblk.dqb_curinodes >= qup->dqblk.dqb_isoftlimit) {
if (qup->dqblk.dqb_itime > now)
msgi = "In file grace period on";
else
msgi = "Over file quota on";
}
msgb = (char *)0;
if (qup->dqblk.dqb_bhardlimit &&
qup->dqblk.dqb_curblocks >= qup->dqblk.dqb_bhardlimit)
msgb = "Block limit reached on";
else if (qup->dqblk.dqb_bsoftlimit &&
qup->dqblk.dqb_curblocks >= qup->dqblk.dqb_bsoftlimit)
if (qup->dqblk.dqb_btime > now)
msgb = "In block grace period on";
else
msgb = "Over block quota on";
else {
if (qup->dqblk.dqb_bsoftlimit
&& qup->dqblk.dqb_curblocks
>= qup->dqblk.dqb_bsoftlimit) {
if (qup->dqblk.dqb_btime > now)
msgb = "In block grace period on";
else msgb = "Over block quota on";
}
}
if (qflag) {
if ((msgi != (char *)0 || msgb != (char *)0) &&
lines++ == 0)

View File

@ -1,4 +1,4 @@
/* $NetBSD: expand.c,v 1.11 1997/10/19 19:31:19 mycroft Exp $ */
/* $NetBSD: expand.c,v 1.12 1998/08/25 20:59:39 ross Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)expand.c 8.1 (Berkeley) 6/9/93";
#else
__RCSID("$NetBSD: expand.c,v 1.11 1997/10/19 19:31:19 mycroft Exp $");
__RCSID("$NetBSD: expand.c,v 1.12 1998/08/25 20:59:39 ross Exp $");
#endif
#endif /* not lint */
@ -516,7 +516,7 @@ slash:
while (*s)
addpath(*s++);
addpath('/');
if (stat(path, &stb) == 0 && S_ISDIR(stb.st_mode))
if (stat(path, &stb) == 0 && S_ISDIR(stb.st_mode)) {
if (*p == '\0') {
if (which & E_TILDE)
Cat(path, "");
@ -524,6 +524,7 @@ slash:
Cat(tilde, tpathp);
} else
expsh(p);
}
pathp = spathp;
*pathp = '\0';
return (0);

View File

@ -1,4 +1,4 @@
/* $NetBSD: rpc_cout.c,v 1.13 1997/10/18 10:53:44 lukem Exp $ */
/* $NetBSD: rpc_cout.c,v 1.14 1998/08/25 20:59:40 ross Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
* unrestricted use provided that this legend is included on all tape
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)rpc_cout.c 1.13 89/02/22 (C) 1987 SMI";
#else
__RCSID("$NetBSD: rpc_cout.c,v 1.13 1997/10/18 10:53:44 lukem Exp $");
__RCSID("$NetBSD: rpc_cout.c,v 1.14 1998/08/25 20:59:40 ross Exp $");
#endif
#endif
@ -497,7 +497,7 @@ emit_struct(def)
}
} else {
if (i > 0)
if (i > 0) {
if (sizestr == NULL && size < doinline) {
/* don't expand into inline
* code if size < doinline */
@ -542,6 +542,7 @@ emit_struct(def)
f_print(fout, "\t\t}\n");
}
}
size = 0;
i = 0;
sizestr = NULL;
@ -549,7 +550,7 @@ emit_struct(def)
}
}
if (i > 0)
if (i > 0) {
if (sizestr == NULL && size < doinline) {
/* don't expand into inline code if size <
* doinline */
@ -592,7 +593,7 @@ emit_struct(def)
f_print(fout, "\t\t}\n");
}
}
if (flag == PUT) {
flag = GET;
f_print(fout, "\t} else if (xdrs->x_op == XDR_DECODE) {\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: process.c,v 1.22 1998/03/30 02:29:28 mrg Exp $ */
/* $NetBSD: process.c,v 1.23 1998/08/25 20:59:40 ross Exp $ */
/*-
* Copyright (c) 1992 Diomidis Spinellis.
@ -42,7 +42,7 @@
#if 0
static char sccsid[] = "@(#)process.c 8.6 (Berkeley) 4/20/94";
#else
__RCSID("$NetBSD: process.c,v 1.22 1998/03/30 02:29:28 mrg Exp $");
__RCSID("$NetBSD: process.c,v 1.23 1998/08/25 20:59:40 ross Exp $");
#endif
#endif /* not lint */
@ -470,7 +470,7 @@ lputs(s)
struct winsize win;
static int termwidth = -1;
if (termwidth == -1)
if (termwidth == -1) {
if ((p = getenv("COLUMNS")) != NULL)
termwidth = atoi(p);
else if (ioctl(STDOUT_FILENO, TIOCGWINSZ, &win) == 0 &&
@ -478,7 +478,7 @@ lputs(s)
termwidth = win.ws_col;
else
termwidth = 60;
}
for (count = 0; *s; ++s) {
if (count >= termwidth) {
(void)printf("\\\n");

View File

@ -1,4 +1,4 @@
/* $NetBSD: su.c,v 1.25 1998/07/26 15:24:34 mycroft Exp $ */
/* $NetBSD: su.c,v 1.26 1998/08/25 20:59:40 ross Exp $ */
/*
* Copyright (c) 1988 The Regents of the University of California.
@ -44,7 +44,7 @@ __COPYRIGHT(
#if 0
static char sccsid[] = "@(#)su.c 8.3 (Berkeley) 4/2/94";*/
#else
__RCSID("$NetBSD: su.c,v 1.25 1998/07/26 15:24:34 mycroft Exp $");
__RCSID("$NetBSD: su.c,v 1.26 1998/08/25 20:59:40 ross Exp $");
#endif
#endif /* not lint */
@ -158,7 +158,7 @@ main(argc, argv)
if (username == NULL)
err(1, "strdup");
if (asme)
if (asme) {
if (pwd->pw_shell && *pwd->pw_shell) {
shell = strncpy(shellbuf, pwd->pw_shell,
sizeof(shellbuf) - 1);
@ -167,7 +167,7 @@ main(argc, argv)
shell = _PATH_BSHELL;
iscsh = NO;
}
}
/* get target login information, default to root */
user = *argv ? *argv : "root";
np = *argv ? argv : argv-1;
@ -291,7 +291,7 @@ badlogin:
if (pwd->pw_change || pwd->pw_expire)
(void)gettimeofday(&tp, (struct timezone *)NULL);
if (pwd->pw_change)
if (pwd->pw_change) {
if (tp.tv_sec >= pwd->pw_change) {
(void)printf("%s -- %s's password has expired.\n",
(ruid ? "Sorry" : "Note"), user);
@ -301,7 +301,8 @@ badlogin:
_PASSWORD_WARNDAYS * SECSPERDAY)
(void)printf("Warning: %s's password expires on %s",
user, ctime(&pwd->pw_change));
if (pwd->pw_expire)
}
if (pwd->pw_expire) {
if (tp.tv_sec >= pwd->pw_expire) {
(void)printf("%s -- %s's account has expired.\n",
(ruid ? "Sorry" : "Note"), user);
@ -311,7 +312,7 @@ badlogin:
_PASSWORD_WARNDAYS * SECSPERDAY)
(void)printf("Warning: %s's account expires on %s",
user, ctime(&pwd->pw_expire));
}
if (ruid != 0)
syslog(LOG_NOTICE|LOG_AUTH, "%s to %s%s",
username, user, ontty());

View File

@ -1,4 +1,4 @@
/* $NetBSD: netstat.c,v 1.9 1998/07/12 05:59:00 mrg Exp $ */
/* $NetBSD: netstat.c,v 1.10 1998/08/25 20:59:40 ross Exp $ */
/*-
* Copyright (c) 1980, 1992, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)netstat.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: netstat.c,v 1.9 1998/07/12 05:59:00 mrg Exp $");
__RCSID("$NetBSD: netstat.c,v 1.10 1998/08/25 20:59:40 ross Exp $");
#endif /* not lint */
/*
@ -363,13 +363,14 @@ shownetstat()
mvwaddstr(wnd, p->ni_line, PROTO, p->ni_proto);
mvwprintw(wnd, p->ni_line, RCVCC, "%6d", p->ni_rcvcc);
mvwprintw(wnd, p->ni_line, SNDCC, "%6d", p->ni_sndcc);
if (streq(p->ni_proto, "tcp"))
if (streq(p->ni_proto, "tcp")) {
if (p->ni_state < 0 || p->ni_state >= TCP_NSTATES)
mvwprintw(wnd, p->ni_line, STATE, "%d",
p->ni_state);
else
mvwaddstr(wnd, p->ni_line, STATE,
tcpstates[p->ni_state]);
}
wclrtoeol(wnd);
}
if (lastrow < getmaxy(wnd)) {

View File

@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
#if 0
static char sccsid[] = "@(#)tail.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: tail.c,v 1.6 1998/02/09 22:39:43 cjs Exp $");
__RCSID("$NetBSD: tail.c,v 1.7 1998/08/25 20:59:41 ross Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -158,7 +158,7 @@ main(argc, argv)
* If style not specified, the default is the whole file for -r, and
* the last 10 lines if not -r.
*/
if (style == NOTSET)
if (style == NOTSET) {
if (rflag) {
off = 0;
style = REVERSE;
@ -166,7 +166,7 @@ main(argc, argv)
off = 10;
style = RLINES;
}
}
if (*argv)
for (first = 1; (fname = *argv++) != NULL;) {
if ((fp = fopen(fname, "r")) == NULL ||

View File

@ -1,4 +1,4 @@
/* $NetBSD: tcopy.c,v 1.7 1997/10/20 03:25:26 mrg Exp $ */
/* $NetBSD: tcopy.c,v 1.8 1998/08/25 20:59:41 ross Exp $ */
/*
* Copyright (c) 1985, 1987, 1993, 1995
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1985, 1987, 1993\n\
#if 0
static char sccsid[] = "@(#)tcopy.c 8.3 (Berkeley) 1/23/95";
#endif
__RCSID("$NetBSD: tcopy.c,v 1.7 1997/10/20 03:25:26 mrg Exp $");
__RCSID("$NetBSD: tcopy.c,v 1.8 1998/08/25 20:59:41 ross Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -296,11 +296,12 @@ 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", (long long)(tsize + size));
exit(1);

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmds.c,v 1.11 1998/07/12 09:59:29 mrg Exp $ */
/* $NetBSD: cmds.c,v 1.12 1998/08/25 20:59:41 ross Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)cmds.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: cmds.c,v 1.11 1998/07/12 09:59:29 mrg Exp $");
__RCSID("$NetBSD: cmds.c,v 1.12 1998/08/25 20:59:41 ross Exp $");
#endif /* not lint */
#include "tip.h"
@ -385,11 +385,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);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: log.c,v 1.7 1998/07/26 22:27:42 mycroft Exp $ */
/* $NetBSD: log.c,v 1.8 1998/08/25 20:59:41 ross Exp $ */
/*
* Copyright (c) 1983, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)log.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: log.c,v 1.7 1998/07/26 22:27:42 mycroft Exp $");
__RCSID("$NetBSD: log.c,v 1.8 1998/08/25 20:59:41 ross Exp $");
#endif /* not lint */
#include "tip.h"
@ -65,11 +65,12 @@ logent(group, num, acu, message)
perror("tip: flock");
return;
}
if ((user = getlogin()) == NULL)
if ((user = getlogin()) == NULL) {
if ((pwd = getpwuid(getuid())) == NULL)
user = "???";
else
user = pwd->pw_name;
}
t = time(0);
timestamp = ctime(&t);
timestamp[24] = '\0';

View File

@ -1,4 +1,4 @@
/* $NetBSD: remote.c,v 1.7 1997/11/22 07:28:45 lukem Exp $ */
/* $NetBSD: remote.c,v 1.8 1998/08/25 20:59:41 ross Exp $ */
/*
* Copyright (c) 1992, 1993
@ -44,7 +44,7 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)remote.c 8.1 (Berkeley) 6/6/93";
#endif
__RCSID("$NetBSD: remote.c,v 1.7 1997/11/22 07:28:45 lukem Exp $");
__RCSID("$NetBSD: remote.c,v 1.8 1998/08/25 20:59:41 ross Exp $");
#endif /* not lint */
#include "pathnames.h"
@ -80,7 +80,7 @@ getremcap(host)
int stat;
rempath = getenv("REMOTE");
if (rempath != NULL)
if (rempath != NULL) {
if (*rempath != '/')
/* we have an entry */
cgetset(rempath);
@ -88,7 +88,7 @@ getremcap(host)
db_array[1] = rempath;
db_array[2] = _PATH_REMOTE;
}
}
if ((stat = cgetent(&bp, db_array, host)) < 0) {
if (DV ||
(host[0] == '/' && access(DV = host, R_OK | W_OK) == 0)) {

View File

@ -1,4 +1,4 @@
/* $NetBSD: touch.c,v 1.21 1998/01/21 00:48:44 mycroft Exp $ */
/* $NetBSD: touch.c,v 1.22 1998/08/25 20:59:42 ross Exp $ */
/*
* Copyright (c) 1993
@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\n\
#if 0
static char sccsid[] = "@(#)touch.c 8.2 (Berkeley) 4/28/95";
#endif
__RCSID("$NetBSD: touch.c,v 1.21 1998/01/21 00:48:44 mycroft Exp $");
__RCSID("$NetBSD: touch.c,v 1.22 1998/08/25 20:59:42 ross Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -153,7 +153,7 @@ main(argc, argv)
for (rval = 0; *argv; ++argv) {
/* See if the file exists. */
if ((*get_file_status)(*argv, &sb))
if ((*get_file_status)(*argv, &sb)) {
if (!cflag) {
/* Create the file. */
fd = open(*argv,
@ -169,7 +169,7 @@ main(argc, argv)
continue;
} else
continue;
}
if (!aflag)
TIMESPEC_TO_TIMEVAL(&tv[0], &sb.st_atimespec);
if (!mflag)

View File

@ -1,4 +1,4 @@
/* $NetBSD: term.c,v 1.10 1998/07/26 23:09:50 mycroft Exp $ */
/* $NetBSD: term.c,v 1.11 1998/08/25 20:59:42 ross Exp $ */
/*-
* Copyright (c) 1991, 1993
@ -38,7 +38,7 @@
#if 0
static char sccsid[] = "@(#)term.c 8.1 (Berkeley) 6/9/93";
#endif
__RCSID("$NetBSD: term.c,v 1.10 1998/07/26 23:09:50 mycroft Exp $");
__RCSID("$NetBSD: term.c,v 1.11 1998/08/25 20:59:42 ross Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -109,12 +109,12 @@ found: if ((p = getenv("TERMCAP")) != NULL && *p != '/')
* ttype now contains a pointer to the type of the terminal.
* If the first character is '?', ask the user.
*/
if (ttype[0] == '?')
if (ttype[0] == '?') {
if (ttype[1] != '\0')
ttype = askuser(ttype + 1);
else
ttype = askuser(NULL);
}
/* Find the termcap entry. If it doesn't exist, ask the user. */
while ((rval = tgetent(tbuf, ttype)) == 0) {
warnx("terminal type %s is unknown", ttype);

View File

@ -1,4 +1,4 @@
/* $NetBSD: tsort.c,v 1.12 1997/10/20 01:09:54 lukem Exp $ */
/* $NetBSD: tsort.c,v 1.13 1998/08/25 20:59:42 ross Exp $ */
/*
* Copyright (c) 1989, 1993, 1994
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993, 1994\n\
#if 0
static char sccsid[] = "@(#)tsort.c 8.3 (Berkeley) 5/4/95";
#endif
__RCSID("$NetBSD: tsort.c,v 1.12 1997/10/20 01:09:54 lukem Exp $");
__RCSID("$NetBSD: tsort.c,v 1.13 1998/08/25 20:59:42 ross Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -344,8 +344,8 @@ tsort()
if (cycle_buf == NULL || longest_cycle == NULL)
err(1, "malloc");
}
for (n = graph; n != NULL; n = n->n_next)
if (!(n->n_flags & NF_ACYCLIC))
for (n = graph; n != NULL; n = n->n_next) {
if (!(n->n_flags & NF_ACYCLIC)) {
if ((cnt = find_cycle(n, n, 0, 0)) != 0) {
if (!quiet) {
warnx("cycle in data");
@ -361,7 +361,8 @@ tsort()
n->n_flags |= NF_ACYCLIC;
clear_cycle();
}
}
}
if (n == NULL)
errx(1, "internal error -- could not find cycle");
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: cmd.c,v 1.5 1997/11/21 08:35:44 lukem Exp $ */
/* $NetBSD: cmd.c,v 1.6 1998/08/25 20:59:42 ross Exp $ */
/*
* Copyright (c) 1983, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)cmd.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: cmd.c,v 1.5 1997/11/21 08:35:44 lukem Exp $");
__RCSID("$NetBSD: cmd.c,v 1.6 1998/08/25 20:59:42 ross Exp $");
#endif
#endif /* not lint */
@ -290,12 +290,13 @@ void
setterse(new)
char new;
{
if (incmd)
if (incmd) {
if (new && !terse) {
wwdelete(cmdwin);
reframe();
} else if (!new && terse)
wwadd(cmdwin, &wwhead);
}
terse = new;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lcmd2.c,v 1.8 1997/11/21 08:36:05 lukem Exp $ */
/* $NetBSD: lcmd2.c,v 1.9 1998/08/25 20:59:42 ross Exp $ */
/*
* Copyright (c) 1983, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)lcmd2.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: lcmd2.c,v 1.8 1997/11/21 08:36:05 lukem Exp $");
__RCSID("$NetBSD: lcmd2.c,v 1.9 1998/08/25 20:59:42 ross Exp $");
#endif
#endif /* not lint */
@ -288,11 +288,12 @@ l_def_shell(v, a)
p_memerror();
break;
}
if ((default_shellfile = *default_shell))
if ((default_shellfile = *default_shell)) {
if ((*default_shell = strrchr(default_shellfile, '/')))
(*default_shell)++;
else
*default_shell = default_shellfile;
}
}
struct lcmd_arg arg_alias[] = {

View File

@ -1,4 +1,4 @@
/* $NetBSD: parser2.c,v 1.4 1997/11/21 08:36:12 lukem Exp $ */
/* $NetBSD: parser2.c,v 1.5 1998/08/25 20:59:42 ross Exp $ */
/*
* Copyright (c) 1983, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)parser2.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: parser2.c,v 1.4 1997/11/21 08:36:12 lukem Exp $");
__RCSID("$NetBSD: parser2.c,v 1.5 1998/08/25 20:59:42 ross Exp $");
#endif
#endif /* not lint */
@ -70,7 +70,7 @@ p_function(name, v, flag)
struct value av[LCMD_NARG + 1];
struct value *vp;
if (name != 0)
if (name != 0) {
if ((c = lcmd_lookup(name)))
name = c->lc_name;
else if ((a = alias_lookup(name)))
@ -79,7 +79,7 @@ p_function(name, v, flag)
p_error("%s: No such command or alias.", name);
flag = 0;
}
}
for (vp = av; vp < &av[LCMD_NARG + 1]; vp++)
vp->v_type = V_ERR;
@ -190,10 +190,10 @@ p_function(name, v, flag)
else if (token != T_EOL && token != T_EOF)
flag = 0; /* look for legal follow set */
v->v_type = V_ERR;
if (flag)
if (flag) {
if (c != 0)
(*c->lc_func)(v, av);
else
else {
if (a->a_flags & A_INUSE)
p_error("%s: Recursive alias.", a->a_name);
else {
@ -202,6 +202,8 @@ p_function(name, v, flag)
p_memerror();
a->a_flags &= ~A_INUSE;
}
}
}
if (p_abort()) {
val_free(*v);
v->v_type = V_ERR;

View File

@ -1,4 +1,4 @@
/* $NetBSD: scanner.c,v 1.4 1997/11/21 08:36:17 lukem Exp $ */
/* $NetBSD: scanner.c,v 1.5 1998/08/25 20:59:43 ross Exp $ */
/*
* Copyright (c) 1983, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)scanner.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: scanner.c,v 1.4 1997/11/21 08:36:17 lukem Exp $");
__RCSID("$NetBSD: scanner.c,v 1.5 1998/08/25 20:59:43 ross Exp $");
#endif
#endif /* not lint */
@ -317,12 +317,20 @@ loop:
&& buf[3] == 'i' && buf[4] == 'f'
&& buf[5] == 0)
cx.x_token = T_ENDIF;
else if (buf[1] == 'l' && buf[2] == 's')
if (buf[3] == 'i' && buf[4] == 'f'
&& buf[5] == 0)
cx.x_token = T_ELSIF;
else if (buf[3] == 'e' && buf[4] == 0)
cx.x_token = T_ELSE;
else {
if (buf[1] == 'l' && buf[2] == 's') {
if (buf[3] == 'i'
&& buf[4] == 'f'
&& buf[5] == 0)
cx.x_token = T_ELSIF;
else {
if (buf[3] == 'e'
&& buf[4] == 0)
cx.x_token =
T_ELSE;
}
}
}
break;
}
if (cx.x_token == T_STR

View File

@ -1,4 +1,4 @@
/* $NetBSD: ttgeneric.c,v 1.4 1997/11/21 08:36:28 lukem Exp $ */
/* $NetBSD: ttgeneric.c,v 1.5 1998/08/25 20:59:43 ross Exp $ */
/*
* Copyright (c) 1983, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)ttgeneric.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: ttgeneric.c,v 1.4 1997/11/21 08:36:28 lukem Exp $");
__RCSID("$NetBSD: ttgeneric.c,v 1.5 1998/08/25 20:59:43 ross Exp $");
#endif
#endif /* not lint */
@ -237,13 +237,14 @@ gen_putc(c)
if (tt.tt_nmodes != tt.tt_modes)
gen_setmodes(tt.tt_nmodes);
ttputc(c);
if (++tt.tt_col == gen_CO)
if (++tt.tt_col == gen_CO) {
if (gen_XN)
tt.tt_col = tt.tt_row = -10;
else if (gen_AM)
tt.tt_col = 0, tt.tt_row++;
else
tt.tt_col--;
}
}
void
@ -257,13 +258,14 @@ gen_write(p, n)
gen_setmodes(tt.tt_nmodes);
ttwrite(p, n);
tt.tt_col += n;
if (tt.tt_col == gen_CO)
if (tt.tt_col == gen_CO) {
if (gen_XN)
tt.tt_col = tt.tt_row = -10;
else if (gen_AM)
tt.tt_col = 0, tt.tt_row++;
else
tt.tt_col--;
}
}
void
@ -377,13 +379,14 @@ gen_inschar(c)
ttputc(c);
if (gen_IP)
tttputs(gen_IP, gen_CO - tt.tt_col);
if (++tt.tt_col == gen_CO)
if (++tt.tt_col == gen_CO) {
if (gen_XN)
tt.tt_col = tt.tt_row = -10;
else if (gen_AM)
tt.tt_col = 0, tt.tt_row++;
else
tt.tt_col--;
}
}
void
@ -508,13 +511,14 @@ tt_generic()
/*
* Deal with obsolete termcap fields.
*/
if (gen_LE == 0)
if (gen_LE == 0) {
if (gen_BC)
gen_LE = gen_BC;
else if (gen_BS) {
static struct tt_str bc = { "\b", 1 };
gen_BC = &bc;
}
}
if (gen_NL == 0) {
static struct tt_str nl = { "\n", 1 };
gen_NL = &nl;

View File

@ -1,4 +1,4 @@
/* $NetBSD: win.c,v 1.9 1997/11/21 08:36:48 lukem Exp $ */
/* $NetBSD: win.c,v 1.10 1998/08/25 20:59:43 ross Exp $ */
/*
* Copyright (c) 1983, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)win.c 8.1 (Berkeley) 6/6/93";
#else
__RCSID("$NetBSD: win.c,v 1.9 1997/11/21 08:36:48 lukem Exp $");
__RCSID("$NetBSD: win.c,v 1.10 1998/08/25 20:59:43 ross Exp $");
#endif
#endif /* not lint */
@ -163,12 +163,13 @@ closewin(w)
didit++;
}
if (didit) {
if (selwin == 0)
if (selwin == 0) {
if (lastselwin != 0) {
setselwin(lastselwin);
lastselwin = 0;
} else if ((w = findselwin()))
setselwin(w);
}
if (lastselwin == 0 && selwin)
if ((w = findselwin()))
lastselwin = w;

View File

@ -1,4 +1,4 @@
/* $NetBSD: wwopen.c,v 1.8 1998/07/18 05:04:39 lukem Exp $ */
/* $NetBSD: wwopen.c,v 1.9 1998/08/25 20:59:43 ross Exp $ */
/*
* Copyright (c) 1983, 1993
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)wwopen.c 8.2 (Berkeley) 4/28/95";
#else
__RCSID("$NetBSD: wwopen.c,v 1.8 1998/07/18 05:04:39 lukem Exp $");
__RCSID("$NetBSD: wwopen.c,v 1.9 1998/08/25 20:59:43 ross Exp $");
#endif
#endif /* not lint */
@ -142,11 +142,11 @@ wwopen(type, oflags, nrow, ncol, row, col, nline)
m = 0;
if (oflags & WWO_GLASS)
m |= WWM_GLS;
if (oflags & WWO_REVERSE)
if (oflags & WWO_REVERSE) {
if (wwavailmodes & WWM_REV)
m |= WWM_REV;
else
oflags &= ~WWO_REVERSE;
else oflags &= ~WWO_REVERSE;
}
for (i = w->ww_w.t; i < w->ww_w.b; i++)
for (j = w->ww_w.l; j < w->ww_w.r; j++)
w->ww_win[i][j] = m;

View File

@ -1,4 +1,4 @@
/* $NetBSD: write.c,v 1.13 1998/07/26 23:16:14 mycroft Exp $ */
/* $NetBSD: write.c,v 1.14 1998/08/25 20:59:43 ross Exp $ */
/*
* Copyright (c) 1989, 1993
@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\n\
#if 0
static char sccsid[] = "@(#)write.c 8.2 (Berkeley) 4/27/95";
#else
__RCSID("$NetBSD: write.c,v 1.13 1998/07/26 23:16:14 mycroft Exp $");
__RCSID("$NetBSD: write.c,v 1.14 1998/08/25 20:59:43 ross Exp $");
#endif
#endif /* not lint */
@ -264,12 +264,11 @@ do_write(tty, mytty, myuid)
char path[MAXPATHLEN], host[MAXHOSTNAMELEN + 1], line[512];
/* Determine our login name before the we reopen() stdout */
if ((login = getlogin()) == NULL)
if ((login = getlogin()) == NULL) {
if ((pwd = getpwuid(myuid)) != NULL)
login = pwd->pw_name;
else
login = "???";
else login = "???";
}
(void)snprintf(path, sizeof path, "/dev/%s", tty);
if ((freopen(path, "w", stdout)) == NULL)
err(1, "%s", path);

View File

@ -1,4 +1,4 @@
/* $NetBSD: mkpar.c,v 1.5 1997/07/25 16:46:35 perry Exp $ */
/* $NetBSD: mkpar.c,v 1.6 1998/08/25 20:59:44 ross Exp $ */
/*
* Copyright (c) 1989 The Regents of the University of California.
@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)mkpar.c 5.3 (Berkeley) 1/20/91";
#else
__RCSID("$NetBSD: mkpar.c,v 1.5 1997/07/25 16:46:35 perry Exp $");
__RCSID("$NetBSD: mkpar.c,v 1.6 1998/08/25 20:59:44 ross Exp $");
#endif
#endif /* not lint */
@ -250,11 +250,12 @@ unused_rules()
for (i = 3; i < nrules; ++i)
if (!rules_used[i]) ++nunused;
if (nunused)
if (nunused) {
if (nunused == 1)
fprintf(stderr, "%s: 1 rule never reduced\n", myname);
else
fprintf(stderr, "%s: %d rules never reduced\n", myname, nunused);
}
}