commands/fix: change K&R to ANSI style.

Change-Id: I0a6d7e39e95a157a80567aeea90f8fa4a188ee7d
This commit is contained in:
Beletti 2013-11-16 02:52:10 +00:00 committed by Thomas Cort
parent 0c745990d9
commit 4a70ffda08

View file

@ -1,5 +1,6 @@
/* fix file difflist - update file from difflist Author: Erik Baalbergen */ /* 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 /* Notes: files old and old.patch are equal after the following commands
diff old new > difflist diff old new > difflist
@ -46,7 +47,7 @@ int getcommand(FILE *fp, int *o1, int *o2, char *pcmd, int *n1, int
*n2); *n2);
void fatal(const char *s, ...); void fatal(const char *s, ...);
int strwcmp(char *s1, char *s2); int strwcmp(char *s1, char *s2);
int whitespace(int ch); int whitespace(char ch);
char * char *
getline(FILE *fp, char *b) getline(FILE *fp, char *b)
@ -113,9 +114,7 @@ int main(int argc, char **argv)
} }
char * char *
range(s, p1, p2) range(char *s, int *p1, int *p2)
char *s;
int *p1, *p2;
{ {
register int v1 = 0, v2; register int v1 = 0, v2;
@ -132,10 +131,7 @@ int *p1, *p2;
return s; return s;
} }
int getcommand(fp, o1, o2, pcmd, n1, n2) int getcommand(FILE *fp, int *o1, int *o2, char *pcmd, int *n1, int *n2)
FILE *fp;
int *o1, *o2, *n1, *n2;
char *pcmd;
{ {
char buf[LINELEN]; char buf[LINELEN];
register char *s; register char *s;
@ -166,8 +162,7 @@ void fatal(const char *s, ...)
} }
#else #else
/* the K&R lib does not have vfprintf */ /* the K&R lib does not have vfprintf */
void fatal(s, a) void fatal(const char *s, const char *a)
const char *s, *a;
{ {
fprintf(stderr, "%s: processing: %s fatal: ", prog, processing); fprintf(stderr, "%s: processing: %s fatal: ", prog, processing);
fprintf(stderr, s, a); fprintf(stderr, s, a);
@ -183,8 +178,7 @@ const char *s, *a;
tab conversion or trailing space removal tab conversion or trailing space removal
Bret Mckee June, 1988 */ Bret Mckee June, 1988 */
int strwcmp(s1, s2) int strwcmp(char *s1, char *s2)
char *s1, *s2;
{ {
char *x1 = s1, *x2 = s2; char *x1 = s1, *x2 = s2;
@ -206,8 +200,7 @@ char *s1, *s2;
return(*s1 - *s2); return(*s1 - *s2);
} }
int whitespace(ch) int whitespace(char ch)
char ch;
{ {
switch (ch) { switch (ch) {
case ' ': case ' ':