diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-07-28 19:15:35 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 2003-07-28 19:15:35 +0000 |
commit | 68ed9b1964d6347d1059cd69a7f5dee36e1451b9 (patch) | |
tree | b4edae755d7875c5bd6ac78bc85e84a443ad7da7 /usr.bin | |
parent | 8cbceee28755586acde5bcbd73e719d87b265df4 (diff) |
minor knf and cleanups; otto ok
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/patch/common.h | 4 | ||||
-rw-r--r-- | usr.bin/patch/inp.c | 9 | ||||
-rw-r--r-- | usr.bin/patch/patch.c | 16 | ||||
-rw-r--r-- | usr.bin/patch/pch.c | 24 |
4 files changed, 25 insertions, 28 deletions
diff --git a/usr.bin/patch/common.h b/usr.bin/patch/common.h index e1d6b048c79..00863b57b6e 100644 --- a/usr.bin/patch/common.h +++ b/usr.bin/patch/common.h @@ -1,4 +1,4 @@ -/* $OpenBSD: common.h,v 1.19 2003/07/28 18:35:36 otto Exp $ */ +/* $OpenBSD: common.h,v 1.20 2003/07/28 19:15:34 deraadt Exp $ */ #define DEBUGGING @@ -37,7 +37,7 @@ typedef long LINENUM; /* must be signed */ /* globals */ -extern int filemode; +extern int filemode; extern char buf[MAXLINELEN];/* general purpose buffer */ diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c index 1c071cef62d..9e81fd9b2be 100644 --- a/usr.bin/patch/inp.c +++ b/usr.bin/patch/inp.c @@ -1,7 +1,7 @@ -/* $OpenBSD: inp.c,v 1.19 2003/07/28 18:35:36 otto Exp $ */ +/* $OpenBSD: inp.c,v 1.20 2003/07/28 19:15:34 deraadt Exp $ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: inp.c,v 1.19 2003/07/28 18:35:36 otto Exp $"; +static const char rcsid[] = "$OpenBSD: inp.c,v 1.20 2003/07/28 19:15:34 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -85,7 +85,7 @@ plan_a(const char *filename) int ifd, statfailed; char *s, lbuf[MAXLINELEN]; LINENUM iline; - struct stat filestat; + struct stat filestat; if (filename == NULL || *filename == '\0') return FALSE; @@ -220,8 +220,7 @@ plan_a(const char *filename) i_ptr[iline] = i_womp; for (s = i_womp; *s; s++) { if (*s == '\n') - i_ptr[++iline] = s + 1; /* these are NOT null - * terminated */ + i_ptr[++iline] = s + 1; /* these are NOT NUL terminated */ } input_lines = iline - 1; diff --git a/usr.bin/patch/patch.c b/usr.bin/patch/patch.c index 3824ac9da15..096a3e8388f 100644 --- a/usr.bin/patch/patch.c +++ b/usr.bin/patch/patch.c @@ -1,4 +1,4 @@ -/* $OpenBSD: patch.c,v 1.29 2003/07/28 18:28:52 otto Exp $ */ +/* $OpenBSD: patch.c,v 1.30 2003/07/28 19:15:34 deraadt Exp $ */ /* * patch - a program to apply diffs to original files @@ -27,7 +27,7 @@ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: patch.c,v 1.29 2003/07/28 18:28:52 otto Exp $"; +static const char rcsid[] = "$OpenBSD: patch.c,v 1.30 2003/07/28 19:15:34 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -48,7 +48,7 @@ static const char rcsid[] = "$OpenBSD: patch.c,v 1.29 2003/07/28 18:28:52 otto E #include "inp.h" #include "backupfile.h" -int filemode = 0644; +int filemode = 0644; char buf[MAXLINELEN]; /* general purpose buffer */ @@ -69,7 +69,7 @@ bool toutkeep = FALSE; bool trejkeep = FALSE; #ifdef DEBUGGING -int debug = 0; +int debug = 0; #endif bool force = FALSE; @@ -288,7 +288,7 @@ main(int argc, char *argv[]) } } } while (!skip_rest_of_patch && where == 0 && - ++fuzz <= mymaxfuzz); + ++fuzz <= mymaxfuzz); if (skip_rest_of_patch) { /* just got decided */ fclose(ofp); @@ -862,7 +862,7 @@ dump_line(LINENUM line) s = ifetch(line, 0); if (s == NULL) return; - /* Note: string is not null terminated. */ + /* Note: string is not NUL terminated. */ for (; putc(*s, ofp) != '\n'; s++) ; } @@ -877,8 +877,8 @@ patch_match(LINENUM base, LINENUM offset, LINENUM fuzz) LINENUM iline; LINENUM pat_lines = pch_ptrn_lines() - fuzz; const char *ilineptr; - const char *plineptr; - short plinelen; + const char *plineptr; + short plinelen; for (iline = base + offset + fuzz; pline <= pat_lines; pline++, iline++) { ilineptr = ifetch(iline, offset >= 0); diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c index 9531be141c7..be863a9ba9d 100644 --- a/usr.bin/patch/pch.c +++ b/usr.bin/patch/pch.c @@ -1,7 +1,7 @@ -/* $OpenBSD: pch.c,v 1.25 2003/07/28 18:35:36 otto Exp $ */ +/* $OpenBSD: pch.c,v 1.26 2003/07/28 19:15:34 deraadt Exp $ */ #ifndef lint -static const char rcsid[] = "$OpenBSD: pch.c,v 1.25 2003/07/28 18:35:36 otto Exp $"; +static const char rcsid[] = "$OpenBSD: pch.c,v 1.26 2003/07/28 19:15:34 deraadt Exp $"; #endif /* not lint */ #include <sys/types.h> @@ -256,8 +256,7 @@ intuit_diff_type(void) else if (strnEQ(s, "--- ", 4)) newtmp = savestr(s + 4); else if (strnEQ(s, "+++ ", 4)) - oldtmp = savestr(s + 4); /* pretend it is the old - * name */ + oldtmp = savestr(s + 4); /* pretend it is the old name */ else if (strnEQ(s, "Index:", 6)) indtmp = savestr(s + 6); else if (strnEQ(s, "Prereq:", 7)) { @@ -549,8 +548,9 @@ another_hunk(void) p_ptrn_lines = 0; p_first = 1; } - p_max = p_ptrn_lines + 6; /* we need this much at - * least */ + + /* we need this much at least */ + p_max = p_ptrn_lines + 6; while (p_max >= hunkmax) grow_hunkmax(); p_max = hunkmax; @@ -742,8 +742,7 @@ hunk_done: filldst++; } #if 0 - repl_beginning--; /* this doesn't need to be - * fixed */ + repl_beginning--; /* this doesn't need to be fixed */ #endif p_end--; p_first++; /* do append rather than insert */ @@ -761,8 +760,7 @@ hunk_done: } /* if there were omitted context lines, fill them in now */ if (fillcnt) { - p_bfake = filldst; /* remember where not to - * free() */ + p_bfake = filldst; /* remember where not to free() */ p_efake = filldst + fillcnt - 1; while (fillcnt-- > 0) { while (fillsrc <= p_end && p_char[fillsrc] != ' ') @@ -843,7 +841,7 @@ hunk_done: filldst = fillsrc + p_ptrn_lines; p_end = filldst + p_repl_lines; snprintf(buf, sizeof buf, "*** %ld,%ld ****\n", p_first, - p_first + p_ptrn_lines - 1); + p_first + p_ptrn_lines - 1); p_line[0] = savestr(buf); if (out_of_mem) { p_end = -1; @@ -851,7 +849,7 @@ hunk_done: } p_char[0] = '*'; snprintf(buf, sizeof buf, "--- %ld,%ld ----\n", p_newfirst, - p_newfirst + p_repl_lines - 1); + p_newfirst + p_repl_lines - 1); p_line[filldst] = savestr(buf); if (out_of_mem) { p_end = 0; @@ -997,7 +995,7 @@ hunk_done: p_newfirst = min; p_repl_lines = max - min + 1; snprintf(buf, sizeof buf, "*** %ld,%ld\n", p_first, - p_first + p_ptrn_lines - 1); + p_first + p_ptrn_lines - 1); p_line[0] = savestr(buf); if (out_of_mem) { p_end = -1; |