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;
/* 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'},
/* Set *G according to NAME. */
-void
+static void
parse_group (name, g)
char *name;
int *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;
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;
/* 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;
/* Return nonzero if STR represents an unsigned decimal integer,
otherwise return 0. */
-int
+static int
isnumber (str)
char *str;
{
return 1;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
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;
/* 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;
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;
/* 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;
file, mode & 07777, &perms[1]);
}
-void
+static void
usage ()
{
fprintf (stderr, "\
#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;
/* 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'},
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;
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;
/* 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;
printf ("%s\n", username);
}
-void
+static void
usage ()
{
fprintf (stderr, "\
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. */
/* 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'},
/* 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[];
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;
(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;
#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;
/* 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,
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,
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,
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;
/* 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;
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;
/* The main loop. */
-void
+static void
copy ()
{
unsigned char *ibuf, *bufstart; /* Input buffer. */
/* Copy NREAD bytes of BUF, with no conversions. */
-void
+static void
copy_simple (buf, nread)
unsigned char *buf;
int 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;
(replace trailing spaces in `conversion_blocksize'-sized records
with a newline). */
-void
+static void
copy_with_unblock (buf, nread)
unsigned char *buf;
int nread;
/* Write, then empty, the output buffer `obuf'. */
-void
+static void
write_output ()
{
int nwritten = write (output_fd, obuf, output_blocksize);
oc = 0;
}
-void
+static void
scanargs (argc, argv)
int argc;
char **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;
{
/* Interpret one "conv=..." option. */
-void
+static void
parse_conversion (str)
char *str;
{
/* Fix up translation table. */
-void
+static void
apply_translations ()
{
int i;
}
}
-void
+static void
translate_charset (new_trans)
unsigned char *new_trans;
{
/* Return the number of 1 bits in `i'. */
-int
+static int
bit_count (i)
register unsigned int i;
{
return set_bits;
}
-void
+static void
print_stats ()
{
fprintf (stderr, "%u+%u records in\n", r_full, r_partial);
r_truncate == 1 ? "" : "s");
}
-void
+static void
quit (code)
int code;
{
exit (code);
}
-RETSIGTYPE
+static RETSIGTYPE
interrupt_handler ()
{
quit (1);
}
-void
+static void
usage (string, arg0, arg1)
char *string, *arg0, *arg1;
{
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;
/* 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},
exit (exit_status);
}
\f
-void
+static void
print_header ()
{
if (inode_format)
/* 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;
/* 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;
/* Identify the directory, if any, that device
DISK is mounted on, and show its disk usage. */
-void
+static void
show_disk (disk)
char *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;
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;
\f
/* Add FSTYPE to the list of filesystem types to display. */
-void
+static void
add_fs_type (fstype)
char *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;
{
return 0;
}
\f
-void
+static void
usage ()
{
fprintf (stderr, "\
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;
static int exit_status;
-static struct option long_options[] =
+static struct option const long_options[] =
{
{"all", 0, &opt_all, 1},
{"bytes", 0, NULL, 'b'},
{NULL, 0, NULL, 0}
};
-void
+static void
usage (reason)
char *reason;
{
/* 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;
{
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;
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;
/* Reset the hash structure in the global variable `htab' to
contain no entries. */
-void
+static void
hash_reset ()
{
int i;
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;
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;
\f
/* Initialize the struct string S1 for holding SIZE characters. */
-void
+static void
str_init (s1, size)
string *s1;
unsigned size;
/* Assign the null-terminated C-string CSTR to S1. */
-void
+static void
str_copyc (s1, cstr)
string s1;
char *cstr;
s1->length = l;
}
-void
+static void
str_concatc (s1, cstr)
string s1;
char *cstr;
/* Truncate the string S1 to have length LENGTH. */
-void
+static void
str_trunc (s1, length)
string s1;
unsigned length;
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;
/* 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'},
attributes.
Return 0 if successful, 1 if an error occurs. */
-int
+static int
install_file_in_file (from, to)
char *from;
char *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;
/* 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;
/* Set the attributes of file or directory PATH.
Return 0 if successful, 1 if not. */
-int
+static int
change_attributes (path)
char *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;
{
/* Initialize the user and group ownership of the files to install. */
-void
+static void
get_ids ()
{
struct passwd *pw;
/* Return nonzero if STR is an ASCII representation of a nonzero
decimal integer, zero if not. */
-int
+static int
isnumber (str)
char *str;
{
return 1;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
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'. */
/* 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},
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;
return 1;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
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 ();
\f
enum filetype
{
exit (exit_status);
}
\f
-static struct option long_options[] =
+static struct option const long_options[] =
{
{"all", 0, 0, 'a'},
{"escape", 0, 0, 'b'},
{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
};
/* 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;
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;
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;
/* Add `pattern' to the list of patterns for which files that match are
not listed. */
-void
+static void
add_ignore_pattern (pattern)
char *pattern;
{
/* Return nonzero if the file in `next' should be listed. */
-int
+static int
file_interesting (next)
register struct direct *next;
{
/* Empty the table of files. */
-void
+static void
clear_files ()
{
register int i;
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;
/* 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;
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;
`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;
/* 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;
{
\f
/* Sort the files now in the table. */
-void
+static void
sort_files ()
{
int (*func) ();
/* 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;
{
/* 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;
{
return cmp;
}
-int
+static int
rev_cmp_extension (file2, file1)
struct file *file1, *file2;
{
\f
/* List all the files now in the table. */
-void
+static void
print_current_files ()
{
register int i;
}
}
-void
+static void
print_long_format (f)
struct file *f;
{
print_type_indicator (f->stat.st_mode);
}
\f
-void
+static void
print_name_with_quoting (p)
register char *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;
{
print_type_indicator (f->stat.st_mode);
}
-void
+static void
print_type_indicator (mode)
unsigned int mode;
{
putchar ('*');
}
-int
+static int
length_of_file_name_and_frills (f)
struct file *f;
{
return len;
}
\f
-void
+static void
print_many_per_line ()
{
int filesno; /* Index into files. */
}
}
\f
-void
+static void
print_horizontal ()
{
int filesno;
putchar ('\n');
}
\f
-void
+static void
print_with_commas ()
{
int filesno;
\f
/* Assuming cursor is at position FROM, indent up to position TO. */
-void
+static void
indent (from, to)
int from, to;
{
/* Put DIRNAME/NAME into DEST, handling `.' and `/' properly. */
-void
+static void
attach (dest, dirname, name)
char *dest, *dirname, *name;
{
*dest = 0;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
int make_path ();
void error ();
-void usage ();
+
+static void usage ();
/* If nonzero, ensure that a path exists. */
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},
exit (errors);
}
-void
+static void
usage ()
{
fprintf (stderr, "\
#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}
}
#ifdef S_ISFIFO
-void
+static void
usage ()
{
fprintf (stderr, "\
#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}
exit (0);
}
-void
+static void
usage ()
{
fprintf (stderr, "\
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;
/* 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'},
/* 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;
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;
/* 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;
{
return 0;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
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;
/* 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'},
/* 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;
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;
{
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;
{
but its address might be different; in that case, `pnsize' will
be larger, as well. */
-int
+static int
clear_directory (statp)
struct stat *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;
return 0;
}
-void
+static void
usage ()
{
fprintf (stderr, "\
#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;
/* 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}
/* Remove any empty parent directories of `path'.
Replaces '/' characters in `path' with NULs. */
-void
+static void
remove_parents (path)
char *path;
{
while (rmdir (path) == 0);
}
-void
+static void
usage ()
{
fprintf (stderr, "Usage: %s [-p] [--path] dir...\n",
#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'. */
/* 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'},
};
/* 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
};
/* 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;
{
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;
}
#endif
-void
+static void
usage ()
{
fprintf (stderr, "\