From 4a70ffda08404ff8baca2074cc9fb0f2e90f2a42 Mon Sep 17 00:00:00 2001 From: Beletti Date: Sat, 16 Nov 2013 02:52:10 +0000 Subject: [PATCH] commands/fix: change K&R to ANSI style. Change-Id: I0a6d7e39e95a157a80567aeea90f8fa4a188ee7d --- commands/fix/fix.c | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/commands/fix/fix.c b/commands/fix/fix.c index 5d101cc6b..40d730ff3 100644 --- a/commands/fix/fix.c +++ b/commands/fix/fix.c @@ -1,5 +1,6 @@ /* fix file difflist - update file from difflist Author: Erik Baalbergen */ - +/* Change all K&R-style functions declarations to ANSI-style +declarations - Author: Alexandre Beletti (rhiguita@gmail.com) */ /* Notes: files old and old.patch are equal after the following commands diff old new > difflist @@ -46,7 +47,7 @@ int getcommand(FILE *fp, int *o1, int *o2, char *pcmd, int *n1, int *n2); void fatal(const char *s, ...); int strwcmp(char *s1, char *s2); -int whitespace(int ch); +int whitespace(char ch); char * getline(FILE *fp, char *b) @@ -113,9 +114,7 @@ int main(int argc, char **argv) } char * - range(s, p1, p2) -char *s; -int *p1, *p2; + range(char *s, int *p1, int *p2) { register int v1 = 0, v2; @@ -132,10 +131,7 @@ int *p1, *p2; return s; } -int getcommand(fp, o1, o2, pcmd, n1, n2) -FILE *fp; -int *o1, *o2, *n1, *n2; -char *pcmd; +int getcommand(FILE *fp, int *o1, int *o2, char *pcmd, int *n1, int *n2) { char buf[LINELEN]; register char *s; @@ -166,8 +162,7 @@ void fatal(const char *s, ...) } #else /* the K&R lib does not have vfprintf */ -void fatal(s, a) -const char *s, *a; +void fatal(const char *s, const char *a) { fprintf(stderr, "%s: processing: %s fatal: ", prog, processing); fprintf(stderr, s, a); @@ -183,8 +178,7 @@ const char *s, *a; tab conversion or trailing space removal Bret Mckee June, 1988 */ -int strwcmp(s1, s2) -char *s1, *s2; +int strwcmp(char *s1, char *s2) { char *x1 = s1, *x2 = s2; @@ -206,8 +200,7 @@ char *s1, *s2; return(*s1 - *s2); } -int whitespace(ch) -char ch; +int whitespace(char ch) { switch (ch) { case ' ': -- 2.44.0