summaryrefslogtreecommitdiff
path: root/bin/ed
diff options
context:
space:
mode:
authorMichael Shalayeff <mickey@cvs.openbsd.org>1996-12-14 12:18:28 +0000
committerMichael Shalayeff <mickey@cvs.openbsd.org>1996-12-14 12:18:28 +0000
commit28e461d672204f54b8eb68a590d36c23a32f9574 (patch)
tree3e3c51ee95dec9ad261710930b40e4426389cbb8 /bin/ed
parentfb3035e3379d9258753316427b03a4d8d0676d07 (diff)
-Wall'ing.
Diffstat (limited to 'bin/ed')
-rw-r--r--bin/ed/glbl.c8
-rw-r--r--bin/ed/io.c12
-rw-r--r--bin/ed/main.c18
-rw-r--r--bin/ed/re.c6
-rw-r--r--bin/ed/sub.c8
5 files changed, 27 insertions, 25 deletions
diff --git a/bin/ed/glbl.c b/bin/ed/glbl.c
index b92b2ab1a5b..83c092c0435 100644
--- a/bin/ed/glbl.c
+++ b/bin/ed/glbl.c
@@ -1,4 +1,4 @@
-/* $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
@@ -33,7 +33,7 @@
#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 */
@@ -137,8 +137,8 @@ exec_global(interact, gflag)
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;
diff --git a/bin/ed/io.c b/bin/ed/io.c
index bee2ea7f5ad..c9e2ce12f82 100644
--- a/bin/ed/io.c
+++ b/bin/ed/io.c
@@ -1,4 +1,4 @@
-/* $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 */
@@ -32,7 +32,7 @@
#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 */
@@ -111,7 +111,7 @@ read_stream(fp, n)
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;
@@ -133,8 +133,8 @@ get_stream_line(fp)
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;
@@ -333,7 +333,9 @@ put_tty_line(s, l, n, gflag)
int gflag;
{
int col = 0;
+#ifndef BACKWARDS
int lc = 0;
+#endif
char *cp;
if (gflag & GNP) {
diff --git a/bin/ed/main.c b/bin/ed/main.c
index 0e7e6df6d3d..0400323cdf0 100644
--- a/bin/ed/main.c
+++ b/bin/ed/main.c
@@ -1,4 +1,4 @@
-/* $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
@@ -39,7 +39,7 @@ char *copyright =
#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 */
@@ -160,7 +160,7 @@ top:
#ifdef _POSIX_SOURCE
if (status = sigsetjmp(env, 1))
#else
- if (status = setjmp(env))
+ if ((status = setjmp(env)) != 0)
#endif
{
fputs("\n?\n", stderr);
@@ -217,9 +217,9 @@ top:
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:
@@ -548,7 +548,7 @@ exec_command()
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)
@@ -844,7 +844,7 @@ exec_command()
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) {
@@ -906,7 +906,7 @@ get_matching_node_addr(pat, dir)
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;
@@ -1343,7 +1343,7 @@ strip_escapes(s)
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;
}
diff --git a/bin/ed/re.c b/bin/ed/re.c
index 948a05980d9..276094b7d73 100644
--- a/bin/ed/re.c
+++ b/bin/ed/re.c
@@ -1,4 +1,4 @@
-/* $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
@@ -33,7 +33,7 @@
#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 */
@@ -73,7 +73,7 @@ get_compiled_pattern()
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;
diff --git a/bin/ed/sub.c b/bin/ed/sub.c
index e0fa18d54b9..c66c2258135 100644
--- a/bin/ed/sub.c
+++ b/bin/ed/sub.c
@@ -1,4 +1,4 @@
-/* $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
@@ -33,7 +33,7 @@
#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 */
@@ -103,7 +103,7 @@ extract_subst_template()
;
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;
@@ -219,7 +219,7 @@ substitute_matching_text(pat, lp, gflag, kth)
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);