summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1995-11-09 17:02:23 +0000
committerJim Meyering <jim@meyering.net>1995-11-09 17:02:23 +0000
commitc0d94c89eca0f838ee5683726780110c2abcc14e (patch)
tree2c8dd672bd25296ff294a3d46fc91227d026c9cc
parentdd3a08897371348fbcac1a951250273e28c4e26c (diff)
downloadcoreutils-c0d94c89eca0f838ee5683726780110c2abcc14e.tar.xz
Protoize.
-rw-r--r--src/chgrp.c34
-rw-r--r--src/chmod.c30
-rw-r--r--src/chown.c30
-rw-r--r--src/cp.c58
-rw-r--r--src/dd.c95
-rw-r--r--src/df.c61
-rw-r--r--src/du.c75
-rw-r--r--src/install.c52
-rw-r--r--src/ln.c21
-rw-r--r--src/ls.c208
-rw-r--r--src/mkdir.c9
-rw-r--r--src/mkfifo.c9
-rw-r--r--src/mknod.c9
-rw-r--r--src/mv.c31
-rw-r--r--src/rm.c36
-rw-r--r--src/rmdir.c14
-rw-r--r--src/sync.c7
-rw-r--r--src/touch.c14
18 files changed, 282 insertions, 511 deletions
diff --git a/src/chgrp.c b/src/chgrp.c
index 24ac34be4..c2a9e5a6b 100644
--- a/src/chgrp.c
+++ b/src/chgrp.c
@@ -53,11 +53,11 @@ char *savedir ();
char *xmalloc ();
char *xrealloc ();
-static int change_file_group ();
-static int change_dir_group ();
-static void describe_change ();
-static void parse_group ();
-static void usage ();
+static int change_file_group (char *file, int group);
+static int change_dir_group (char *dir, int group, struct stat *statp);
+static void describe_change (char *file, int changed);
+static void parse_group (char *name, int *g);
+static void usage (int status);
/* The name the program was run with. */
char *program_name;
@@ -96,9 +96,7 @@ static struct option const long_options[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int group;
int errors = 0;
@@ -158,9 +156,7 @@ main (argc, argv)
/* Set *G according to NAME. */
static void
-parse_group (name, g)
- char *name;
- int *g;
+parse_group (char *name, int *g)
{
struct group *grp;
@@ -191,9 +187,7 @@ parse_group (name, g)
Return 0 if successful, 1 if errors occurred. */
static int
-change_file_group (file, group)
- char *file;
- int group;
+change_file_group (char *file, int group)
{
struct stat file_stats;
int errors = 0;
@@ -249,10 +243,7 @@ change_file_group (file, group)
Return 0 if successful, 1 if errors occurred. */
static int
-change_dir_group (dir, group, statp)
- char *dir;
- int group;
- struct stat *statp;
+change_dir_group (char *dir, int group, struct stat *statp)
{
char *name_space, *namep;
char *path; /* Full path of each entry to process. */
@@ -302,9 +293,7 @@ change_dir_group (dir, group, statp)
has been given; if CHANGED is zero, FILE was that group already. */
static void
-describe_change (file, changed)
- char *file;
- int changed;
+describe_change (char *file, int changed)
{
if (changed)
printf ("group of %s changed to %s\n", file, groupname);
@@ -313,8 +302,7 @@ describe_change (file, changed)
}
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/chmod.c b/src/chmod.c
index 4ddf6c45e..34813e4a0 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -39,10 +39,10 @@ void strip_trailing_slashes ();
char *xmalloc ();
char *xrealloc ();
-static int change_file_mode ();
-static int change_dir_mode ();
-static void describe_change ();
-static void usage ();
+static int change_file_mode (char *file, struct mode_change *changes, int deref_symlink);
+static int change_dir_mode (char *dir, struct mode_change *changes, struct stat *statp);
+static void describe_change (char *file, short unsigned int mode, int changed);
+static void usage (int status);
/* The name the program was run with. */
char *program_name;
@@ -81,9 +81,7 @@ static struct option const long_options[] =
of `struct mode_change' and apply that to each file argument. */
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
struct mode_change *changes;
int errors = 0;
@@ -183,10 +181,7 @@ main (argc, argv)
links. Return 0 if successful, 1 if errors occurred. */
static int
-change_file_mode (file, changes, deref_symlink)
- char *file;
- struct mode_change *changes;
- int deref_symlink;
+change_file_mode (char *file, struct mode_change *changes, int deref_symlink)
{
struct stat file_stats;
unsigned short newmode;
@@ -240,10 +235,7 @@ change_file_mode (file, changes, deref_symlink)
Return 0 if successful, 1 if errors occurred. */
static int
-change_dir_mode (dir, changes, statp)
- char *dir;
- struct mode_change *changes;
- struct stat *statp;
+change_dir_mode (char *dir, struct mode_change *changes, struct stat *statp)
{
char *name_space, *namep;
char *path; /* Full path of each entry to process. */
@@ -293,10 +285,7 @@ change_dir_mode (dir, changes, statp)
if CHANGED is zero, FILE had that mode already. */
static void
-describe_change (file, mode, changed)
- char *file;
- unsigned short mode;
- int changed;
+describe_change (char *file, short unsigned int mode, int changed)
{
char perms[11]; /* "-rwxrwxrwx" ls-style modes. */
@@ -311,8 +300,7 @@ describe_change (file, mode, changed)
}
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/chown.c b/src/chown.c
index 0d2ddd9aa..536b6ed57 100644
--- a/src/chown.c
+++ b/src/chown.c
@@ -55,10 +55,10 @@ void strip_trailing_slashes ();
char *xmalloc ();
char *xrealloc ();
-static int change_file_owner ();
-static int change_dir_owner ();
-static void describe_change ();
-static void usage ();
+static int change_file_owner (char *file, uid_t user, gid_t group);
+static int change_dir_owner (char *dir, uid_t user, gid_t group, struct stat *statp);
+static void describe_change (char *file, int changed);
+static void usage (int status);
/* The name the program was run with. */
char *program_name;
@@ -100,9 +100,7 @@ static struct option const long_options[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
uid_t user = (uid_t) -1; /* New uid; -1 if not to be changed. */
gid_t group = (uid_t) -1; /* New gid; -1 if not to be changed. */
@@ -173,10 +171,7 @@ main (argc, argv)
Return 0 if successful, 1 if errors occurred. */
static int
-change_file_owner (file, user, group)
- char *file;
- uid_t user;
- gid_t group;
+change_file_owner (char *file, uid_t user, gid_t group)
{
struct stat file_stats;
uid_t newuser;
@@ -217,11 +212,7 @@ change_file_owner (file, user, group)
Return 0 if successful, 1 if errors occurred. */
static int
-change_dir_owner (dir, user, group, statp)
- char *dir;
- uid_t user;
- gid_t group;
- struct stat *statp;
+change_dir_owner (char *dir, uid_t user, gid_t group, struct stat *statp)
{
char *name_space, *namep;
char *path; /* Full path of each entry to process. */
@@ -271,9 +262,7 @@ change_dir_owner (dir, user, group, statp)
has been given; if CHANGED is zero, FILE had those owners already. */
static void
-describe_change (file, changed)
- char *file;
- int changed;
+describe_change (char *file, int changed)
{
if (changed)
printf ("owner of %s changed to ", file);
@@ -286,8 +275,7 @@ describe_change (file, changed)
}
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/cp.c b/src/cp.c
index 455e66168..efd9ce5ec 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -42,21 +42,21 @@ struct dir_attr
struct dir_attr *next;
};
-int stat ();
-int lstat ();
+int stat (const char *, struct stat *);
+int lstat (const char *, struct stat *);
-char *dirname ();
+char *dirname (char *);
char *xstrdup ();
enum backup_type get_version ();
int euidaccess ();
int full_write ();
-static int do_copy ();
-static int copy ();
-static int copy_dir ();
-static int make_path_private ();
-static int copy_reg ();
-static int re_protect ();
+static int do_copy (int argc, char **argv);
+static int copy (char *src_path, char *dst_path, int new_dst, dev_t device, struct dir_list *ancestors);
+static int copy_dir (char *src_path_in, char *dst_path_in, int new_dst, struct stat *src_sb, struct dir_list *ancestors);
+static int make_path_private (char *const_dirpath, int src_offset, int mode, char *verbose_fmt_string, struct dir_attr **attr_list, int *new_dst);
+static int copy_reg (char *src_path, char *dst_path);
+static int re_protect (char *const_dst_path, int src_offset, struct dir_attr *attr_list);
/* Initial number of entries in each hash table entry's table of inodes. */
#define INITIAL_HASH_MODULE 100
@@ -155,9 +155,7 @@ static struct option const long_opts[] =
};
void
-main (argc, argv)
- int argc;
- char *argv[];
+main (int argc, char **argv)
{
int c;
int make_backups = 0;
@@ -305,9 +303,7 @@ main (argc, argv)
Return 0 if successful, 1 if any errors occur. */
static int
-do_copy (argc, argv)
- int argc;
- char *argv[];
+do_copy (int argc, char **argv)
{
char *dest;
struct stat sb;
@@ -467,12 +463,7 @@ do_copy (argc, argv)
Return 0 if successful, 1 if an error occurs. */
static int
-copy (src_path, dst_path, new_dst, device, ancestors)
- char *src_path;
- char *dst_path;
- int new_dst;
- dev_t device;
- struct dir_list *ancestors;
+copy (char *src_path, char *dst_path, int new_dst, dev_t device, struct dir_list *ancestors)
{
struct stat src_sb;
struct stat dst_sb;
@@ -860,14 +851,7 @@ un_backup:
permissions when done, otherwise 1. */
static int
-make_path_private (const_dirpath, src_offset, mode, verbose_fmt_string,
- attr_list, new_dst)
- char *const_dirpath;
- int src_offset;
- int mode;
- char *verbose_fmt_string;
- struct dir_attr **attr_list;
- int *new_dst;
+make_path_private (char *const_dirpath, int src_offset, int mode, char *verbose_fmt_string, struct dir_attr **attr_list, int *new_dst)
{
struct stat stats;
char *dirpath; /* A copy of CONST_DIRPATH we can change. */
@@ -981,10 +965,7 @@ make_path_private (const_dirpath, src_offset, mode, verbose_fmt_string,
when done, otherwise 1. */
static int
-re_protect (const_dst_path, src_offset, attr_list)
- char *const_dst_path;
- int src_offset;
- struct dir_attr *attr_list;
+re_protect (char *const_dst_path, int src_offset, struct dir_attr *attr_list)
{
struct dir_attr *p;
char *dst_path; /* A copy of CONST_DST_PATH we can change. */
@@ -1054,12 +1035,7 @@ re_protect (const_dst_path, src_offset, attr_list)
Return 0 if successful, -1 if an error occurs. */
static int
-copy_dir (src_path_in, dst_path_in, new_dst, src_sb, ancestors)
- char *src_path_in;
- char *dst_path_in;
- int new_dst;
- struct stat *src_sb;
- struct dir_list *ancestors;
+copy_dir (char *src_path_in, char *dst_path_in, int new_dst, struct stat *src_sb, struct dir_list *ancestors)
{
char *name_space;
char *namep;
@@ -1112,9 +1088,7 @@ copy_dir (src_path_in, dst_path_in, new_dst, src_sb, ancestors)
Return 0 if successful, -1 if an error occurred. */
static int
-copy_reg (src_path, dst_path)
- char *src_path;
- char *dst_path;
+copy_reg (char *src_path, char *dst_path)
{
char *buf;
int buf_size;
diff --git a/src/dd.c b/src/dd.c
index 36a0f2288..afa9fb33d 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -95,22 +95,22 @@ char *xmalloc ();
int safe_read ();
int full_write ();
-static RETSIGTYPE interrupt_handler ();
-static int bit_count ();
-static int parse_integer ();
-static void apply_translations ();
-static void copy ();
-static void copy_simple ();
-static void copy_with_block ();
-static void copy_with_unblock ();
-static void parse_conversion ();
-static void print_stats ();
-static void translate_charset ();
-static void quit ();
-static void scanargs ();
-static void skip ();
-static void usage ();
-static void write_output ();
+static RETSIGTYPE interrupt_handler (void);
+static int bit_count (register unsigned int i);
+static int parse_integer (char *str);
+static void apply_translations (void);
+static void copy (void);
+static void copy_simple (unsigned char *buf, int nread);
+static void copy_with_block (unsigned char *buf, int nread);
+static void copy_with_unblock (unsigned char *buf, int nread);
+static void parse_conversion (char *str);
+static void print_stats (void);
+static void translate_charset (unsigned char *new_trans);
+static void quit (int code);
+static void scanargs (int argc, char **argv);
+static void skip (int fdesc, char *file, long int records, long int blocksize, char *buf);
+static void usage (int status);
+static void write_output (void);
/* The name this program was run with. */
char *program_name;
@@ -318,9 +318,7 @@ static struct option const long_options[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
#ifdef _POSIX_VERSION
struct sigaction sigact;
@@ -410,12 +408,7 @@ main (argc, argv)
bytes of the data at a time in BUF, if necessary. */
static void
-skip (fdesc, file, records, blocksize, buf)
- int fdesc;
- char *file;
- long records;
- long blocksize;
- char *buf;
+skip (int fdesc, char *file, long int records, long int blocksize, char *buf)
{
struct stat stats;
@@ -465,9 +458,7 @@ skip (fdesc, file, records, blocksize, buf)
to the NREAD bytes in BUF. */
static void
-translate_buffer (buf, nread)
- unsigned char *buf;
- int nread;
+translate_buffer (unsigned char *buf, int nread)
{
register unsigned char *cp;
register int i;
@@ -488,9 +479,7 @@ static unsigned char saved_char;
next call. Return the new start of the BUF buffer. */
static unsigned char *
-swab_buffer (buf, nread)
- unsigned char *buf;
- int *nread;
+swab_buffer (unsigned char *buf, int *nread)
{
unsigned char *bufstart = buf;
register unsigned char *cp;
@@ -534,7 +523,7 @@ static int col = 0;
/* The main loop. */
static void
-copy ()
+copy (void)
{
unsigned char *ibuf, *bufstart; /* Input buffer. */
int nread; /* Bytes read in the current block. */
@@ -701,9 +690,7 @@ copy ()
/* Copy NREAD bytes of BUF, with no conversions. */
static void
-copy_simple (buf, nread)
- unsigned char *buf;
- int nread;
+copy_simple (unsigned char *buf, int nread)
{
int nfree; /* Number of unused bytes in `obuf'. */
unsigned char *start = buf; /* First uncopied char in BUF. */
@@ -730,9 +717,7 @@ copy_simple (buf, nread)
replacing the newline with trailing spaces). */
static void
-copy_with_block (buf, nread)
- unsigned char *buf;
- int nread;
+copy_with_block (unsigned char *buf, int nread)
{
register int i;
@@ -764,9 +749,7 @@ copy_with_block (buf, nread)
with a newline). */
static void
-copy_with_unblock (buf, nread)
- unsigned char *buf;
- int nread;
+copy_with_unblock (unsigned char *buf, int nread)
{
register int i;
register unsigned char c;
@@ -801,7 +784,7 @@ copy_with_unblock (buf, nread)
/* Write, then empty, the output buffer `obuf'. */
static void
-write_output ()
+write_output (void)
{
int nwritten = full_write (output_fd, obuf, output_blocksize);
if (nwritten != output_blocksize)
@@ -817,9 +800,7 @@ write_output ()
}
static void
-scanargs (argc, argv)
- int argc;
- char **argv;
+scanargs (int argc, char **argv)
{
int i, n;
int c;
@@ -909,8 +890,7 @@ scanargs (argc, argv)
/* FIXME: use xstrtou?l */
static int
-parse_integer (str)
- char *str;
+parse_integer (char *str)
{
register int n = 0;
register int temp;
@@ -952,8 +932,7 @@ loop:
/* Interpret one "conv=..." option. */
static void
-parse_conversion (str)
- char *str;
+parse_conversion (char *str)
{
char *new;
int i;
@@ -981,7 +960,7 @@ parse_conversion (str)
/* Fix up translation table. */
static void
-apply_translations ()
+apply_translations (void)
{
int i;
@@ -1029,8 +1008,7 @@ only one conv in {ascii,ebcdic,ibm}, {lcase,ucase}, {block,unblock}, {unblock,sy
}
static void
-translate_charset (new_trans)
- unsigned char *new_trans;
+translate_charset (unsigned char *new_trans)
{
int i;
@@ -1042,8 +1020,7 @@ translate_charset (new_trans)
/* Return the number of 1 bits in `i'. */
static int
-bit_count (i)
- register unsigned int i;
+bit_count (register unsigned int i)
{
register int set_bits;
@@ -1053,7 +1030,7 @@ bit_count (i)
}
static void
-print_stats ()
+print_stats (void)
{
fprintf (stderr, "%u+%u records in\n", r_full, r_partial);
fprintf (stderr, "%u+%u records out\n", w_full, w_partial);
@@ -1063,8 +1040,7 @@ print_stats ()
}
static void
-quit (code)
- int code;
+quit (int code)
{
int errcode = code ? code : 1;
print_stats ();
@@ -1076,14 +1052,13 @@ quit (code)
}
static RETSIGTYPE
-interrupt_handler ()
+interrupt_handler (void)
{
quit (1);
}
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/df.c b/src/df.c
index 935e4ea0e..26efe7032 100644
--- a/src/df.c
+++ b/src/df.c
@@ -47,17 +47,17 @@
char *xmalloc ();
char *xstrdup ();
-static int selected_fstype ();
-static int excluded_fstype ();
-static void add_excluded_fs_type ();
-static void add_fs_type ();
-static void print_header ();
-static void show_entry ();
-static void show_all_entries ();
-static void show_dev ();
-static void show_disk ();
-static void show_point ();
-static void usage ();
+static int selected_fstype (char *fstype);
+static int excluded_fstype (char *fstype);
+static void add_excluded_fs_type (char *fstype);
+static void add_fs_type (char *fstype);
+static void print_header (void);
+static void show_entry (char *path, struct stat *statp);
+static void show_all_entries (void);
+static void show_dev (char *disk, char *mount_point, char *fstype);
+static void show_disk (char *disk);
+static void show_point (char *point, struct stat *statp);
+static void usage (int status);
/* Name this program was run with. */
char *program_name;
@@ -145,9 +145,7 @@ static struct option const long_options[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int i;
struct stat *stats;
@@ -285,7 +283,7 @@ main (argc, argv)
}
static void
-print_header ()
+print_header (void)
{
printf ("Filesystem ");
@@ -306,7 +304,7 @@ print_header ()
an unselected type or are empty. */
static void
-show_all_entries ()
+show_all_entries (void)
{
struct mount_entry *me;
@@ -318,9 +316,7 @@ show_all_entries ()
for it. STATP is the results of `stat' on PATH. */
static void
-show_entry (path, statp)
- char *path;
- struct stat *statp;
+show_entry (char *path, struct stat *statp)
{
if (S_ISBLK (statp->st_mode) || S_ISCHR (statp->st_mode))
show_disk (path);
@@ -332,8 +328,7 @@ show_entry (path, statp)
DISK is mounted on, and show its disk usage. */
static void
-show_disk (disk)
- char *disk;
+show_disk (char *disk)
{
struct mount_entry *me;
@@ -352,9 +347,7 @@ show_disk (disk)
STATP is the results of `stat' on POINT. */
static void
-show_point (point, statp)
- char *point;
- struct stat *statp;
+show_point (char *point, struct stat *statp)
{
struct stat disk_stats;
struct mount_entry *me;
@@ -394,10 +387,7 @@ show_point (point, statp)
If FSTYPE is non-NULL, it is the type of the filesystem on DISK. */
static void
-show_dev (disk, mount_point, fstype)
- char *disk;
- char *mount_point;
- char *fstype;
+show_dev (char *disk, char *mount_point, char *fstype)
{
struct fs_usage fsu;
long blocks_used;
@@ -475,8 +465,7 @@ show_dev (disk, mount_point, fstype)
/* Add FSTYPE to the list of filesystem types to display. */
static void
-add_fs_type (fstype)
- char *fstype;
+add_fs_type (char *fstype)
{
struct fs_type_list *fsp;
@@ -489,8 +478,7 @@ add_fs_type (fstype)
/* Add FSTYPE to the list of filesystem types to be omitted. */
static void
-add_excluded_fs_type (fstype)
- char *fstype;
+add_excluded_fs_type (char *fstype)
{
struct fs_type_list *fsp;
@@ -504,8 +492,7 @@ add_excluded_fs_type (fstype)
return nonzero, else zero. */
static int
-selected_fstype (fstype)
- char *fstype;
+selected_fstype (char *fstype)
{
struct fs_type_list *fsp;
@@ -522,8 +509,7 @@ selected_fstype (fstype)
return nonzero, else zero. */
static int
-excluded_fstype (fstype)
- char *fstype;
+excluded_fstype (char *fstype)
{
struct fs_type_list *fsp;
@@ -536,8 +522,7 @@ excluded_fstype (fstype)
}
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/du.c b/src/du.c
index 3fd05c33f..2e1fade2b 100644
--- a/src/du.c
+++ b/src/du.c
@@ -90,23 +90,23 @@ typedef struct
char *text; /* Pointer to the text. */
} *string, stringstruct;
-int stat ();
-int lstat ();
+int stat (const char *, struct stat *);
+int lstat (const char *, struct stat *);
char *savedir ();
char *xmalloc ();
char *xrealloc ();
-static int hash_insert ();
-static int hash_insert2 ();
-static long count_entry ();
-static void du_files ();
-static void hash_init ();
-static void hash_reset ();
-static void str_concatc ();
-static void str_copyc ();
-static void str_init ();
-static void str_trunc ();
+static int hash_insert (ino_t ino, dev_t dev);
+static int hash_insert2 (struct htab *htab, ino_t ino, dev_t dev);
+static long count_entry (char *ent, int top, dev_t last_dev);
+static void du_files (char **files);
+static void hash_init (unsigned int modulus, unsigned int entry_tab_size);
+static void hash_reset (void);
+static void str_concatc (string s1, char *cstr);
+static void str_copyc (string s1, char *cstr);
+static void str_init (string *s1, unsigned int size);
+static void str_trunc (string s1, unsigned int length);
/* Name under which this program was invoked. */
char *program_name;
@@ -185,9 +185,7 @@ static struct option const long_options[] =
};
static void
-usage (status, reason)
- int status;
- char *reason;
+usage (int status, char *reason)
{
if (reason != NULL)
fprintf (status == 0 ? stdout : stderr, "%s: %s\n",
@@ -219,9 +217,7 @@ Summarize disk usage of each FILE, recursively for directories.\n\
}
void
-main (argc, argv)
- int argc;
- char *argv[];
+main (int argc, char **argv)
{
int c;
char *cwd_only[2];
@@ -312,8 +308,7 @@ main (argc, argv)
named in FILES, the last entry of which is NULL. */
static void
-du_files (files)
- char **files;
+du_files (char **files)
{
struct saved_cwd cwd;
ino_t initial_ino; /* Initial directory's inode. */
@@ -381,10 +376,7 @@ du_files (files)
LAST_DEV is the device that the parent directory of ENT is on. */
static long
-count_entry (ent, top, last_dev)
- char *ent;
- int top;
- dev_t last_dev;
+count_entry (char *ent, int top, dev_t last_dev)
{
long size;
@@ -525,9 +517,7 @@ count_entry (ent, top, last_dev)
doubled.) */
static void
-hash_init (modulus, entry_tab_size)
- unsigned modulus;
- unsigned entry_tab_size;
+hash_init (unsigned int modulus, unsigned int entry_tab_size)
{
struct htab *htab_r;
@@ -548,7 +538,7 @@ hash_init (modulus, entry_tab_size)
contain no entries. */
static void
-hash_reset ()
+hash_reset (void)
{
int i;
struct entry **p;
@@ -566,9 +556,7 @@ hash_reset ()
if it wasn't. */
static int
-hash_insert (ino, dev)
- ino_t ino;
- dev_t dev;
+hash_insert (ino_t ino, dev_t dev)
{
struct htab *htab_r = htab; /* Initially a copy of the global `htab'. */
@@ -635,10 +623,7 @@ hash_insert (ino, dev)
already existed. */
static int
-hash_insert2 (htab, ino, dev)
- struct htab *htab;
- ino_t ino;
- dev_t dev;
+hash_insert2 (struct htab *htab, ino_t ino, dev_t dev)
{
struct entry **hp, *ep2, *ep;
hp = &htab->hash[ino % htab->modulus];
@@ -675,9 +660,7 @@ hash_insert2 (htab, ino, dev)
/* Initialize the struct string S1 for holding SIZE characters. */
static void
-str_init (s1, size)
- string *s1;
- unsigned size;
+str_init (string *s1, unsigned int size)
{
string s;
@@ -689,9 +672,7 @@ str_init (s1, size)
}
static void
-ensure_space (s, size)
- string s;
- unsigned size;
+ensure_space (string s, unsigned int size)
{
if (s->alloc < size)
{
@@ -703,9 +684,7 @@ ensure_space (s, size)
/* Assign the null-terminated C-string CSTR to S1. */
static void
-str_copyc (s1, cstr)
- string s1;
- char *cstr;
+str_copyc (string s1, char *cstr)
{
unsigned l = strlen (cstr);
ensure_space (s1, l);
@@ -714,9 +693,7 @@ str_copyc (s1, cstr)
}
static void
-str_concatc (s1, cstr)
- string s1;
- char *cstr;
+str_concatc (string s1, char *cstr)
{
unsigned l1 = s1->length;
unsigned l2 = strlen (cstr);
@@ -730,9 +707,7 @@ str_concatc (s1, cstr)
/* Truncate the string S1 to have length LENGTH. */
static void
-str_trunc (s1, length)
- string s1;
- unsigned length;
+str_trunc (string s1, unsigned int length)
{
if (s1->length > length)
{
diff --git a/src/install.c b/src/install.c
index 82faf9e23..65dc8c49a 100644
--- a/src/install.c
+++ b/src/install.c
@@ -69,8 +69,8 @@
#include <sys/wait.h>
#endif
-struct passwd *getpwnam ();
-struct group *getgrnam ();
+struct passwd *getpwnam (const char *);
+struct group *getgrnam (const char *);
#ifndef _POSIX_VERSION
uid_t getuid ();
@@ -92,20 +92,20 @@ int wait ();
/* Number of bytes of a file to copy at a time. */
#define READ_SIZE (32 * 1024)
-char *basename ();
+char *basename (char *);
char *stpcpy ();
char *xmalloc ();
int safe_read ();
int full_write ();
int isdir ();
-static int change_attributes ();
-static int copy_file ();
-static int install_file_in_dir ();
-static int install_file_in_file ();
-static void get_ids ();
-static void strip ();
-static void usage ();
+static int change_attributes (char *path, int no_need_to_chown);
+static int copy_file (char *from, char *to, int *to_created);
+static int install_file_in_dir (char *from, char *to_dir);
+static int install_file_in_file (char *from, char *to);
+static void get_ids (void);
+static void strip (char *path);
+static void usage (int status);
/* The name this program was run with, for error messages. */
char *program_name;
@@ -153,9 +153,7 @@ static struct option const long_options[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int optc;
int errors = 0;
@@ -266,9 +264,7 @@ main (argc, argv)
Return 0 if successful, 1 if an error occurs. */
static int
-install_file_in_file (from, to)
- char *from;
- char *to;
+install_file_in_file (char *from, char *to)
{
int to_created;
int no_need_to_chown;
@@ -288,9 +284,7 @@ install_file_in_file (from, to)
Return 0 if successful, 1 if not. */
static int
-install_file_in_dir (from, to_dir)
- char *from;
- char *to_dir;
+install_file_in_dir (char *from, char *to_dir)
{
char *from_base;
char *to;
@@ -314,10 +308,7 @@ static char buffer[READ_SIZE];
copy fails, don't modify *TO_CREATED. */
static int
-copy_file (from, to, to_created)
- char *from;
- char *to;
- int *to_created;
+copy_file (char *from, char *to, int *to_created)
{
int fromfd, tofd;
int bytes;
@@ -407,9 +398,7 @@ copy_file (from, to, to_created)
Return 0 if successful, 1 if not. */
static int
-change_attributes (path, no_need_to_chown)
- char *path;
- int no_need_to_chown;
+change_attributes (char *path, int no_need_to_chown)
{
int err = 0;
@@ -452,8 +441,7 @@ change_attributes (path, no_need_to_chown)
it portable would be very difficult. Not worth the effort. */
static void
-strip (path)
- char *path;
+strip (char *path)
{
int pid, status;
@@ -479,8 +467,7 @@ strip (path)
decimal integer, zero if not. */
static int
-is_number (str)
- char *str;
+is_number (char *str)
{
if (*str == 0)
return 0;
@@ -493,7 +480,7 @@ is_number (str)
/* Initialize the user and group ownership of the files to install. */
static void
-get_ids ()
+get_ids (void)
{
struct passwd *pw;
struct group *gr;
@@ -535,8 +522,7 @@ get_ids ()
}
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/ln.c b/src/ln.c
index 496771284..d768f90e2 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -31,10 +31,10 @@
#include "version.h"
#include "error.h"
-int link (); /* Some systems don't declare this anywhere. */
+int link (const char *, const char *); /* Some systems don't declare this anywhere. */
#ifdef S_ISLNK
-int symlink ();
+int symlink (const char *, const char *);
#endif
/* Construct a string NEW_DEST by concatenating DEST, a slash, and
@@ -57,15 +57,15 @@ int symlink ();
} \
while (0)
-char *basename ();
+char *basename (char *);
enum backup_type get_version ();
int isdir ();
int yesno ();
void strip_trailing_slashes ();
char *stpcpy ();
-static void usage ();
-static int do_link ();
+static void usage (int status);
+static int do_link (char *source, char *dest);
/* The name by which the program was run, for error messages. */
char *program_name;
@@ -118,9 +118,7 @@ static struct option const long_options[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int c;
int errors;
@@ -256,9 +254,7 @@ main (argc, argv)
Return 1 if there is an error, otherwise 0. */
static int
-do_link (source, dest)
- char *source;
- char *dest;
+do_link (char *source, char *dest)
{
struct stat dest_stats;
char *dest_backup = NULL;
@@ -395,8 +391,7 @@ do_link (source, dest)
}
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/ls.c b/src/ls.c
index 31b9ac973..8667d9a6f 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -100,45 +100,45 @@ char *xrealloc ();
int argmatch ();
void invalid_arg ();
-static char *make_link_path ();
-static int compare_atime ();
-static int rev_cmp_atime ();
-static int compare_ctime ();
-static int rev_cmp_ctime ();
-static int compare_mtime ();
-static int rev_cmp_mtime ();
-static int compare_size ();
-static int rev_cmp_size ();
-static int compare_name ();
-static int rev_cmp_name ();
-static int compare_extension ();
-static int rev_cmp_extension ();
-static int decode_switches ();
-static void parse_ls_color ();
-static int file_interesting ();
-static int gobble_file ();
-static int is_not_dot_or_dotdot ();
-static int length_of_file_name_and_frills ();
-static void add_ignore_pattern ();
-static void attach ();
-static void clear_files ();
-static void extract_dirs_from_files ();
-static void get_link_name ();
-static void indent ();
-static void print_current_files ();
-static void print_dir ();
-static void print_file_name_and_frills ();
-static void print_horizontal ();
-static void print_long_format ();
-static void print_many_per_line ();
-static void print_name_with_quoting ();
-static void print_type_indicator ();
-static void print_color_indicator ();
-static void put_indicator ();
-static void print_with_commas ();
-static void queue_directory ();
-static void sort_files ();
-static void usage ();
+static char *make_link_path (char *path, char *linkname);
+static int compare_atime (struct fileinfo *file1, struct fileinfo *file2);
+static int rev_cmp_atime (struct fileinfo *file2, struct fileinfo *file1);
+static int compare_ctime (struct fileinfo *file1, struct fileinfo *file2);
+static int rev_cmp_ctime (struct fileinfo *file2, struct fileinfo *file1);
+static int compare_mtime (struct fileinfo *file1, struct fileinfo *file2);
+static int rev_cmp_mtime (struct fileinfo *file2, struct fileinfo *file1);
+static int compare_size (struct fileinfo *file1, struct fileinfo *file2);
+static int rev_cmp_size (struct fileinfo *file2, struct fileinfo *file1);
+static int compare_name (struct fileinfo *file1, struct fileinfo *file2);
+static int rev_cmp_name (struct fileinfo *file2, struct fileinfo *file1);
+static int compare_extension (struct fileinfo *file1, struct fileinfo *file2);
+static int rev_cmp_extension (struct fileinfo *file2, struct fileinfo *file1);
+static int decode_switches (int argc, char **argv);
+static void parse_ls_color (void);
+static int file_interesting (register struct dirent *next);
+static int gobble_file (char *name, int explicit_arg, char *dirname);
+static int is_not_dot_or_dotdot (char *name);
+static int length_of_file_name_and_frills (struct fileinfo *f);
+static void add_ignore_pattern (char *pattern);
+static void attach (char *dest, char *dirname, char *name);
+static void clear_files (void);
+static void extract_dirs_from_files (char *dirname, int recursive);
+static void get_link_name (char *filename, struct fileinfo *f);
+static void indent (int from, int to);
+static void print_current_files (void);
+static void print_dir (const char *name, const char *realname);
+static void print_file_name_and_frills (struct fileinfo *f);
+static void print_horizontal (void);
+static void print_long_format (struct fileinfo *f);
+static void print_many_per_line (void);
+static void print_name_with_quoting (register char *p);
+static void print_type_indicator (unsigned int mode);
+static void print_color_indicator (unsigned int mode);
+static void put_indicator (int n);
+static void print_with_commas (void);
+static void queue_directory (char *name, char *realname);
+static void sort_files (void);
+static void usage (int status);
/* The name the program was run with, stripped of any leading path. */
char *program_name;
@@ -588,9 +588,7 @@ static enum color_type const color_types[] =
list of the integers stored in OS all on one line. */
static void
-dired_dump_obstack (prefix, os)
- const char *prefix;
- struct obstack *os;
+dired_dump_obstack (const char *prefix, struct obstack *os)
{
int n_pos;
@@ -609,9 +607,7 @@ dired_dump_obstack (prefix, os)
}
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
register int i;
register struct pending *thispend;
@@ -706,9 +702,7 @@ main (argc, argv)
Return the index of the first non-option argument. */
static int
-decode_switches (argc, argv)
- int argc;
- char **argv;
+decode_switches (int argc, char **argv)
{
register char *p;
int c;
@@ -1044,7 +1038,7 @@ decode_switches (argc, argv)
/* Parse the LS_COLORS/LS_COLOURS variable */
static void
-parse_ls_color ()
+parse_ls_color (void)
{
register char *p; /* Pointer to character being parsed */
char *whichvar; /* LS_COLORS or LS_COLOURS? */
@@ -1293,9 +1287,7 @@ parse_ls_color ()
real names. */
static void
-queue_directory (name, realname)
- char *name;
- char *realname;
+queue_directory (char *name, char *realname)
{
struct pending *new;
@@ -1314,9 +1306,7 @@ queue_directory (name, realname)
this is used for symbolic links to directories. */
static void
-print_dir (name, realname)
- const char *name;
- const char *realname;
+print_dir (const char *name, const char *realname)
{
register DIR *reading;
register struct dirent *next;
@@ -1388,8 +1378,7 @@ print_dir (name, realname)
not listed. */
static void
-add_ignore_pattern (pattern)
- char *pattern;
+add_ignore_pattern (char *pattern)
{
register struct ignore_pattern *ignore;
@@ -1403,8 +1392,7 @@ add_ignore_pattern (pattern)
/* Return nonzero if the file in `next' should be listed. */
static int
-file_interesting (next)
- register struct dirent *next;
+file_interesting (register struct dirent *next)
{
register struct ignore_pattern *ignore;
@@ -1427,7 +1415,7 @@ file_interesting (next)
/* Empty the table of files. */
static void
-clear_files ()
+clear_files (void)
{
register int i;
@@ -1447,10 +1435,7 @@ clear_files ()
Return the number of blocks that the file occupies. */
static int
-gobble_file (name, explicit_arg, dirname)
- char *name;
- int explicit_arg;
- char *dirname;
+gobble_file (char *name, int explicit_arg, char *dirname)
{
register int blocks;
register int val;
@@ -1577,9 +1562,7 @@ gobble_file (name, explicit_arg, dirname)
into the `linkname' field of `f'. */
static void
-get_link_name (filename, f)
- char *filename;
- struct fileinfo *f;
+get_link_name (char *filename, struct fileinfo *f)
{
char *linkbuf;
register int linksize;
@@ -1606,9 +1589,7 @@ get_link_name (filename, f)
If `linkname' is zero, return zero. */
static char *
-make_link_path (path, linkname)
- char *path;
- char *linkname;
+make_link_path (char *path, char *linkname)
{
char *linkbuf;
int bufsiz;
@@ -1641,9 +1622,7 @@ make_link_path (path, linkname)
This is desirable when processing directories recursively. */
static void
-extract_dirs_from_files (dirname, recursive)
- char *dirname;
- int recursive;
+extract_dirs_from_files (char *dirname, int recursive)
{
register int i, j;
register char *path;
@@ -1684,8 +1663,7 @@ extract_dirs_from_files (dirname, recursive)
This is so we don't try to recurse on `././././. ...' */
static int
-is_not_dot_or_dotdot (name)
- char *name;
+is_not_dot_or_dotdot (char *name)
{
char *t;
@@ -1704,7 +1682,7 @@ is_not_dot_or_dotdot (name)
/* Sort the files now in the table. */
static void
-sort_files ()
+sort_files (void)
{
int (*func) ();
@@ -1747,71 +1725,61 @@ sort_files ()
/* Comparison routines for sorting the files. */
static int
-compare_ctime (file1, file2)
- struct fileinfo *file1, *file2;
+compare_ctime (struct fileinfo *file1, struct fileinfo *file2)
{
return longdiff (file2->stat.st_ctime, file1->stat.st_ctime);
}
static int
-rev_cmp_ctime (file2, file1)
- struct fileinfo *file1, *file2;
+rev_cmp_ctime (struct fileinfo *file2, struct fileinfo *file1)
{
return longdiff (file2->stat.st_ctime, file1->stat.st_ctime);
}
static int
-compare_mtime (file1, file2)
- struct fileinfo *file1, *file2;
+compare_mtime (struct fileinfo *file1, struct fileinfo *file2)
{
return longdiff (file2->stat.st_mtime, file1->stat.st_mtime);
}
static int
-rev_cmp_mtime (file2, file1)
- struct fileinfo *file1, *file2;
+rev_cmp_mtime (struct fileinfo *file2, struct fileinfo *file1)
{
return longdiff (file2->stat.st_mtime, file1->stat.st_mtime);
}
static int
-compare_atime (file1, file2)
- struct fileinfo *file1, *file2;
+compare_atime (struct fileinfo *file1, struct fileinfo *file2)
{
return longdiff (file2->stat.st_atime, file1->stat.st_atime);
}
static int
-rev_cmp_atime (file2, file1)
- struct fileinfo *file1, *file2;
+rev_cmp_atime (struct fileinfo *file2, struct fileinfo *file1)
{
return longdiff (file2->stat.st_atime, file1->stat.st_atime);
}
static int
-compare_size (file1, file2)
- struct fileinfo *file1, *file2;
+compare_size (struct fileinfo *file1, struct fileinfo *file2)
{
return longdiff (file2->stat.st_size, file1->stat.st_size);
}
static int
-rev_cmp_size (file2, file1)
- struct fileinfo *file1, *file2;
+rev_cmp_size (struct fileinfo *file2, struct fileinfo *file1)
{
return longdiff (file2->stat.st_size, file1->stat.st_size);
}
static int
-compare_name (file1, file2)
- struct fileinfo *file1, *file2;
+compare_name (struct fileinfo *file1, struct fileinfo *file2)
{
return strcmp (file1->name, file2->name);
}
static int
-rev_cmp_name (file2, file1)
- struct fileinfo *file1, *file2;
+rev_cmp_name (struct fileinfo *file2, struct fileinfo *file1)
{
return strcmp (file1->name, file2->name);
}
@@ -1820,8 +1788,7 @@ rev_cmp_name (file2, file1)
If extensions are the same, compare by filenames instead. */
static int
-compare_extension (file1, file2)
- struct fileinfo *file1, *file2;
+compare_extension (struct fileinfo *file1, struct fileinfo *file2)
{
register char *base1, *base2;
register int cmp;
@@ -1841,8 +1808,7 @@ compare_extension (file1, file2)
}
static int
-rev_cmp_extension (file2, file1)
- struct fileinfo *file1, *file2;
+rev_cmp_extension (struct fileinfo *file2, struct fileinfo *file1)
{
register char *base1, *base2;
register int cmp;
@@ -1864,7 +1830,7 @@ rev_cmp_extension (file2, file1)
/* List all the files now in the table. */
static void
-print_current_files ()
+print_current_files (void)
{
register int i;
@@ -1901,8 +1867,7 @@ print_current_files ()
}
static void
-print_long_format (f)
- struct fileinfo *f;
+print_long_format (struct fileinfo *f)
{
char modebuf[20];
char timebuf[40];
@@ -2031,9 +1996,7 @@ print_long_format (f)
of P and set QUOTED_LENGTH to the length of the quoted P. */
static char *
-quote_filename (p, quoted_length)
- register const char *p;
- size_t *quoted_length;
+quote_filename (register const char *p, size_t *quoted_length)
{
register unsigned char c;
const char *p0 = p;
@@ -2174,8 +2137,7 @@ quote_filename (p, quoted_length)
}
static void
-print_name_with_quoting (p)
- register char *p;
+print_name_with_quoting (register char *p)
{
char *quoted;
size_t quoted_length;
@@ -2191,8 +2153,7 @@ print_name_with_quoting (p)
as requested by switches. */
static void
-print_file_name_and_frills (f)
- struct fileinfo *f;
+print_file_name_and_frills (struct fileinfo *f)
{
if (print_inode)
printf ("%*lu ", INODE_DIGITS, (unsigned long) f->stat.st_ino);
@@ -2213,8 +2174,7 @@ print_file_name_and_frills (f)
}
static void
-print_type_indicator (mode)
- unsigned int mode;
+print_type_indicator (unsigned int mode)
{
if (S_ISDIR (mode))
PUTCHAR ('/');
@@ -2240,8 +2200,7 @@ print_type_indicator (mode)
}
static void
-print_color_indicator (mode)
- unsigned int mode;
+print_color_indicator (unsigned int mode)
{
int type = C_FILE;
@@ -2283,8 +2242,7 @@ print_color_indicator (mode)
/* Output a color indicator (which may contain nulls) */
static void
-put_indicator (n)
- int n;
+put_indicator (int n)
{
register int i;
register char *p;
@@ -2298,8 +2256,7 @@ put_indicator (n)
}
static int
-length_of_file_name_and_frills (f)
- struct fileinfo *f;
+length_of_file_name_and_frills (struct fileinfo *f)
{
register char *p = f->name;
register unsigned char c;
@@ -2377,7 +2334,7 @@ length_of_file_name_and_frills (f)
}
static void
-print_many_per_line ()
+print_many_per_line (void)
{
int filesno; /* Index into files. */
int row; /* Current row. */
@@ -2431,7 +2388,7 @@ print_many_per_line ()
}
static void
-print_horizontal ()
+print_horizontal (void)
{
int filesno;
int max_name_length;
@@ -2482,7 +2439,7 @@ print_horizontal ()
}
static void
-print_with_commas ()
+print_with_commas (void)
{
int filesno;
int pos, old_pos;
@@ -2517,8 +2474,7 @@ print_with_commas ()
Use a TAB character instead of two or more spaces whenever possible. */
static void
-indent (from, to)
- int from, to;
+indent (int from, int to)
{
while (from < to)
{
@@ -2538,8 +2494,7 @@ indent (from, to)
/* Put DIRNAME/NAME into DEST, handling `.' and `/' properly. */
static void
-attach (dest, dirname, name)
- char *dest, *dirname, *name;
+attach (char *dest, char *dirname, char *name)
{
char *dirnamep = dirname;
@@ -2558,8 +2513,7 @@ attach (dest, dirname, name)
}
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/mkdir.c b/src/mkdir.c
index 69af2f524..1b6a27ca8 100644
--- a/src/mkdir.c
+++ b/src/mkdir.c
@@ -38,7 +38,7 @@
#include "version.h"
#include "error.h"
-static void usage ();
+static void usage (int status);
/* The name this program was run with. */
char *program_name;
@@ -63,9 +63,7 @@ static struct option const longopts[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
unsigned int newmode;
unsigned int parent_mode;
@@ -138,8 +136,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/mkfifo.c b/src/mkfifo.c
index e03387916..57f2ffdfa 100644
--- a/src/mkfifo.c
+++ b/src/mkfifo.c
@@ -32,7 +32,7 @@
#include "version.h"
#include "error.h"
-static void usage ();
+static void usage (int status);
/* The name this program was run with. */
char *program_name;
@@ -52,9 +52,7 @@ static struct option const longopts[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
unsigned short newmode;
struct mode_change *change;
@@ -123,8 +121,7 @@ main (argc, argv)
#ifdef S_ISFIFO
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/mknod.c b/src/mknod.c
index ae79a8493..e21c66d36 100644
--- a/src/mknod.c
+++ b/src/mknod.c
@@ -38,7 +38,7 @@
#include "error.h"
#include "xstrtol.h"
-static void usage ();
+static void usage (int status);
/* The name this program was run with. */
char *program_name;
@@ -58,9 +58,7 @@ static struct option const longopts[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
unsigned short newmode;
struct mode_change *change;
@@ -205,8 +203,7 @@ major and minor device numbers may not be specified for fifo files");
}
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/mv.c b/src/mv.c
index 1c9918cf9..60da656d7 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -55,7 +55,7 @@
uid_t geteuid ();
#endif
-char *basename ();
+char *basename (char *);
enum backup_type get_version ();
int isdir ();
int yesno ();
@@ -65,10 +65,10 @@ void strip_trailing_slashes ();
int euidaccess ();
char *stpcpy ();
-static int copy_reg ();
-static int do_move ();
-static int movefile ();
-static void usage ();
+static int copy_reg (char *source, char *dest);
+static int do_move (char *source, char *dest);
+static int movefile (char *source, char *dest);
+static void usage (int status);
/* The name this program was run with. */
char *program_name;
@@ -114,9 +114,7 @@ static struct option const long_options[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int c;
int errors;
@@ -200,8 +198,7 @@ main (argc, argv)
/* If PATH is an existing directory, return nonzero, else 0. */
static int
-is_real_dir (path)
- char *path;
+is_real_dir (char *path)
{
struct stat stats;
@@ -212,9 +209,7 @@ is_real_dir (path)
Return 0 if successful, 1 if an error occurred. */
static int
-movefile (source, dest)
- char *source;
- char *dest;
+movefile (char *source, char *dest)
{
strip_trailing_slashes (source);
@@ -244,9 +239,7 @@ static struct stat dest_stats, source_stats;
Return 0 if successful, 1 if an error occurred. */
static int
-do_move (source, dest)
- char *source;
- char *dest;
+do_move (char *source, char *dest)
{
char *dest_backup = NULL;
@@ -357,8 +350,7 @@ do_move (source, dest)
Return 1 if an error occurred, 0 if successful. */
static int
-copy_reg (source, dest)
- char *source, *dest;
+copy_reg (char *source, char *dest)
{
int ifd;
int ofd;
@@ -459,8 +451,7 @@ copy_reg (source, dest)
}
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/rm.c b/src/rm.c
index 8c00a5910..32dc4500a 100644
--- a/src/rm.c
+++ b/src/rm.c
@@ -33,7 +33,7 @@
# define D_INO(dp) 1
#endif
-char *basename ();
+char *basename (char *);
char *stpcpy ();
char *xmalloc ();
char *xrealloc ();
@@ -41,12 +41,12 @@ int euidaccess ();
int yesno ();
void strip_trailing_slashes ();
-static int clear_directory ();
-static int duplicate_entry ();
-static int remove_dir ();
-static int remove_file ();
-static int rm ();
-static void usage ();
+static int clear_directory (struct stat *statp);
+static int duplicate_entry (struct pathstack *stack, ino_t inum);
+static int remove_dir (struct stat *statp);
+static int remove_file (struct stat *statp);
+static int rm (void);
+static void usage (int status);
/* Name this program was run with. */
char *program_name;
@@ -97,9 +97,7 @@ static struct option const long_opts[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int err = 0;
int c;
@@ -186,7 +184,7 @@ main (argc, argv)
Return 0 if `pathname' is removed, 1 if not. */
static int
-rm ()
+rm (void)
{
struct stat path_stats;
char *base = basename (pathname);
@@ -217,8 +215,7 @@ rm ()
Return 0 if `pathname' is removed, 1 if not. */
static int
-remove_file (statp)
- struct stat *statp;
+remove_file (struct stat *statp)
{
if (!ignore_missing_files && (interactive || stdin_tty)
&& euidaccess (pathname, W_OK)
@@ -261,8 +258,7 @@ remove_file (statp)
Return 0 if `pathname' is removed, 1 if not. */
static int
-remove_dir (statp)
- struct stat *statp;
+remove_dir (struct stat *statp)
{
int err;
@@ -339,8 +335,7 @@ static struct pathstack *pathstack = NULL;
be larger, as well. */
static int
-clear_directory (statp)
- struct stat *statp;
+clear_directory (struct stat *statp)
{
DIR *dirp;
struct dirent *dp;
@@ -483,9 +478,7 @@ clear_directory (statp)
a corrupted file system. */
static int
-duplicate_entry (stack, inum)
- struct pathstack *stack;
- ino_t inum;
+duplicate_entry (struct pathstack *stack, ino_t inum)
{
#ifdef D_INO_IN_DIRENT
struct pathstack *p;
@@ -520,8 +513,7 @@ is the same file as\n", program_name, pathname);
}
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/rmdir.c b/src/rmdir.c
index 21562a4cd..da4331365 100644
--- a/src/rmdir.c
+++ b/src/rmdir.c
@@ -33,8 +33,8 @@
void strip_trailing_slashes ();
-static void remove_parents ();
-static void usage ();
+static void remove_parents (char *path);
+static void usage (int status);
/* The name this program was run with. */
char *program_name;
@@ -58,9 +58,7 @@ static struct option const longopts[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int errors = 0;
int optc;
@@ -118,8 +116,7 @@ main (argc, argv)
Replaces '/' characters in `path' with NULs. */
static void
-remove_parents (path)
- char *path;
+remove_parents (char *path)
{
char *slash;
@@ -138,8 +135,7 @@ remove_parents (path)
}
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/sync.c b/src/sync.c
index 1c1a0b84a..e7f4d44fb 100644
--- a/src/sync.c
+++ b/src/sync.c
@@ -30,8 +30,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",
@@ -50,9 +49,7 @@ Force changed blocks to disk, update the super block.\n\
}
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
program_name = argv[0];
diff --git a/src/touch.c b/src/touch.c
index 2e8b6c051..3aee37538 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -53,8 +53,8 @@ int safe_read ();
int full_write ();
void invalid_arg ();
-static int touch ();
-static void usage ();
+static int touch (char *file);
+static void usage (int status);
#ifndef HAVE_UTIME_NULL
static int utime_now ();
#endif
@@ -126,9 +126,7 @@ static int const time_masks[] =
};
void
-main (argc, argv)
- int argc;
- char **argv;
+main (int argc, char **argv)
{
int c, i;
int date_set = 0;
@@ -256,8 +254,7 @@ main (argc, argv)
Return 0 if successful, 1 if an error occurs. */
static int
-touch (file)
- char *file;
+touch (char *file)
{
int status;
struct stat sbuf;
@@ -369,8 +366,7 @@ utime_now (file, filesize)
#endif
static void
-usage (status)
- int status;
+usage (int status)
{
if (status != 0)
fprintf (stderr, "Try `%s --help' for more information.\n",