diff options
author | Warner Losh <imp@FreeBSD.org> | 2002-02-02 06:15:22 +0000 |
---|---|---|
committer | Warner Losh <imp@FreeBSD.org> | 2002-02-02 06:15:22 +0000 |
commit | 5dce647c1b3b206238c72385c0b16f62e508ec30 (patch) | |
tree | 6322786c2b91ab96c1f709f394e8db65851d90b8 /bin/cp | |
parent | 78a3801de3d58c7b3b78f98bf3e3014c10eab0a6 (diff) | |
download | src-5dce647c1b3b206238c72385c0b16f62e508ec30.tar.gz src-5dce647c1b3b206238c72385c0b16f62e508ec30.zip |
Modernization effort for bin/c*:
o __P has been reoved
o Old-style K&R declarations have been converted to new C89 style
o register has been removed
o prototype for main() has been removed (gcc3 makes it an error)
o int main(int argc, char *argv[]) is the preferred main definition.
o Attempt to not break style(9) conformance for declarations more than
they already are.
Approved by: arch@, new style(9)
Notes
Notes:
svn path=/head/; revision=90107
Diffstat (limited to 'bin/cp')
-rw-r--r-- | bin/cp/cp.c | 16 | ||||
-rw-r--r-- | bin/cp/extern.h | 12 | ||||
-rw-r--r-- | bin/cp/utils.c | 22 |
3 files changed, 17 insertions, 33 deletions
diff --git a/bin/cp/cp.c b/bin/cp/cp.c index 19faa2899613..0aede8bd8b69 100644 --- a/bin/cp/cp.c +++ b/bin/cp/cp.c @@ -88,13 +88,11 @@ int Rflag, iflag, pflag, rflag, fflag, vflag; enum op { FILE_TO_FILE, FILE_TO_DIR, DIR_TO_DNE }; -int copy __P((char *[], enum op, int)); -int mastercmp __P((const FTSENT **, const FTSENT **)); +int copy(char *[], enum op, int); +int mastercmp(const FTSENT **, const FTSENT **); int -main(argc, argv) - int argc; - char *argv[]; +main(int argc, char *argv[]) { struct stat to_stat, tmp_stat; enum op type; @@ -238,10 +236,7 @@ main(argc, argv) } int -copy(argv, type, fts_options) - char *argv[]; - enum op type; - int fts_options; +copy(char *argv[], enum op type, int fts_options) { struct stat to_stat; FTS *ftsp; @@ -460,8 +455,7 @@ copy(argv, type, fts_options) * files first reduces seeking. */ int -mastercmp(a, b) - const FTSENT **a, **b; +mastercmp(const FTSENT **a, const FTSENT **b) { int a_info, b_info; diff --git a/bin/cp/extern.h b/bin/cp/extern.h index 4e5f07c8644a..5647b5fa13af 100644 --- a/bin/cp/extern.h +++ b/bin/cp/extern.h @@ -46,10 +46,10 @@ extern int iflag, pflag, fflag, vflag; #include <sys/cdefs.h> __BEGIN_DECLS -int copy_fifo __P((struct stat *, int)); -int copy_file __P((FTSENT *, int)); -int copy_link __P((FTSENT *, int)); -int copy_special __P((struct stat *, int)); -int setfile __P((struct stat *, int)); -void usage __P((void)); +int copy_fifo(struct stat *, int); +int copy_file(FTSENT *, int); +int copy_link(FTSENT *, int); +int copy_special(struct stat *, int); +int setfile(struct stat *, int); +void usage(void); __END_DECLS diff --git a/bin/cp/utils.c b/bin/cp/utils.c index adc04a72770d..d6eb0b11f59e 100644 --- a/bin/cp/utils.c +++ b/bin/cp/utils.c @@ -59,9 +59,7 @@ static const char rcsid[] = #include "extern.h" int -copy_file(entp, dne) - FTSENT *entp; - int dne; +copy_file(FTSENT *entp, int dne) { static char buf[MAXBSIZE]; struct stat *fs; @@ -190,9 +188,7 @@ copy_file(entp, dne) } int -copy_link(p, exists) - FTSENT *p; - int exists; +copy_link(FTSENT *p, int exists) { int len; char link[PATH_MAX]; @@ -214,9 +210,7 @@ copy_link(p, exists) } int -copy_fifo(from_stat, exists) - struct stat *from_stat; - int exists; +copy_fifo(struct stat *from_stat, int exists) { if (exists && unlink(to.p_path)) { warn("unlink: %s", to.p_path); @@ -230,9 +224,7 @@ copy_fifo(from_stat, exists) } int -copy_special(from_stat, exists) - struct stat *from_stat; - int exists; +copy_special(struct stat *from_stat, int exists) { if (exists && unlink(to.p_path)) { warn("unlink: %s", to.p_path); @@ -249,9 +241,7 @@ copy_special(from_stat, exists) (S_ISUID | S_ISGID | S_ISVTX | S_IRWXU | S_IRWXG | S_IRWXO) int -setfile(fs, fd) - register struct stat *fs; - int fd; +setfile(struct stat *fs, int fd) { static struct timeval tv[2]; struct stat ts; @@ -308,7 +298,7 @@ setfile(fs, fd) } void -usage() +usage(void) { (void)fprintf(stderr, "%s\n%s\n", |