summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/chgrp.c27
-rw-r--r--src/chmod.c17
-rw-r--r--src/chown.c24
-rw-r--r--src/cp.c12
-rw-r--r--src/dd.c75
-rw-r--r--src/df.c39
-rw-r--r--src/du.c45
-rw-r--r--src/install.c40
-rw-r--r--src/ln.c11
-rw-r--r--src/ls.c159
-rw-r--r--src/mkdir.c7
-rw-r--r--src/mkfifo.c7
-rw-r--r--src/mknod.c7
-rw-r--r--src/mv.c21
-rw-r--r--src/rm.c27
-rw-r--r--src/rmdir.c11
-rw-r--r--src/touch.c19
17 files changed, 283 insertions, 265 deletions
diff --git a/src/chgrp.c b/src/chgrp.c
index 62358af1c..9b178eac7 100644
--- a/src/chgrp.c
+++ b/src/chgrp.c
@@ -37,13 +37,14 @@ int lstat ();
char *savedir ();
char *xmalloc ();
char *xrealloc ();
-int change_file_group ();
-int change_dir_group ();
-int isnumber ();
-void describe_change ();
void error ();
-void parse_group ();
-void usage ();
+
+static int change_file_group ();
+static int change_dir_group ();
+static int isnumber ();
+static void describe_change ();
+static void parse_group ();
+static void usage ();
/* The name the program was run with. */
char *program_name;
@@ -63,7 +64,7 @@ static int changes_only;
/* The name of the group to which ownership of the files is being given. */
static char *groupname;
-static struct option long_options[] =
+static struct option const long_options[] =
{
{"recursive", 0, 0, 'R'},
{"changes", 0, 0, 'c'},
@@ -121,7 +122,7 @@ main (argc, argv)
/* Set *G according to NAME. */
-void
+static void
parse_group (name, g)
char *name;
int *g;
@@ -148,7 +149,7 @@ parse_group (name, g)
If it is a directory and -R is given, recurse.
Return 0 if successful, 1 if errors occurred. */
-int
+static int
change_file_group (file, group)
char *file;
int group;
@@ -187,7 +188,7 @@ change_file_group (file, group)
STATP points to the results of lstat on DIR.
Return 0 if successful, 1 if errors occurred. */
-int
+static int
change_dir_group (dir, group, statp)
char *dir;
int group;
@@ -240,7 +241,7 @@ change_dir_group (dir, group, statp)
/* Tell the user the group name to which ownership of FILE
has been given; if CHANGED is zero, FILE was that group already. */
-void
+static void
describe_change (file, changed)
char *file;
int changed;
@@ -254,7 +255,7 @@ describe_change (file, changed)
/* Return nonzero if STR represents an unsigned decimal integer,
otherwise return 0. */
-int
+static int
isnumber (str)
char *str;
{
@@ -264,7 +265,7 @@ isnumber (str)
return 1;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
diff --git a/src/chmod.c b/src/chmod.c
index efdc08cd1..4e04dfc64 100644
--- a/src/chmod.c
+++ b/src/chmod.c
@@ -34,12 +34,13 @@ int lstat ();
char *savedir ();
char *xmalloc ();
char *xrealloc ();
-int change_file_mode ();
-int change_dir_mode ();
-void describe_change ();
void error ();
void mode_string ();
-void usage ();
+
+static int change_file_mode ();
+static int change_dir_mode ();
+static void describe_change ();
+static void usage ();
/* The name the program was run with. */
char *program_name;
@@ -140,7 +141,7 @@ main (argc, argv)
/* Change the mode of FILE according to the list of operations CHANGES.
Return 0 if successful, 1 if errors occurred. */
-int
+static int
change_file_mode (file, changes)
char *file;
struct mode_change *changes;
@@ -186,7 +187,7 @@ change_file_mode (file, changes)
STATP points to the results of lstat on DIR.
Return 0 if successful, 1 if errors occurred. */
-int
+static int
change_dir_mode (dir, changes, statp)
char *dir;
struct mode_change *changes;
@@ -239,7 +240,7 @@ change_dir_mode (dir, changes, statp)
/* Tell the user the mode MODE that file FILE has been set to;
if CHANGED is zero, FILE had that mode already. */
-void
+static void
describe_change (file, mode, changed)
char *file;
unsigned short mode;
@@ -257,7 +258,7 @@ describe_change (file, mode, changed)
file, mode & 07777, &perms[1]);
}
-void
+static void
usage ()
{
fprintf (stderr, "\
diff --git a/src/chown.c b/src/chown.c
index dca9ba6de..b510f1228 100644
--- a/src/chown.c
+++ b/src/chown.c
@@ -48,17 +48,17 @@ struct group *getgrgid ();
#endif
int lstat ();
-
-char *parse_user_spec ();
char *savedir ();
+char *parse_user_spec ();
char *xmalloc ();
char *xrealloc ();
-int change_file_owner ();
-int change_dir_owner ();
-int isnumber ();
-void describe_change ();
void error ();
-void usage ();
+int isnumber ();
+
+static int change_file_owner ();
+static int change_dir_owner ();
+static void describe_change ();
+static void usage ();
/* The name the program was run with. */
char *program_name;
@@ -81,7 +81,7 @@ static char *username;
/* The name of the group to which ownership of the files is being given. */
static char *groupname;
-static struct option long_options[] =
+static struct option const long_options[] =
{
{"recursive", 0, 0, 'R'},
{"changes", 0, 0, 'c'},
@@ -147,7 +147,7 @@ main (argc, argv)
If it is a directory and -R is given, recurse.
Return 0 if successful, 1 if errors occurred. */
-int
+static int
change_file_owner (file, user, group)
char *file;
uid_t user;
@@ -191,7 +191,7 @@ change_file_owner (file, user, group)
STATP points to the results of lstat on DIR.
Return 0 if successful, 1 if errors occurred. */
-int
+static int
change_dir_owner (dir, user, group, statp)
char *dir;
uid_t user;
@@ -245,7 +245,7 @@ change_dir_owner (dir, user, group, statp)
/* Tell the user the user and group names to which ownership of FILE
has been given; if CHANGED is zero, FILE had those owners already. */
-void
+static void
describe_change (file, changed)
char *file;
int changed;
@@ -260,7 +260,7 @@ describe_change (file, changed)
printf ("%s\n", username);
}
-void
+static void
usage ()
{
fprintf (stderr, "\
diff --git a/src/cp.c b/src/cp.c
index f54a1e578..916c52f92 100644
--- a/src/cp.c
+++ b/src/cp.c
@@ -43,7 +43,11 @@ char *dirname ();
enum backup_type get_version ();
int eaccess_stat ();
+static int do_copy ();
+static int copy ();
+static int copy_dir ();
static int make_path ();
+static int copy_reg ();
static int re_protect ();
/* Initial number of entries in each hash table entry's table of inodes. */
@@ -113,7 +117,7 @@ static int umask_kill;
/* This process's effective user ID. */
static uid_t myeuid;
-static struct option long_opts[] =
+static struct option const long_opts[] =
{
{"archive", 0, NULL, 'a'},
{"backup", 0, NULL, 'b'},
@@ -275,7 +279,7 @@ main (argc, argv)
/* Scan the arguments, and copy each by calling copy.
Return 0 if successful, 1 if any errors occur. */
-int
+static int
do_copy (argc, argv)
int argc;
char *argv[];
@@ -995,7 +999,7 @@ re_protect (const_dst_path, src_offset, attr_list)
recursion. SRC_SB and ANCESTORS describe SRC_PATH_IN.
Return 0 if successful, -1 if an error occurs. */
-int
+static int
copy_dir (src_path_in, dst_path_in, new_dst, src_sb, ancestors)
char *src_path_in;
char *dst_path_in;
@@ -1053,7 +1057,7 @@ copy_dir (src_path_in, dst_path_in, new_dst, src_sb, ancestors)
(Holes are read as zeroes by the `read' system call.)
Return 0 if successful, -1 if an error occurred. */
-int
+static int
copy_reg (src_path, dst_path)
char *src_path;
char *dst_path;
diff --git a/src/dd.c b/src/dd.c
index dc8d85a7d..01f9009fd 100644
--- a/src/dd.c
+++ b/src/dd.c
@@ -92,23 +92,24 @@
#define C_TWOBUFS 04000
char *xmalloc ();
-RETSIGTYPE interrupt_handler ();
-int bit_count ();
-int parse_integer ();
-void apply_translations ();
-void copy ();
-void copy_simple ();
-void copy_with_block ();
-void copy_with_unblock ();
void error ();
-void parse_conversion ();
-void print_stats ();
-void translate_charset ();
-void quit ();
-void scanargs ();
-void skip ();
-void usage ();
-void write_output ();
+
+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 ();
/* The name this program was run with. */
char *program_name;
@@ -194,7 +195,7 @@ static struct conversion conversions[] =
/* Translation table formed by applying successive transformations. */
static unsigned char trans_table[256];
-static unsigned char ascii_to_ebcdic[] =
+static unsigned char const ascii_to_ebcdic[] =
{
0, 01, 02, 03, 067, 055, 056, 057,
026, 05, 045, 013, 014, 015, 016, 017,
@@ -230,7 +231,7 @@ static unsigned char ascii_to_ebcdic[] =
0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377
};
-static unsigned char ascii_to_ibm[] =
+static unsigned char const ascii_to_ibm[] =
{
0, 01, 02, 03, 067, 055, 056, 057,
026, 05, 045, 013, 014, 015, 016, 017,
@@ -266,7 +267,7 @@ static unsigned char ascii_to_ibm[] =
0356, 0357, 0372, 0373, 0374, 0375, 0376, 0377
};
-static unsigned char ebcdic_to_ascii[] =
+static unsigned char const ebcdic_to_ascii[] =
{
0, 01, 02, 03, 0234, 011, 0206, 0177,
0227, 0215, 0216, 013, 014, 015, 016, 017,
@@ -374,7 +375,7 @@ main (argc, argv)
which is open with read permission for FILE. Store up to BLOCKSIZE
bytes of the data at a time in BUF, if necessary. */
-void
+static void
skip (fdesc, file, records, blocksize, buf)
int fdesc;
char *file;
@@ -419,7 +420,7 @@ skip (fdesc, file, records, blocksize, buf)
/* Apply the character-set translations specified by the user
to the NREAD bytes in BUF. */
-void
+static void
translate_buffer (buf, nread)
unsigned char *buf;
int nread;
@@ -442,7 +443,7 @@ static unsigned char saved_char;
previous call. If NREAD is odd, save the last char for the
next call. Return the new start of the BUF buffer. */
-unsigned char *
+static unsigned char *
swab_buffer (buf, nread)
unsigned char *buf;
int *nread;
@@ -488,7 +489,7 @@ static int col = 0;
/* The main loop. */
-void
+static void
copy ()
{
unsigned char *ibuf, *bufstart; /* Input buffer. */
@@ -646,7 +647,7 @@ copy ()
/* Copy NREAD bytes of BUF, with no conversions. */
-void
+static void
copy_simple (buf, nread)
unsigned char *buf;
int nread;
@@ -675,7 +676,7 @@ copy_simple (buf, nread)
(pad newline-terminated records to `conversion_blocksize',
replacing the newline with trailing spaces). */
-void
+static void
copy_with_block (buf, nread)
unsigned char *buf;
int nread;
@@ -706,7 +707,7 @@ copy_with_block (buf, nread)
(replace trailing spaces in `conversion_blocksize'-sized records
with a newline). */
-void
+static void
copy_with_unblock (buf, nread)
unsigned char *buf;
int nread;
@@ -743,7 +744,7 @@ copy_with_unblock (buf, nread)
/* Write, then empty, the output buffer `obuf'. */
-void
+static void
write_output ()
{
int nwritten = write (output_fd, obuf, output_blocksize);
@@ -759,7 +760,7 @@ write_output ()
oc = 0;
}
-void
+static void
scanargs (argc, argv)
int argc;
char **argv;
@@ -830,7 +831,7 @@ scanargs (argc, argv)
optionally multiplied by various values.
Return -1 if STR does not represent a number in this format. */
-int
+static int
parse_integer (str)
char *str;
{
@@ -871,7 +872,7 @@ loop:
/* Interpret one "conv=..." option. */
-void
+static void
parse_conversion (str)
char *str;
{
@@ -900,7 +901,7 @@ parse_conversion (str)
/* Fix up translation table. */
-void
+static void
apply_translations ()
{
int i;
@@ -948,7 +949,7 @@ only one conv in {ascii,ebcdic,ibm}, {lcase,ucase}, {block,unblock}, {unblock,sy
}
}
-void
+static void
translate_charset (new_trans)
unsigned char *new_trans;
{
@@ -961,7 +962,7 @@ translate_charset (new_trans)
/* Return the number of 1 bits in `i'. */
-int
+static int
bit_count (i)
register unsigned int i;
{
@@ -972,7 +973,7 @@ bit_count (i)
return set_bits;
}
-void
+static void
print_stats ()
{
fprintf (stderr, "%u+%u records in\n", r_full, r_partial);
@@ -982,7 +983,7 @@ print_stats ()
r_truncate == 1 ? "" : "s");
}
-void
+static void
quit (code)
int code;
{
@@ -995,13 +996,13 @@ quit (code)
exit (code);
}
-RETSIGTYPE
+static RETSIGTYPE
interrupt_handler ()
{
quit (1);
}
-void
+static void
usage (string, arg0, arg1)
char *string, *arg0, *arg1;
{
diff --git a/src/df.c b/src/df.c
index 6439a7ec5..d6ce9d242 100644
--- a/src/df.c
+++ b/src/df.c
@@ -39,16 +39,17 @@
char *strstr ();
char *xmalloc ();
char *xstrdup ();
-int fs_to_list ();
-void add_fs_type ();
void error ();
-void print_header ();
-void show_entry ();
-void show_all_entries ();
-void show_dev ();
-void show_disk ();
-void show_point ();
-void usage ();
+
+static int fs_to_list ();
+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 ();
/* If nonzero, show inode information. */
static int inode_format;
@@ -93,7 +94,7 @@ static struct fs_select *fs_list;
/* Linked list of mounted filesystems. */
static struct mount_entry *mount_list;
-static struct option long_options[] =
+static struct option const long_options[] =
{
{"all", 0, &show_all_fs, 1},
{"inodes", 0, &inode_format, 1},
@@ -183,7 +184,7 @@ main (argc, argv)
exit (exit_status);
}
-void
+static void
print_header ()
{
if (inode_format)
@@ -197,7 +198,7 @@ print_header ()
/* Show all mounted filesystems, except perhaps those that are of
an unselected type or are empty. */
-void
+static void
show_all_entries ()
{
struct mount_entry *me;
@@ -209,7 +210,7 @@ show_all_entries ()
/* Determine what kind of node PATH is and show the disk usage
for it. STATP is the results of `stat' on PATH. */
-void
+static void
show_entry (path, statp)
char *path;
struct stat *statp;
@@ -223,7 +224,7 @@ show_entry (path, statp)
/* Identify the directory, if any, that device
DISK is mounted on, and show its disk usage. */
-void
+static void
show_disk (disk)
char *disk;
{
@@ -243,7 +244,7 @@ show_disk (disk)
and show its disk usage.
STATP is the results of `stat' on POINT. */
-void
+static void
show_point (point, statp)
char *point;
struct stat *statp;
@@ -280,7 +281,7 @@ show_point (point, statp)
filesystem on DISK.
If FSTYPE is non-NULL, it is the type of the filesystem on DISK. */
-void
+static void
show_dev (disk, mount_point, fstype)
char *disk;
char *mount_point;
@@ -358,7 +359,7 @@ show_dev (disk, mount_point, fstype)
/* Add FSTYPE to the list of filesystem types to display. */
-void
+static void
add_fs_type (fstype)
char *fstype;
{
@@ -373,7 +374,7 @@ add_fs_type (fstype)
/* If FSTYPE is a type of filesystem that should be listed,
return nonzero, else zero. */
-int
+static int
fs_to_list (fstype)
char *fstype;
{
@@ -387,7 +388,7 @@ fs_to_list (fstype)
return 0;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
diff --git a/src/du.c b/src/du.c
index 10864bf01..6f24f1260 100644
--- a/src/du.c
+++ b/src/du.c
@@ -91,17 +91,18 @@ char *savedir ();
char *xgetcwd ();
char *xmalloc ();
char *xrealloc ();
-int hash_insert ();
-int hash_insert2 ();
-long count_entry ();
-void du_files ();
void error ();
-void hash_init ();
-void hash_reset ();
-void str_concatc ();
-void str_copyc ();
-void str_init ();
-void str_trunc ();
+
+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 ();
/* Name under which this program was invoked. */
char *program_name;
@@ -154,7 +155,7 @@ static int (*xstat) ();
static int exit_status;
-static struct option long_options[] =
+static struct option const long_options[] =
{
{"all", 0, &opt_all, 1},
{"bytes", 0, NULL, 'b'},
@@ -169,7 +170,7 @@ static struct option long_options[] =
{NULL, 0, NULL, 0}
};
-void
+static void
usage (reason)
char *reason;
{
@@ -278,7 +279,7 @@ main (argc, argv)
/* Recursively print the sizes of the directories (and, if selected, files)
named in FILES, the last entry of which is NULL. */
-void
+static void
du_files (files)
char **files;
{
@@ -347,7 +348,7 @@ du_files (files)
TOP is one for external calls, zero for recursive calls.
LAST_DEV is the device that the parent directory of ENT is on. */
-long
+static long
count_entry (ent, top, last_dev)
char *ent;
int top;
@@ -454,7 +455,7 @@ count_entry (ent, top, last_dev)
inserted, and MODULUS and ENTRY_TAB_SIZE in the global `htab' will be
doubled.) */
-void
+static void
hash_init (modulus, entry_tab_size)
unsigned modulus;
unsigned entry_tab_size;
@@ -477,7 +478,7 @@ hash_init (modulus, entry_tab_size)
/* Reset the hash structure in the global variable `htab' to
contain no entries. */
-void
+static void
hash_reset ()
{
int i;
@@ -495,7 +496,7 @@ hash_reset ()
was not found already. Return zero if the item was inserted and non-zero
if it wasn't. */
-int
+static int
hash_insert (ino, dev)
ino_t ino;
dev_t dev;
@@ -564,7 +565,7 @@ hash_insert (ino, dev)
already present. Return zero if inserted and non-zero if it
already existed. */
-int
+static int
hash_insert2 (htab, ino, dev)
struct htab *htab;
ino_t ino;
@@ -604,7 +605,7 @@ hash_insert2 (htab, ino, dev)
/* Initialize the struct string S1 for holding SIZE characters. */
-void
+static void
str_init (s1, size)
string *s1;
unsigned size;
@@ -632,7 +633,7 @@ ensure_space (s, size)
/* Assign the null-terminated C-string CSTR to S1. */
-void
+static void
str_copyc (s1, cstr)
string s1;
char *cstr;
@@ -643,7 +644,7 @@ str_copyc (s1, cstr)
s1->length = l;
}
-void
+static void
str_concatc (s1, cstr)
string s1;
char *cstr;
@@ -659,7 +660,7 @@ str_concatc (s1, cstr)
/* Truncate the string S1 to have length LENGTH. */
-void
+static void
str_trunc (s1, length)
string s1;
unsigned length;
diff --git a/src/install.c b/src/install.c
index 881038c41..326fb57e2 100644
--- a/src/install.c
+++ b/src/install.c
@@ -84,18 +84,18 @@ int wait ();
char *basename ();
char *xmalloc ();
-int change_attributes ();
-int copy_file ();
-int install_dir ();
-int install_file_in_dir ();
-int install_file_in_file ();
-int isdir ();
-int make_path ();
-int isnumber ();
void error ();
-void get_ids ();
-void strip ();
-void usage ();
+int make_path ();
+int isdir ();
+
+static int change_attributes ();
+static int copy_file ();
+static int install_file_in_dir ();
+static int install_file_in_file ();
+static int isnumber ();
+static void get_ids ();
+static void strip ();
+static void usage ();
/* The name this program was run with, for error messages. */
char *program_name;
@@ -124,7 +124,7 @@ static int strip_files;
/* If nonzero, install a directory instead of a regular file. */
static int dir_arg;
-static struct option long_options[] =
+static struct option const long_options[] =
{
{"strip", 0, NULL, 's'},
{"directory", 0, NULL, 'd'},
@@ -231,7 +231,7 @@ main (argc, argv)
attributes.
Return 0 if successful, 1 if an error occurs. */
-int
+static int
install_file_in_file (from, to)
char *from;
char *to;
@@ -247,7 +247,7 @@ install_file_in_file (from, to)
and give the copy the appropriate attributes.
Return 0 if successful, 1 if not. */
-int
+static int
install_file_in_dir (from, to_dir)
char *from;
char *to_dir;
@@ -270,7 +270,7 @@ static char buffer[READ_SIZE];
/* Copy file FROM onto file TO, creating TO if necessary.
Return 0 if the copy is successful, 1 if not. */
-int
+static int
copy_file (from, to)
char *from;
char *to;
@@ -357,7 +357,7 @@ copy_file (from, to)
/* Set the attributes of file or directory PATH.
Return 0 if successful, 1 if not. */
-int
+static int
change_attributes (path)
char *path;
{
@@ -401,7 +401,7 @@ change_attributes (path)
magic numbers vary so much from system to system that making
it portable would be very difficult. Not worth the effort. */
-void
+static void
strip (path)
char *path;
{
@@ -427,7 +427,7 @@ strip (path)
/* Initialize the user and group ownership of the files to install. */
-void
+static void
get_ids ()
{
struct passwd *pw;
@@ -469,7 +469,7 @@ get_ids ()
/* Return nonzero if STR is an ASCII representation of a nonzero
decimal integer, zero if not. */
-int
+static int
isnumber (str)
char *str;
{
@@ -481,7 +481,7 @@ isnumber (str)
return 1;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
diff --git a/src/ln.c b/src/ln.c
index d80d0cede..008e595d8 100644
--- a/src/ln.c
+++ b/src/ln.c
@@ -34,11 +34,12 @@ int symlink ();
char *basename ();
enum backup_type get_version ();
-int do_link ();
int isdir ();
int yesno ();
void error ();
-void usage ();
+
+static void usage ();
+static int do_link ();
/* A pointer to the function used to make links. This will point to either
`link' or `symlink'. */
@@ -62,7 +63,7 @@ static int hard_dir_link;
/* The name by which the program was run, for error messages. */
char *program_name;
-static struct option long_options[] =
+static struct option const long_options[] =
{
{"backup", 0, NULL, 'b'},
{"directory", 0, &hard_dir_link, 1},
@@ -173,7 +174,7 @@ main (argc, argv)
If DEST is a directory, put the link to SOURCE in that directory.
Return 1 if there is an error, otherwise 0. */
-int
+static int
do_link (source, dest)
char *source;
char *dest;
@@ -277,7 +278,7 @@ do_link (source, dest)
return 1;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
diff --git a/src/ls.c b/src/ls.c
index 870c13066..6fb98fc8a 100644
--- a/src/ls.c
+++ b/src/ls.c
@@ -69,47 +69,48 @@ void mode_string ();
char *xstrdup ();
char *getgroup ();
char *getuser ();
-char *make_link_path ();
char *xmalloc ();
char *xrealloc ();
int argmatch ();
-int compare_atime ();
-int rev_cmp_atime ();
-int compare_ctime ();
-int rev_cmp_ctime ();
-int compare_mtime ();
-int rev_cmp_mtime ();
-int compare_size ();
-int rev_cmp_size ();
-int compare_name ();
-int rev_cmp_name ();
-int compare_extension ();
-int rev_cmp_extension ();
-int decode_switches ();
-int file_interesting ();
-int gobble_file ();
-int is_not_dot_or_dotdot ();
-int length_of_file_name_and_frills ();
-void add_ignore_pattern ();
-void attach ();
-void clear_files ();
void error ();
-void extract_dirs_from_files ();
-void get_link_name ();
-void indent ();
void invalid_arg ();
-void print_current_files ();
-void print_dir ();
-void print_file_name_and_frills ();
-void print_horizontal ();
-void print_long_format ();
-void print_many_per_line ();
-void print_name_with_quoting ();
-void print_type_indicator ();
-void print_with_commas ();
-void queue_directory ();
-void sort_files ();
-void usage ();
+
+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 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_with_commas ();
+static void queue_directory ();
+static void sort_files ();
+static void usage ();
enum filetype
{
@@ -419,7 +420,7 @@ main (argc, argv)
exit (exit_status);
}
-static struct option long_options[] =
+static struct option const long_options[] =
{
{"all", 0, 0, 'a'},
{"escape", 0, 0, 'b'},
@@ -447,34 +448,34 @@ static struct option long_options[] =
{0, 0, 0, 0}
};
-static char *format_args[] =
+static char const* const format_args[] =
{
"verbose", "long", "commas", "horizontal", "across",
"vertical", "single-column", 0
};
-static enum format formats[] =
+static enum format const formats[] =
{
long_format, long_format, with_commas, horizontal, horizontal,
many_per_line, one_per_line
};
-static char *sort_args[] =
+static char const* const sort_args[] =
{
"none", "time", "size", "extension", 0
};
-static enum sort_type sort_types[] =
+static enum sort_type const sort_types[] =
{
sort_none, sort_time, sort_size, sort_extension
};
-static char *time_args[] =
+static char const* const time_args[] =
{
"atime", "access", "use", "ctime", "status", 0
};
-static enum time_type time_types[] =
+static enum time_type const time_types[] =
{
time_atime, time_atime, time_atime, time_ctime, time_ctime
};
@@ -482,7 +483,7 @@ static enum time_type time_types[] =
/* Set all the option flags according to the switches specified.
Return the index of the first non-option argument. */
-int
+static int
decode_switches (argc, argv)
int argc;
char **argv;
@@ -739,7 +740,7 @@ decode_switches (argc, argv)
to be treated as regular directories but still be listed under their
real names. */
-void
+static void
queue_directory (name, realname)
char *name;
char *realname;
@@ -760,7 +761,7 @@ queue_directory (name, realname)
If `realname' is nonzero, print its name instead of `name';
this is used for symbolic links to directories. */
-void
+static void
print_dir (name, realname)
char *name;
char *realname;
@@ -824,7 +825,7 @@ print_dir (name, realname)
/* Add `pattern' to the list of patterns for which files that match are
not listed. */
-void
+static void
add_ignore_pattern (pattern)
char *pattern;
{
@@ -839,7 +840,7 @@ add_ignore_pattern (pattern)
/* Return nonzero if the file in `next' should be listed. */
-int
+static int
file_interesting (next)
register struct direct *next;
{
@@ -863,7 +864,7 @@ file_interesting (next)
/* Empty the table of files. */
-void
+static void
clear_files ()
{
register int i;
@@ -883,7 +884,7 @@ clear_files ()
Verify that the file exists, and print an error message if it does not.
Return the number of blocks that the file occupies. */
-int
+static int
gobble_file (name, explicit_arg, dirname)
char *name;
int explicit_arg;
@@ -1008,7 +1009,7 @@ gobble_file (name, explicit_arg, dirname)
/* Put the name of the file that `filename' is a symbolic link to
into the `linkname' field of `f'. */
-void
+static void
get_link_name (filename, f)
char *filename;
struct file *f;
@@ -1046,7 +1047,7 @@ get_link_name (filename, f)
prepended; otherwise, return a copy of `linkname'.
If `linkname' is zero, return zero. */
-char *
+static char *
make_link_path (path, linkname)
char *path;
char *linkname;
@@ -1081,7 +1082,7 @@ make_link_path (path, linkname)
`recursive' is nonzero if we should not treat `.' and `..' as dirs.
This is desirable when processing directories recursively. */
-void
+static void
extract_dirs_from_files (dirname, recursive)
char *dirname;
int recursive;
@@ -1124,7 +1125,7 @@ extract_dirs_from_files (dirname, recursive)
/* Return non-zero if `name' doesn't end in `.' or `..'
This is so we don't try to recurse on `././././. ...' */
-int
+static int
is_not_dot_or_dotdot (name)
char *name;
{
@@ -1144,7 +1145,7 @@ is_not_dot_or_dotdot (name)
/* Sort the files now in the table. */
-void
+static void
sort_files ()
{
int (*func) ();
@@ -1183,70 +1184,70 @@ sort_files ()
/* Comparison routines for sorting the files. */
-int
+static int
compare_ctime (file1, file2)
struct file *file1, *file2;
{
return longdiff (file2->stat.st_ctime, file1->stat.st_ctime);
}
-int
+static int
rev_cmp_ctime (file2, file1)
struct file *file1, *file2;
{
return longdiff (file2->stat.st_ctime, file1->stat.st_ctime);
}
-int
+static int
compare_mtime (file1, file2)
struct file *file1, *file2;
{
return longdiff (file2->stat.st_mtime, file1->stat.st_mtime);
}
-int
+static int
rev_cmp_mtime (file2, file1)
struct file *file1, *file2;
{
return longdiff (file2->stat.st_mtime, file1->stat.st_mtime);
}
-int
+static int
compare_atime (file1, file2)
struct file *file1, *file2;
{
return longdiff (file2->stat.st_atime, file1->stat.st_atime);
}
-int
+static int
rev_cmp_atime (file2, file1)
struct file *file1, *file2;
{
return longdiff (file2->stat.st_atime, file1->stat.st_atime);
}
-int
+static int
compare_size (file1, file2)
struct file *file1, *file2;
{
return longdiff (file2->stat.st_size, file1->stat.st_size);
}
-int
+static int
rev_cmp_size (file2, file1)
struct file *file1, *file2;
{
return longdiff (file2->stat.st_size, file1->stat.st_size);
}
-int
+static int
compare_name (file1, file2)
struct file *file1, *file2;
{
return strcmp (file1->name, file2->name);
}
-int
+static int
rev_cmp_name (file2, file1)
struct file *file1, *file2;
{
@@ -1256,7 +1257,7 @@ rev_cmp_name (file2, file1)
/* Compare file extensions. Files with no extension are `smallest'.
If extensions are the same, compare by filenames instead. */
-int
+static int
compare_extension (file1, file2)
struct file *file1, *file2;
{
@@ -1277,7 +1278,7 @@ compare_extension (file1, file2)
return cmp;
}
-int
+static int
rev_cmp_extension (file2, file1)
struct file *file1, *file2;
{
@@ -1300,7 +1301,7 @@ rev_cmp_extension (file2, file1)
/* List all the files now in the table. */
-void
+static void
print_current_files ()
{
register int i;
@@ -1337,7 +1338,7 @@ print_current_files ()
}
}
-void
+static void
print_long_format (f)
struct file *f;
{
@@ -1420,7 +1421,7 @@ print_long_format (f)
print_type_indicator (f->stat.st_mode);
}
-void
+static void
print_name_with_quoting (p)
register char *p;
{
@@ -1493,7 +1494,7 @@ print_name_with_quoting (p)
Also print file size, inode number, and filetype indicator character,
as requested by switches. */
-void
+static void
print_file_name_and_frills (f)
struct file *f;
{
@@ -1510,7 +1511,7 @@ print_file_name_and_frills (f)
print_type_indicator (f->stat.st_mode);
}
-void
+static void
print_type_indicator (mode)
unsigned int mode;
{
@@ -1537,7 +1538,7 @@ print_type_indicator (mode)
putchar ('*');
}
-int
+static int
length_of_file_name_and_frills (f)
struct file *f;
{
@@ -1615,7 +1616,7 @@ length_of_file_name_and_frills (f)
return len;
}
-void
+static void
print_many_per_line ()
{
int filesno; /* Index into files. */
@@ -1669,7 +1670,7 @@ print_many_per_line ()
}
}
-void
+static void
print_horizontal ()
{
int filesno;
@@ -1720,7 +1721,7 @@ print_horizontal ()
putchar ('\n');
}
-void
+static void
print_with_commas ()
{
int filesno;
@@ -1754,7 +1755,7 @@ print_with_commas ()
/* Assuming cursor is at position FROM, indent up to position TO. */
-void
+static void
indent (from, to)
int from, to;
{
@@ -1775,7 +1776,7 @@ indent (from, to)
/* Put DIRNAME/NAME into DEST, handling `.' and `/' properly. */
-void
+static void
attach (dest, dirname, name)
char *dest, *dirname, *name;
{
@@ -1795,7 +1796,7 @@ attach (dest, dirname, name)
*dest = 0;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
diff --git a/src/mkdir.c b/src/mkdir.c
index c60c5460f..d8de4aff2 100644
--- a/src/mkdir.c
+++ b/src/mkdir.c
@@ -35,7 +35,8 @@
int make_path ();
void error ();
-void usage ();
+
+static void usage ();
/* If nonzero, ensure that a path exists. */
static int path_mode;
@@ -43,7 +44,7 @@ static int path_mode;
/* The name this program was run with. */
char *program_name;
-static struct option longopts[] =
+static struct option const longopts[] =
{
{"mode", 1, NULL, 'm'},
{"path", 0, &path_mode, 1},
@@ -110,7 +111,7 @@ main (argc, argv)
exit (errors);
}
-void
+static void
usage ()
{
fprintf (stderr, "\
diff --git a/src/mkfifo.c b/src/mkfifo.c
index 24a943744..b2bc15247 100644
--- a/src/mkfifo.c
+++ b/src/mkfifo.c
@@ -29,12 +29,13 @@
#include "modechange.h"
void error ();
-void usage ();
+
+static void usage ();
/* The name this program was run with. */
char *program_name;
-static struct option longopts[] =
+static struct option const longopts[] =
{
{"mode", 1, NULL, 'm'},
{NULL, 0, NULL, 0}
@@ -97,7 +98,7 @@ main (argc, argv)
}
#ifdef S_ISFIFO
-void
+static void
usage ()
{
fprintf (stderr, "\
diff --git a/src/mknod.c b/src/mknod.c
index d49070cbd..d3091a5bf 100644
--- a/src/mknod.c
+++ b/src/mknod.c
@@ -34,12 +34,13 @@
#include "modechange.h"
void error ();
-void usage ();
+
+static void usage ();
/* The name this program was run with. */
char *program_name;
-static struct option longopts[] =
+static struct option const longopts[] =
{
{"mode", 1, NULL, 'm'},
{NULL, 0, NULL, 0}
@@ -132,7 +133,7 @@ main (argc, argv)
exit (0);
}
-void
+static void
usage ()
{
fprintf (stderr, "\
diff --git a/src/mv.c b/src/mv.c
index cd95ec2f9..5fe629dd6 100644
--- a/src/mv.c
+++ b/src/mv.c
@@ -52,15 +52,16 @@ uid_t geteuid ();
char *basename ();
enum backup_type get_version ();
-int copy_reg ();
-int do_move ();
-int eaccess_stat ();
int isdir ();
-int movefile ();
int yesno ();
void error ();
void strip_trailing_slashes ();
-void usage ();
+int eaccess_stat ();
+
+static int copy_reg ();
+static int do_move ();
+static int movefile ();
+static void usage ();
/* The name this program was run with. */
char *program_name;
@@ -85,7 +86,7 @@ static int stdin_tty;
/* This process's effective user ID. */
static uid_t myeuid;
-static struct option long_options[] =
+static struct option const long_options[] =
{
{"backup", 0, NULL, 'b'},
{"force", 0, NULL, 'f'},
@@ -171,7 +172,7 @@ main (argc, argv)
/* Move file SOURCE onto DEST. Handles the case when DEST is a directory.
Return 0 if successful, 1 if an error occurred. */
-int
+static int
movefile (source, dest)
char *source;
char *dest;
@@ -199,7 +200,7 @@ static struct stat dest_stats, source_stats;
If DEST is a directory, SOURCE must be also.
Return 0 if successful, 1 if an error occurred. */
-int
+static int
do_move (source, dest)
char *source;
char *dest;
@@ -311,7 +312,7 @@ do_move (source, dest)
/* Copy regular file SOURCE onto file DEST.
Return 1 if an error occurred, 0 if successful. */
-int
+static int
copy_reg (source, dest)
char *source, *dest;
{
@@ -422,7 +423,7 @@ copy_reg (source, dest)
return 0;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
diff --git a/src/rm.c b/src/rm.c
index 7b98acdef..5368ac73e 100644
--- a/src/rm.c
+++ b/src/rm.c
@@ -34,16 +34,17 @@ char *basename ();
char *stpcpy ();
char *xmalloc ();
char *xrealloc ();
-int clear_directory ();
-int duplicate_entry ();
int eaccess_stat ();
-int remove_dir ();
-int remove_file ();
-int rm ();
int yesno ();
void error ();
void strip_trailing_slashes ();
-void usage ();
+
+static int clear_directory ();
+static int duplicate_entry ();
+static int remove_dir ();
+static int remove_file ();
+static int rm ();
+static void usage ();
/* Path of file now being processed; extended as necessary. */
static char *pathname;
@@ -75,7 +76,7 @@ static int unlink_dirs;
/* If nonzero, stdin is a tty. */
static int stdin_tty;
-static struct option long_opts[] =
+static struct option const long_opts[] =
{
{"directory", 0, &unlink_dirs, 1},
{"force", 0, NULL, 'f'},
@@ -157,7 +158,7 @@ main (argc, argv)
/* Remove file or directory `pathname' after checking appropriate things.
Return 0 if `pathname' is removed, 1 if not. */
-int
+static int
rm ()
{
struct stat path_stats;
@@ -188,7 +189,7 @@ rm ()
non-directory `pathname', which STATP contains info about.
Return 0 if `pathname' is removed, 1 if not. */
-int
+static int
remove_file (statp)
struct stat *statp;
{
@@ -228,7 +229,7 @@ remove_file (statp)
remove directory `pathname', which STATP contains info about.
Return 0 if `pathname' is removed, 1 if not. */
-int
+static int
remove_dir (statp)
struct stat *statp;
{
@@ -305,7 +306,7 @@ static struct pathstack *pathstack = NULL;
but its address might be different; in that case, `pnsize' will
be larger, as well. */
-int
+static int
clear_directory (statp)
struct stat *statp;
{
@@ -447,7 +448,7 @@ clear_directory (statp)
doing so could cause duplication of i-numbers that would not indicate
a corrupted file system. */
-int
+static int
duplicate_entry (stack, inum)
struct pathstack *stack;
ino_t inum;
@@ -484,7 +485,7 @@ is the same file as\n", program_name, pathname);
return 0;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
diff --git a/src/rmdir.c b/src/rmdir.c
index 92ed8b1e9..137efb69c 100644
--- a/src/rmdir.c
+++ b/src/rmdir.c
@@ -27,10 +27,11 @@
#include <sys/types.h>
#include "system.h"
-void remove_parents ();
void error ();
void strip_trailing_slashes ();
-void usage ();
+
+static void remove_parents ();
+static void usage ();
/* If nonzero, remove empty parent directories. */
static int empty_paths;
@@ -38,7 +39,7 @@ static int empty_paths;
/* The name this program was run with. */
char *program_name;
-static struct option longopts[] =
+static struct option const longopts[] =
{
{"path", 0, &empty_paths, 1},
{NULL, 0, NULL, 0}
@@ -92,7 +93,7 @@ main (argc, argv)
/* Remove any empty parent directories of `path'.
Replaces '/' characters in `path' with NULs. */
-void
+static void
remove_parents (path)
char *path;
{
@@ -112,7 +113,7 @@ remove_parents (path)
while (rmdir (path) == 0);
}
-void
+static void
usage ()
{
fprintf (stderr, "Usage: %s [-p] [--path] dir...\n",
diff --git a/src/touch.c b/src/touch.c
index 8c2ee3126..f3848ed80 100644
--- a/src/touch.c
+++ b/src/touch.c
@@ -46,14 +46,15 @@ time_t time ();
#endif
int argmatch ();
-int touch ();
time_t get_date ();
time_t posixtime ();
void error ();
void invalid_arg ();
-void usage ();
+
+static int touch ();
+static void usage ();
#ifndef HAVE_UTIME_NULL
-int utime_now ();
+static int utime_now ();
#endif
/* Bitmasks for `change_times'. */
@@ -92,7 +93,7 @@ static struct stat ref_stats;
/* The name by which this program was run. */
char *program_name;
-static struct option longopts[] =
+static struct option const longopts[] =
{
{"time", 1, 0, 130},
{"no-create", 0, 0, 'c'},
@@ -102,13 +103,13 @@ static struct option longopts[] =
};
/* Valid arguments to the `--time' option. */
-static char *time_args[] =
+static char const* const time_args[] =
{
"atime", "access", "use", "mtime", "modify", 0
};
/* The bits in `change_times' that those arguments set. */
-static int time_masks[] =
+static int const time_masks[] =
{
CH_ATIME, CH_ATIME, CH_ATIME, CH_MTIME, CH_MTIME
};
@@ -231,7 +232,7 @@ main (argc, argv)
/* Update the time of file FILE according to the options given.
Return 0 if successful, 1 if an error occurs. */
-int
+static int
touch (file)
char *file;
{
@@ -323,7 +324,7 @@ touch (file)
make sure empty files are not lengthened to 1 byte.
Return 0 if successful, -1 if not. */
-int
+static int
utime_now (file, filesize)
char *file;
off_t filesize;
@@ -344,7 +345,7 @@ utime_now (file, filesize)
}
#endif
-void
+static void
usage ()
{
fprintf (stderr, "\