diff options
author | Jim Meyering <jim@meyering.net> | 1996-01-06 11:44:05 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1996-01-06 11:44:05 +0000 |
commit | 53398947a1482e8b83e204186969af6147eaae6e (patch) | |
tree | bf4de064df1f022c2e01051b45cafc454ed839c4 /src | |
parent | 5e14cce7ae90f69cf4609b7731377e934e79c219 (diff) | |
download | coreutils-53398947a1482e8b83e204186969af6147eaae6e.tar.xz |
Protoize and __P-protect forward dcls.
Diffstat (limited to 'src')
-rw-r--r-- | src/basename.c | 14 | ||||
-rw-r--r-- | src/date.c | 19 | ||||
-rw-r--r-- | src/dirname.c | 7 | ||||
-rw-r--r-- | src/echo.c | 7 | ||||
-rw-r--r-- | src/env.c | 10 | ||||
-rw-r--r-- | src/expr.c | 80 | ||||
-rw-r--r-- | src/factor.c | 17 | ||||
-rw-r--r-- | src/hostname.c | 7 | ||||
-rw-r--r-- | src/id.c | 29 | ||||
-rw-r--r-- | src/logname.c | 7 | ||||
-rw-r--r-- | src/nice.c | 14 | ||||
-rw-r--r-- | src/pathchk.c | 21 | ||||
-rw-r--r-- | src/printenv.c | 7 | ||||
-rw-r--r-- | src/printf.c | 58 | ||||
-rw-r--r-- | src/pwd.c | 7 | ||||
-rw-r--r-- | src/seq.c | 26 | ||||
-rw-r--r-- | src/sleep.c | 12 | ||||
-rw-r--r-- | src/tee.c | 13 | ||||
-rw-r--r-- | src/test.c | 81 | ||||
-rw-r--r-- | src/tty.c | 9 | ||||
-rw-r--r-- | src/uname.c | 15 | ||||
-rw-r--r-- | src/whoami.c | 7 | ||||
-rw-r--r-- | src/yes.c | 7 |
23 files changed, 171 insertions, 303 deletions
diff --git a/src/basename.c b/src/basename.c index b16cf3ce4..ad2dcdad7 100644 --- a/src/basename.c +++ b/src/basename.c @@ -34,17 +34,16 @@ #include "long-options.h" #include "error.h" -char *basename (); +char *basename __P ((char *)); void strip_trailing_slashes (); -static void remove_suffix (); +static void remove_suffix __P ((register char *name, register char *suffix)); /* The name this program was run with. */ char *program_name; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, "Try `%s --help' for more information.\n", @@ -68,9 +67,7 @@ If specified, also remove a trailing SUFFIX.\n\ } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { char *name; @@ -100,8 +97,7 @@ main (argc, argv) consists entirely of SUFFIX. */ static void -remove_suffix (name, suffix) - register char *name, *suffix; +remove_suffix (register char *name, register char *suffix) { register char *np, *sp; diff --git a/src/date.c b/src/date.c index eabecd85c..635cf2c17 100644 --- a/src/date.c +++ b/src/date.c @@ -45,8 +45,8 @@ char *xrealloc (); time_t get_date (); time_t posixtime (); -static void show_date (); -static void usage (); +static void show_date __P ((const char *format, time_t when)); +static void usage __P (int status)); /* The name this program was run with, for error messages. */ char *program_name; @@ -77,9 +77,7 @@ static struct option const long_options[] = If any line cannot be parsed, return nonzero; otherwise return zero. */ static int -batch_convert (input_filename, format) - const char *input_filename; - const char *format; +batch_convert (const char *input_filename, const char *format) { int status; FILE *in_stream; @@ -138,9 +136,7 @@ batch_convert (input_filename, format) } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int optc; const char *datestr = NULL; @@ -301,9 +297,7 @@ non-option argument must be a format string beginning with `+'")); standard output format (ctime style but with a timezone inserted). */ static void -show_date (format, when) - const char *format; - time_t when; +show_date (const char *format, time_t when) { struct tm *tm; char *out = NULL; @@ -336,8 +330,7 @@ show_date (format, when) } static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), diff --git a/src/dirname.c b/src/dirname.c index 6cb5c9a7b..52ef010e5 100644 --- a/src/dirname.c +++ b/src/dirname.c @@ -32,8 +32,7 @@ void strip_trailing_slashes (); char *program_name; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -57,9 +56,7 @@ output `.' (meaning the current directory).\n\ } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { register char *path; register char *slash; diff --git a/src/echo.c b/src/echo.c index f0b7cd076..9a72b553a 100644 --- a/src/echo.c +++ b/src/echo.c @@ -64,8 +64,7 @@ on System V systems with the -E option. char *program_name; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -103,9 +102,7 @@ Without -E, the following sequences are recognized and interpolated:\n\ `-n', then don't print a trailing newline. We also support the echo syntax from Version 9 unix systems. */ void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int display_return = 1, do_v9 = 0; @@ -89,7 +89,7 @@ int putenv (); -static void usage (); +static void usage __P ((int status)); extern char **environ; @@ -112,10 +112,7 @@ static struct option const longopts[] = }; void -main (argc, argv, envp) - register int argc; - register char **argv; - char **envp; +main (register int argc, register char **argv, char **envp) { char *dummy_environ[1]; int optc; @@ -182,8 +179,7 @@ main (argc, argv, envp) } static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), diff --git a/src/expr.c b/src/expr.c index d48fade95..0be997e08 100644 --- a/src/expr.c +++ b/src/expr.c @@ -71,26 +71,25 @@ char *xstrdup (); char *strstr (); char *xmalloc (); -static VALUE *docolon (); -static VALUE *eval (); -static VALUE *int_value (); -static VALUE *str_value (); -static int isstring (); -static int nextarg (); -static int nomoreargs (); -static int null (); -static int toarith (); -static void freev (); -static void printv (); -static void tostring (); +static VALUE *docolon __P ((VALUE *sv, VALUE *pv)); +static VALUE *eval __P ((void)); +static VALUE *int_value __P ((int i)); +static VALUE *str_value __P ((char *s)); +static int isstring __P ((VALUE *v)); +static int nextarg __P ((char *str)); +static int nomoreargs __P ((void)); +static int null __P ((VALUE *v)); +static int toarith __P ((VALUE *v)); +static void freev __P ((VALUE *v)); +static void printv __P ((VALUE *v)); +static void tostring __P ((VALUE *v)); #ifdef EVAL_TRACE static void trace (); #endif static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -151,9 +150,7 @@ Pattern matches return the string matched between \\( and \\) or null; if\n\ } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { VALUE *v; @@ -180,8 +177,7 @@ main (argc, argv) /* Return a VALUE for I. */ static VALUE * -int_value (i) - int i; +int_value (int i) { VALUE *v; @@ -194,8 +190,7 @@ int_value (i) /* Return a VALUE for S. */ static VALUE * -str_value (s) - char *s; +str_value (char *s) { VALUE *v; @@ -208,8 +203,7 @@ str_value (s) /* Free VALUE V, including structure components. */ static void -freev (v) - VALUE *v; +freev (VALUE *v) { if (v->type == string) free (v->u.s); @@ -219,8 +213,7 @@ freev (v) /* Print VALUE V. */ static void -printv (v) - VALUE *v; +printv (VALUE *v) { switch (v->type) { @@ -238,8 +231,7 @@ printv (v) /* Return nonzero if V is a null-string or zero-number. */ static int -null (v) - VALUE *v; +null (VALUE *v) { switch (v->type) { @@ -255,8 +247,7 @@ null (v) /* Return nonzero if V is a string value. */ static int -isstring (v) - VALUE *v; +isstring (VALUE *v) { return v->type == string; } @@ -264,8 +255,7 @@ isstring (v) /* Coerce V to a string value (can't fail). */ static void -tostring (v) - VALUE *v; +tostring (VALUE *v) { char *temp; @@ -287,8 +277,7 @@ tostring (v) /* Coerce V to an integer value. Return 1 on success, 0 on failure. */ static int -toarith (v) - VALUE *v; +toarith (VALUE *v) { int i; int neg; @@ -327,8 +316,7 @@ toarith (v) STR must not be NULL. */ static int -nextarg (str) - char *str; +nextarg (char *str) { if (*args == NULL) return 0; @@ -338,7 +326,7 @@ nextarg (str) /* Return nonzero if there no more tokens. */ static int -nomoreargs () +nomoreargs (void) { return *args == 0; } @@ -418,9 +406,7 @@ trace (fxn) PV is the VALUE for the rhs (the pattern). */ static VALUE * -docolon (sv, pv) - VALUE *sv; - VALUE *pv; +docolon (VALUE *sv, VALUE *pv) { VALUE *v; const char *errmsg; @@ -468,7 +454,7 @@ docolon (sv, pv) /* Handle bare operands and ( expr ) syntax. */ static VALUE * -eval7 () +eval7 (void) { VALUE *v; @@ -497,7 +483,7 @@ eval7 () /* Handle match, substr, index, and length keywords. */ static VALUE * -eval6 () +eval6 (void) { VALUE *l; VALUE *r; @@ -573,7 +559,7 @@ eval6 () Calls docolon to do the real work. */ static VALUE * -eval5 () +eval5 (void) { VALUE *l; VALUE *r; @@ -602,7 +588,7 @@ eval5 () /* Handle *, /, % operators. */ static VALUE * -eval4 () +eval4 (void) { VALUE *l; VALUE *r; @@ -635,7 +621,7 @@ eval4 () /* Handle +, - operators. */ static VALUE * -eval3 () +eval3 (void) { VALUE *l; VALUE *r; @@ -666,7 +652,7 @@ eval3 () /* Handle comparisons. */ static VALUE * -eval2 () +eval2 (void) { VALUE *l; VALUE *r; @@ -707,7 +693,7 @@ eval2 () /* Handle &. */ static VALUE * -eval1 () +eval1 (void) { VALUE *l; VALUE *r; @@ -739,7 +725,7 @@ eval1 () /* Handle |. */ static VALUE * -eval () +eval (void) { VALUE *l; VALUE *r; diff --git a/src/factor.c b/src/factor.c index d46da0d03..80216ba0a 100644 --- a/src/factor.c +++ b/src/factor.c @@ -41,8 +41,7 @@ char *program_name; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -64,10 +63,7 @@ Usage: %s [NUMBER]\n\ } static int -factor (n0, max_n_factors, factors) - unsigned long n0; - int max_n_factors; - unsigned long *factors; +factor (long unsigned int n0, int max_n_factors, long unsigned int *factors) { register unsigned long n = n0, d; int n_factors = 0; @@ -108,8 +104,7 @@ factor (n0, max_n_factors, factors) } static void -print_factors (n) - unsigned long int n; +print_factors (long unsigned int n) { unsigned long int factors[MAX_N_FACTORS]; int n_factors; @@ -122,7 +117,7 @@ print_factors (n) } static void -do_stdin () +do_stdin (void) { token_buffer tokenbuffer; @@ -143,9 +138,7 @@ do_stdin () } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { program_name = argv[0]; diff --git a/src/hostname.c b/src/hostname.c index bcf709bf9..fff5954c0 100644 --- a/src/hostname.c +++ b/src/hostname.c @@ -53,8 +53,7 @@ char *xgethostname (); char *program_name; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -75,9 +74,7 @@ Print the hostname of the current system.\n\ } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { char *hostname; @@ -46,11 +46,11 @@ gid_t getegid (); char *xmalloc (); int getugroups (); -static void print_user (); -static void print_group (); -static void print_group_list (); -static void print_full_info (); -static void usage (); +static void print_user __P ((int uid)); +static void print_group __P ((int gid)); +static void print_group_list __P ((char *username)); +static void print_full_info __P ((char *username)); +static void usage __P ((int status)); /* The name this program was run with. */ char *program_name; @@ -96,9 +96,7 @@ static struct option const longopts[] = }; void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int optc; @@ -181,8 +179,7 @@ main (argc, argv) /* Print the name or value of user ID UID. */ static void -print_user (uid) - int uid; +print_user (int uid) { struct passwd *pwd = NULL; @@ -202,8 +199,7 @@ print_user (uid) /* Print the name or value of group ID GID. */ static void -print_group (gid) - int gid; +print_group (int gid) { struct group *grp = NULL; @@ -223,8 +219,7 @@ print_group (gid) /* Print all of the distinct groups the user is in . */ static void -print_group_list (username) - char *username; +print_group_list (char *username) { print_group (rgid); if (egid != rgid) @@ -269,8 +264,7 @@ print_group_list (username) /* Print all of the info about the user's user and group IDs. */ static void -print_full_info (username) - char *username; +print_full_info (char *username) { struct passwd *pwd; struct group *grp; @@ -349,8 +343,7 @@ print_full_info (username) } static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), diff --git a/src/logname.c b/src/logname.c index e12c3ebd7..9a0b0ec48 100644 --- a/src/logname.c +++ b/src/logname.c @@ -40,8 +40,7 @@ static struct option const long_options[] = }; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -60,9 +59,7 @@ Print the name of the current user.\n\ } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { register char *cp; int c; diff --git a/src/nice.c b/src/nice.c index 9b54abb98..61d4d87a8 100644 --- a/src/nice.c +++ b/src/nice.c @@ -41,8 +41,8 @@ #define GET_PRIORITY() getpriority (PRIO_PROCESS, 0) #endif -static int isinteger (); -static void usage (); +static int isinteger __P ((char *s)); +static void usage __P ((int status)); /* The name this program was run with. */ char *program_name; @@ -54,9 +54,7 @@ static struct option const longopts[] = }; void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int current_priority; int adjustment = 0; @@ -164,8 +162,7 @@ main (argc, argv) zero if not. */ static int -isinteger (s) - char *s; +isinteger (char *s) { if (*s == '-' || *s == '+') ++s; @@ -181,8 +178,7 @@ isinteger (s) } static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), diff --git a/src/pathchk.c b/src/pathchk.c index 9c137ee25..3aaa09968 100644 --- a/src/pathchk.c +++ b/src/pathchk.c @@ -93,8 +93,8 @@ char *xstrdup (); -static int validate_path (); -static void usage (); +static int validate_path __P ((char *path, int portability)); +static void usage __P ((int status)); /* The name this program was run with. */ char *program_name; @@ -114,9 +114,7 @@ static struct option const longopts[] = }; void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int exit_status = 0; int check_portability = 0; @@ -187,8 +185,7 @@ static char const portable_chars[256] = /* If PATH contains only portable characters, return 1, else 0. */ static int -portable_chars_only (path) - const char *path; +portable_chars_only (const char *path) { const char *p; @@ -206,8 +203,7 @@ portable_chars_only (path) 2 if it doesn't exist. */ static int -dir_ok (path) - const char *path; +dir_ok (const char *path) { struct stat stats; @@ -251,9 +247,7 @@ dir_ok (path) Return 0 if all of these tests are successful, 1 if any fail. */ static int -validate_path (path, portability) - char *path; - int portability; +validate_path (char *path, int portability) { int path_max; int last_elem; /* Nonzero if checking last element of path. */ @@ -356,8 +350,7 @@ validate_path (path, portability) } static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), diff --git a/src/printenv.c b/src/printenv.c index 8cee1766b..9e13aa3fe 100644 --- a/src/printenv.c +++ b/src/printenv.c @@ -55,8 +55,7 @@ static struct option const long_options[] = extern char **environ; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -74,9 +73,7 @@ If no environment VARIABLE specified, print them all.\n\ } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { char **env; char *ep, *ap; diff --git a/src/printf.c b/src/printf.c index d9cc0e23f..4cbbe1345 100644 --- a/src/printf.c +++ b/src/printf.c @@ -65,15 +65,15 @@ unsigned long strtoul (); char *xmalloc (); -static double xstrtod (); -static int print_esc (); -static int print_formatted (); -static long xstrtol (); -static unsigned long xstrtoul (); -static void print_direc (); -static void print_esc_char (); -static void print_esc_string (); -static void verify (); +static double xstrtod __P ((char *s)); +static int print_esc __P ((char *escstart)); +static int print_formatted __P ((char *format, int argc, char **argv)); +static long xstrtol __P ((char *s)); +static unsigned long xstrtoul __P ((char *s)); +static void print_direc __P ((char *start, size_t length, int field_width, int precision, char *argument)); +static void print_esc_char __P ((char c)); +static void print_esc_string __P ((char *str)); +static void verify __P ((char *s, char *end)); /* The value to return to the calling program. */ static int exit_status; @@ -82,8 +82,7 @@ static int exit_status; char *program_name; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -127,9 +126,7 @@ ARGUMENTs converted to proper type first. Variable widths are handled.\n\ } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { char *format; int args_used; @@ -165,10 +162,7 @@ main (argc, argv) Return the number of elements of ARGV used. */ static int -print_formatted (format, argc, argv) - char *format; - int argc; - char **argv; +print_formatted (char *format, int argc, char **argv) { int save_argc = argc; /* Preserve original value. */ char *f; /* Pointer into `format'. */ @@ -285,8 +279,7 @@ print_formatted (format, argc, argv) besides the backslash. */ static int -print_esc (escstart) - char *escstart; +print_esc (char *escstart) { register char *p = escstart + 1; int esc_value = 0; /* Value of \nnn escape. */ @@ -321,8 +314,7 @@ print_esc (escstart) /* Output a single-character \ escape. */ static void -print_esc_char (c) - char c; +print_esc_char (char c) { switch (c) { @@ -359,8 +351,7 @@ print_esc_char (c) /* Print string STR, evaluating \ escapes. */ static void -print_esc_string (str) - char *str; +print_esc_string (char *str) { for (; *str; str++) if (*str == '\\') @@ -375,12 +366,7 @@ print_esc_string (str) '*' values in those fields. */ static void -print_direc (start, length, field_width, precision, argument) - char *start; - size_t length; - int field_width; - int precision; - char *argument; +print_direc (char *start, size_t length, int field_width, int precision, char *argument) { char *p; /* Null-terminated copy of % directive. */ @@ -475,8 +461,7 @@ print_direc (start, length, field_width, precision, argument) } static unsigned long -xstrtoul (s) - char *s; +xstrtoul (char *s) { char *end; unsigned long val; @@ -488,8 +473,7 @@ xstrtoul (s) } static long -xstrtol (s) - char *s; +xstrtol (char *s) { char *end; long val; @@ -501,8 +485,7 @@ xstrtol (s) } static double -xstrtod (s) - char *s; +xstrtod (char *s) { char *end; double val; @@ -514,8 +497,7 @@ xstrtod (s) } static void -verify (s, end) - char *s, *end; +verify (char *s, char *end) { if (errno) { @@ -32,8 +32,7 @@ char *xgetcwd (); char *program_name; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -52,9 +51,7 @@ Print the full filename of the current working directory.\n\ } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { char *wd; @@ -25,10 +25,10 @@ #include "error.h" #include "version.h" -static double scan_double_arg (); -static int check_format (); -static char *get_width_format (); -static int print_numbers (); +static double scan_double_arg __P ((char *arg)); +static int check_format __P ((char *format_string)); +static char *get_width_format __P ((void)); +static int print_numbers __P ((char *format_str)); /* If nonzero print all number with equal width. */ static int equal_width; @@ -68,8 +68,7 @@ static struct option const long_options[] = }; static void -usage (status) - int status; +usage (int status) { if (status != 0) (void) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -96,9 +95,7 @@ Usage: %s [OPTION]... [from [step]] to\n\ } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int errs; int optc; @@ -223,8 +220,7 @@ format string may not be specified when printing equal width strings")); Return if the string is correct else signal error. */ static double -scan_double_arg (arg) - char *arg; +scan_double_arg (char *arg) { char *end_ptr; double ret_val; @@ -246,8 +242,7 @@ scan_double_arg (arg) Return 0 if not, 1 if correct. */ static int -check_format (format_string) - char *format_string; +check_format (char *format_string) { while (*format_string != '\0') { @@ -371,7 +366,7 @@ get_width_format () #else /* one of the math functions rint, modf, floor is missing. */ static char * -get_width_format () +get_width_format (void) { /* We cannot compute the needed information to determine the correct answer. So we simply return a value that works for all cases. */ @@ -383,8 +378,7 @@ get_width_format () /* Actually print the sequence of numbers in the specified range, with the given or default stepping and format. */ static int -print_numbers (format_str) - char *format_str; +print_numbers (char *format_str) { if (from > last) { diff --git a/src/sleep.c b/src/sleep.c index e8f5cd9f9..f7a297833 100644 --- a/src/sleep.c +++ b/src/sleep.c @@ -24,7 +24,7 @@ #include "system.h" #include "error.h" -static long argdecode (); +static long argdecode __P ((char *s)); /* The name by which this program was run. */ char *program_name; @@ -43,8 +43,7 @@ static struct option const long_options[] = }; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -63,9 +62,7 @@ SUFFIX may be s to keep seconds, m for minutes, h for hours or d for days.\n\ } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int i; unsigned seconds = 0; @@ -109,8 +106,7 @@ main (argc, argv) } static long -argdecode (s) - char *s; +argdecode (char *s) { long value; register char *p = s; @@ -30,7 +30,7 @@ char *xmalloc (); int full_write (); -static int tee (); +static int tee __P ((int nfiles, const char **files)); /* If nonzero, append to output files rather than truncating them. */ static int append; @@ -57,8 +57,7 @@ static struct option const long_options[] = }; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -79,9 +78,7 @@ Copy standard input to each FILE, and also to standard output.\n\ } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { int errs; int optc; @@ -147,9 +144,7 @@ main (argc, argv) Return 0 if successful, 1 if any errors occur. */ static int -tee (nfiles, files) - int nfiles; - const char **files; +tee (int nfiles, const char **files) { int *descriptors; char buffer[BUFSIZ]; diff --git a/src/test.c b/src/test.c index 4baab1924..6ca1adb32 100644 --- a/src/test.c +++ b/src/test.c @@ -70,8 +70,8 @@ extern int errno; # define member(c, s) ((c) ? (strchr ((s), (c)) ? 1 : 0) : 0) #endif /* !member */ -extern gid_t getgid (), getegid (); -extern uid_t geteuid (); +extern gid_t getgid (void), getegid (void); +extern uid_t geteuid (void); #if !defined (R_OK) #define R_OK 4 @@ -110,18 +110,18 @@ static int pos; /* The offset of the current argument in ARGV. */ static int argc; /* The number of arguments present in ARGV. */ static char **argv; /* The argument list. */ -static int unop (); -static int binop (); -static int unary_operator (); -static int binary_operator (); -static int two_arguments (); -static int three_arguments (); -static int posixtest (); +static int unop __P ((int op)); +static int binop __P ((char *s)); +static int unary_operator __P ((void)); +static int binary_operator __P ((void)); +static int two_arguments __P ((void)); +static int three_arguments __P ((void)); +static int posixtest __P ((void)); -static int expr (); -static int term (); -static int and (); -static int or (); +static int expr __P ((void)); +static int term __P ((void)); +static int and __P ((void)); +static int or __P ((void)); #if __GNUC__ >= 2 && defined (__GNUC_MINOR__) \ && __GNUC_MINOR__ >= 5 && !defined (__STRICT_ANSI__) @@ -130,12 +130,11 @@ static int or (); #define NO_RETURN_ATTRIBUTE /* empty */ #endif -static void test_syntax_error () NO_RETURN_ATTRIBUTE; -static void beyond () NO_RETURN_ATTRIBUTE; +static void test_syntax_error (char *format, char *arg) NO_RETURN_ATTRIBUTE; +static void beyond (void) NO_RETURN_ATTRIBUTE; static void -test_syntax_error (format, arg) - char *format, *arg; +test_syntax_error (char *format, char *arg) { fprintf (stderr, "%s: ", argv[0]); fprintf (stderr, format, arg); @@ -145,9 +144,7 @@ test_syntax_error (format, arg) /* A wrapper for stat () which disallows pathnames that are empty strings. */ static int -test_stat (path, finfo) - char *path; - struct stat *finfo; +test_stat (char *path, struct stat *finfo) { if (*path == '\0') { @@ -161,9 +158,7 @@ test_stat (path, finfo) and don't make the mistake of telling root that any file is executable. But this loses when the containing filesystem is mounted e.g. read-only. */ static int -eaccess (path, mode) - char *path; - int mode; +eaccess (char *path, int mode) { struct stat st; static int euid = -1; @@ -234,7 +229,7 @@ advance (f) * error condition) */ static void -beyond () +beyond (void) { test_syntax_error (_("argument expected\n"), NULL); } @@ -242,8 +237,7 @@ beyond () /* Syntax error for when an integer argument was expected, but something else was found. */ static void -integer_expected_error (pch) - char *pch; +integer_expected_error (char *pch) { test_syntax_error (_("integer expression expected %s\n"), pch); } @@ -252,9 +246,7 @@ integer_expected_error (pch) valid number. Stuff the converted number into RESULT if RESULT is a non-null pointer to a long. */ static int -isint (string, result) - register char *string; - long *result; +isint (register char *string, long int *result) { int sign; long value; @@ -311,9 +303,7 @@ isint (string, result) /* Find the modification time of FILE, and stuff it into AGE, a pointer to a long. Return nonzero if successful, else zero. */ static int -age_of (filename, age) - char *filename; - long *age; +age_of (char *filename, long int *age) { struct stat finfo; @@ -345,7 +335,7 @@ age_of (filename, age) * positive and negative integers */ static int -term () +term (void) { int value; @@ -402,7 +392,7 @@ term () } static int -binary_operator () +binary_operator (void) { register int op; struct stat stat_buf, stat_spare; @@ -640,7 +630,7 @@ binary_operator () } static int -unary_operator () +unary_operator (void) { long r, value; struct stat stat_buf; @@ -824,7 +814,7 @@ unary_operator () * term '-a' and */ static int -and () +and (void) { int value; @@ -843,7 +833,7 @@ and () * and '-o' or */ static int -or () +or (void) { int value; @@ -863,7 +853,7 @@ or () * or */ static int -expr () +expr (void) { if (pos >= argc) beyond (); @@ -873,8 +863,7 @@ expr () /* Return TRUE if S is one of the test command's binary operators. */ static int -binop (s) - char *s; +binop (char *s) { return ((STREQ (s, "=")) || (STREQ (s, "!=")) || (STREQ (s, "-nt")) || (STREQ (s, "-ot")) || (STREQ (s, "-ef")) || (STREQ (s, "-eq")) || @@ -884,14 +873,13 @@ binop (s) /* Return nonzero if OP is one of the test command's unary operators. */ static int -unop (op) - int op; +unop (int op) { return (member (op, "abcdefgkLhprsStuwxOGnz")); } static int -two_arguments () +two_arguments (void) { int value; @@ -910,7 +898,7 @@ two_arguments () } static int -three_arguments () +three_arguments (void) { int value; @@ -934,7 +922,7 @@ three_arguments () /* This is an implementation of a Posix.2 proposal by David Korn. */ static int -posixtest () +posixtest (void) { int value; @@ -979,8 +967,7 @@ posixtest () #include "long-options.h" static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -31,7 +31,7 @@ #include "version.h" #include "error.h" -static void usage (); +static void usage __P ((int status)); /* The name under which this program was run. */ char *program_name; @@ -55,9 +55,7 @@ static struct option const longopts[] = }; void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { char *tty; int optc; @@ -109,8 +107,7 @@ main (argc, argv) } static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), diff --git a/src/uname.c b/src/uname.c index dc4bcd360..1823e5dc1 100644 --- a/src/uname.c +++ b/src/uname.c @@ -38,8 +38,8 @@ #include "version.h" #include "error.h" -static void print_element (); -static void usage (); +static void print_element __P ((unsigned char mask, char *element)); +static void usage __P ((int status)); /* Values that are bitwise or'd into `toprint'. */ /* Operating system name. */ @@ -82,9 +82,7 @@ static struct option const long_options[] = }; void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { struct utsname name; int c; @@ -162,9 +160,7 @@ main (argc, argv) be printed, in which case print a newline. */ static void -print_element (mask, element) - unsigned char mask; - char *element; +print_element (unsigned char mask, char *element) { if (toprint & mask) { @@ -174,8 +170,7 @@ print_element (mask, element) } static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), diff --git a/src/whoami.c b/src/whoami.c index f762dbc60..66293d849 100644 --- a/src/whoami.c +++ b/src/whoami.c @@ -44,8 +44,7 @@ static struct option const long_options[] = }; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -64,9 +63,7 @@ Same as id -un.\n\ } void -main (argc, argv) - int argc; - char *argv[]; +main (int argc, char **argv) { register struct passwd *pw; register uid_t uid; @@ -29,8 +29,7 @@ char *program_name; static void -usage (status) - int status; +usage (int status) { if (status != 0) fprintf (stderr, _("Try `%s --help' for more information.\n"), @@ -48,9 +47,7 @@ Repeatedly output a line with all specified STRING(s), or `y'.\n\ } void -main (argc, argv) - int argc; - char **argv; +main (int argc, char **argv) { program_name = argv[0]; |