diff options
author | joerg <joerg@FreeBSD.org> | 1995-03-19 13:29:28 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 1995-03-19 13:29:28 +0000 |
commit | c6030c6511c69b69a216c893957b01bfc264d365 (patch) | |
tree | 163891f0a6f18e48e3d38e4d107ad82c2f5c570a /bin/ed | |
parent | 568f2efc88b72b511e26d42250ac4250a6610415 (diff) | |
download | FreeBSD-src-c6030c6511c69b69a216c893957b01bfc264d365.zip FreeBSD-src-c6030c6511c69b69a216c893957b01bfc264d365.tar.gz |
You will find enclosed some changes to make gcc -Wall more happy in
/usr/src/bin. Note that some patches are still needed in that directory.
I (Joerg) finished most of Philippe's cleanup. /bin/sh will still
need *allot* of work, however.
Submitted by: charnier@lirmm.fr (Philippe Charnier)
Diffstat (limited to 'bin/ed')
-rw-r--r-- | bin/ed/cbc.c | 10 | ||||
-rw-r--r-- | bin/ed/glbl.c | 6 | ||||
-rw-r--r-- | bin/ed/io.c | 8 | ||||
-rw-r--r-- | bin/ed/main.c | 18 | ||||
-rw-r--r-- | bin/ed/re.c | 4 | ||||
-rw-r--r-- | bin/ed/sub.c | 9 |
6 files changed, 31 insertions, 24 deletions
diff --git a/bin/ed/cbc.c b/bin/ed/cbc.c index 11a8027..62fcd99 100644 --- a/bin/ed/cbc.c +++ b/bin/ed/cbc.c @@ -35,7 +35,7 @@ * SUCH DAMAGE. * * from: @(#)bdes.c 5.5 (Berkeley) 6/27/91 - * $Id$ + * $Id: cbc.c,v 1.4 1994/09/24 02:55:24 davidg Exp $ */ #ifndef lint @@ -115,7 +115,7 @@ init_des_cipher() des_ct = des_n = 0; - /* initialize the initialization vctor */ + /* initialize the initialization vector */ MEMZERO(ivec, 8); /* intialize the padding vector */ @@ -137,6 +137,8 @@ get_des_char(fp) des_ct = cbc_decode(des_buf, fp); } return (des_ct > 0) ? des_buf[des_n++] : EOF; +#else + return (getc(fp)); #endif } @@ -153,6 +155,8 @@ put_des_char(c, fp) des_n = 0; } return (des_ct >= 0) ? (des_buf[des_n++] = c) : EOF; +#else + return (fputc(c, fp)); #endif } @@ -168,6 +172,8 @@ flush_des_file(fp) des_n = 0; } return (des_ct >= 0 && cbc_encode(des_buf, des_n, fp) >= 0) ? 0 : EOF; +#else + return (fflush(fp)); #endif } diff --git a/bin/ed/glbl.c b/bin/ed/glbl.c index b57bee4..525411d 100644 --- a/bin/ed/glbl.c +++ b/bin/ed/glbl.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: glbl.c,v 1.2 1994/09/24 02:55:26 davidg Exp $ */ #ifndef lint @@ -132,8 +132,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 0c98504c..1072d06 100644 --- a/bin/ed/io.c +++ b/bin/ed/io.c @@ -24,7 +24,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: io.c,v 1.3 1994/09/24 02:55:27 davidg Exp $ */ #ifndef lint @@ -106,7 +106,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; @@ -128,8 +128,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; diff --git a/bin/ed/main.c b/bin/ed/main.c index 9ef9db2..d43efad 100644 --- a/bin/ed/main.c +++ b/bin/ed/main.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: main.c,v 1.3 1994/09/24 02:55:28 davidg Exp $ */ #ifndef lint @@ -154,9 +154,9 @@ top: signal(SIGQUIT, SIG_IGN); signal(SIGINT, signal_int); #ifdef _POSIX_SOURCE - if (status = sigsetjmp(env, 1)) + if ((status = sigsetjmp(env, 1))) #else - if (status = setjmp(env)) + if ((status = setjmp(env))) #endif { fputs("\n?\n", stderr); @@ -213,7 +213,7 @@ top: isglobal = 0; if ((status = extract_addr_range()) >= 0 && (status = exec_command()) >= 0) - if (!status || status && + if (!status || (status = display_lines(current_addr, current_addr, status)) >= 0) continue; @@ -544,7 +544,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) @@ -840,7 +840,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) { @@ -902,7 +902,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; @@ -910,7 +910,7 @@ get_matching_node_addr(pat, dir) NUL_TO_NEWLINE(s, lp->len); if (!regexec(pat, s, 0, NULL, 0)) return n; - } + } } while (n != current_addr); sprintf(errmsg, "no match"); return ERR; @@ -1339,7 +1339,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)) s++; return file; } diff --git a/bin/ed/re.c b/bin/ed/re.c index 779bdd5..805f59f 100644 --- a/bin/ed/re.c +++ b/bin/ed/re.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id$ + * $Id: re.c,v 1.8 1994/09/24 02:55:29 davidg Exp $ */ #ifndef lint @@ -67,7 +67,7 @@ get_compiled_pattern() return NULL; } patlock = 0; - if (n = regcomp(exp, exps, 0)) { + if ((n = regcomp(exp, exps, 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 c23e4a2..904bc6a 100644 --- a/bin/ed/sub.c +++ b/bin/ed/sub.c @@ -25,7 +25,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: sub.c,v 1.3 1994/09/24 02:55:31 davidg Exp $ + * $Id: sub.c,v 1.4 1995/01/14 11:47:16 alm Exp $ */ #ifndef lint @@ -97,7 +97,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; @@ -213,8 +213,9 @@ substitute_matching_text(pat, lp, gflag, kth) off += i; } txt += rm[0].rm_eo; - } while (*txt && (!changed || (gflag & GSG) && rm[0].rm_eo) && - !regexec(pat, txt, SE_MAX, rm, REG_NOTBOL)); + } 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); if (i > 0 && !rm[0].rm_eo && (gflag & GSG)) { |