From 332c413b75cd708716318cd84e713ad4d7a20f65 Mon Sep 17 00:00:00 2001 From: lukem Date: Sun, 14 Sep 1997 14:54:32 +0000 Subject: [PATCH] * cleanup manpage * getopt returns -1 not EOF * deprecate register --- bin/pax/extern.h | 118 ++++++++++++++++++++++---------------------- bin/pax/getoldopt.c | 6 +-- bin/pax/options.c | 8 +-- bin/pax/pax.1 | 84 +++++++++++++++---------------- 4 files changed, 108 insertions(+), 108 deletions(-) diff --git a/bin/pax/extern.h b/bin/pax/extern.h index 7569f19d0105..1c906755d898 100644 --- a/bin/pax/extern.h +++ b/bin/pax/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.6 1997/07/20 20:32:26 christos Exp $ */ +/* $NetBSD: extern.h,v 1.7 1997/09/14 14:54:32 lukem Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -55,8 +55,8 @@ void ar_close __P((void)); void ar_drain __P((void)); int ar_set_wr __P((void)); int ar_app_ok __P((void)); -int ar_read __P((register char *, register int)); -int ar_write __P((register char *, register int)); +int ar_read __P((char *, int)); +int ar_write __P((char *, int)); int ar_rdsync __P((void)); int ar_fow __P((off_t, off_t *)); int ar_rev __P((off_t )); @@ -90,14 +90,14 @@ int rd_sync __P((void)); void pback __P((char *, int)); int rd_skip __P((off_t)); void wr_fin __P((void)); -int wr_rdbuf __P((register char *, register int)); -int rd_wrbuf __P((register char *, register int)); +int wr_rdbuf __P((char *, int)); +int rd_wrbuf __P((char *, int)); int wr_skip __P((off_t)); int wr_rdfile __P((ARCHD *, int, off_t *)); int rd_wrfile __P((ARCHD *, int, off_t *)); void cp_file __P((ARCHD *, int, int)); int buf_fill __P((void)); -int buf_flush __P((register int)); +int buf_flush __P((int)); /* * cache.c @@ -115,65 +115,65 @@ int gid_name __P((char *, gid_t *)); * cpio.c */ int cpio_strd __P((void)); -int cpio_subtrail __P((register ARCHD *)); +int cpio_subtrail __P((ARCHD *)); int cpio_endwr __P((void)); int cpio_id __P((char *, int)); -int cpio_rd __P((register ARCHD *, register char *)); +int cpio_rd __P((ARCHD *, char *)); off_t cpio_endrd __P((void)); int cpio_stwr __P((void)); -int cpio_wr __P((register ARCHD *)); +int cpio_wr __P((ARCHD *)); int vcpio_id __P((char *, int)); int crc_id __P((char *, int)); int crc_strd __P((void)); -int vcpio_rd __P((register ARCHD *, register char *)); +int vcpio_rd __P((ARCHD *, char *)); off_t vcpio_endrd __P((void)); int crc_stwr __P((void)); -int vcpio_wr __P((register ARCHD *)); +int vcpio_wr __P((ARCHD *)); int bcpio_id __P((char *, int)); -int bcpio_rd __P((register ARCHD *, register char *)); +int bcpio_rd __P((ARCHD *, char *)); off_t bcpio_endrd __P((void)); -int bcpio_wr __P((register ARCHD *)); +int bcpio_wr __P((ARCHD *)); /* * file_subs.c */ -int file_creat __P((register ARCHD *)); -void file_close __P((register ARCHD *, int)); -int lnk_creat __P((register ARCHD *)); -int cross_lnk __P((register ARCHD *)); -int chk_same __P((register ARCHD *)); -int node_creat __P((register ARCHD *)); -int unlnk_exist __P((register char *, register int)); -int chk_path __P((register char *, uid_t, gid_t)); +int file_creat __P((ARCHD *)); +void file_close __P((ARCHD *, int)); +int lnk_creat __P((ARCHD *)); +int cross_lnk __P((ARCHD *)); +int chk_same __P((ARCHD *)); +int node_creat __P((ARCHD *)); +int unlnk_exist __P((char *, int)); +int chk_path __P((char *, uid_t, gid_t)); void set_ftime __P((char *fnm, time_t mtime, time_t atime, int frc)); int set_ids __P((char *, uid_t, gid_t)); void set_pmode __P((char *, mode_t)); -int file_write __P((int, char *, register int, int *, int *, int, char *)); +int file_write __P((int, char *, int, int *, int *, int, char *)); void file_flush __P((int, char *, int)); -void rdfile_close __P((register ARCHD *, register int *)); -int set_crc __P((register ARCHD *, register int)); +void rdfile_close __P((ARCHD *, int *)); +int set_crc __P((ARCHD *, int)); /* * ftree.c */ int ftree_start __P((void)); -int ftree_add __P((register char *)); -void ftree_sel __P((register ARCHD *)); +int ftree_add __P((char *)); +void ftree_sel __P((ARCHD *)); void ftree_chk __P((void)); -int next_file __P((register ARCHD *)); +int next_file __P((ARCHD *)); /* * gen_subs.c */ -void ls_list __P((register ARCHD *, time_t)); -void ls_tty __P((register ARCHD *)); -void zf_strncpy __P((register char *, register char *, int)); -int l_strncpy __P((register char *, register char *, int)); -u_long asc_ul __P((register char *, int, register int)); -int ul_asc __P((u_long, register char *, register int, register int)); +void ls_list __P((ARCHD *, time_t)); +void ls_tty __P((ARCHD *)); +void zf_strncpy __P((char *, char *, int)); +int l_strncpy __P((char *, char *, int)); +u_long asc_ul __P((char *, int, int)); +int ul_asc __P((u_long, char *, int, int)); #ifndef NET2_STAT -u_quad_t asc_uqd __P((register char *, int, register int)); -int uqd_asc __P((u_quad_t, register char *, register int, register int)); +u_quad_t asc_uqd __P((char *, int, int)); +int uqd_asc __P((u_quad_t, char *, int, int)); #endif /* @@ -186,21 +186,21 @@ int getoldopt __P((int, char **, char *)); */ extern FSUB fsub[]; extern int ford[]; -void options __P((register int, register char **)); +void options __P((int, char **)); OPLIST * opt_next __P((void)); -int opt_add __P((register char *)); +int opt_add __P((char *)); int bad_opt __P((void)); /* * pat_rep.c */ -int rep_add __P((register char *)); +int rep_add __P((char *)); int pat_add __P((char *)); void pat_chk __P((void)); -int pat_sel __P((register ARCHD *)); -int pat_match __P((register ARCHD *)); -int mod_name __P((register ARCHD *)); -int set_dest __P((register ARCHD *, char *, int)); +int pat_sel __P((ARCHD *)); +int pat_match __P((ARCHD *)); +int mod_name __P((ARCHD *)); +int set_dest __P((ARCHD *, char *, int)); /* * pax.c @@ -239,26 +239,26 @@ void sig_cleanup __P((int)); /* * sel_subs.c */ -int sel_chk __P((register ARCHD *)); -int grp_add __P((register char *)); -int usr_add __P((register char *)); -int trng_add __P((register char *)); +int sel_chk __P((ARCHD *)); +int grp_add __P((char *)); +int usr_add __P((char *)); +int trng_add __P((char *)); /* * tables.c */ int lnk_start __P((void)); -int chk_lnk __P((register ARCHD *)); -void purg_lnk __P((register ARCHD *)); +int chk_lnk __P((ARCHD *)); +void purg_lnk __P((ARCHD *)); void lnk_end __P((void)); int ftime_start __P((void)); -int chk_ftime __P((register ARCHD *)); +int chk_ftime __P((ARCHD *)); int name_start __P((void)); -int add_name __P((register char *, int, char *)); -void sub_name __P((register char *, int *)); +int add_name __P((char *, int, char *)); +void sub_name __P((char *, int *)); int dev_start __P((void)); -int add_dev __P((register ARCHD *)); -int map_dev __P((register ARCHD *, u_long, u_long)); +int add_dev __P((ARCHD *)); +int map_dev __P((ARCHD *, u_long, u_long)); int atdir_start __P((void)); void atdir_end __P((void)); void add_atdir __P((char *, dev_t, ino_t, time_t, time_t)); @@ -273,16 +273,16 @@ u_int st_hash __P((char *, int, int)); */ int tar_endwr __P((void)); off_t tar_endrd __P((void)); -int tar_trail __P((register char *, register int, register int *)); -int tar_id __P((register char *, int)); +int tar_trail __P((char *, int, int *)); +int tar_id __P((char *, int)); int tar_opt __P((void)); -int tar_rd __P((register ARCHD *, register char *)); -int tar_wr __P((register ARCHD *)); +int tar_rd __P((ARCHD *, char *)); +int tar_wr __P((ARCHD *)); int ustar_strd __P((void)); int ustar_stwr __P((void)); int ustar_id __P((char *, int)); -int ustar_rd __P((register ARCHD *, register char *)); -int ustar_wr __P((register ARCHD *)); +int ustar_rd __P((ARCHD *, char *)); +int ustar_wr __P((ARCHD *)); /* * tty_subs.c diff --git a/bin/pax/getoldopt.c b/bin/pax/getoldopt.c index c8f20d35828e..beb4549d1f66 100644 --- a/bin/pax/getoldopt.c +++ b/bin/pax/getoldopt.c @@ -1,4 +1,4 @@ -/* $NetBSD: getoldopt.c,v 1.5 1997/07/20 20:32:34 christos Exp $ */ +/* $NetBSD: getoldopt.c,v 1.6 1997/09/14 14:54:33 lukem Exp $ */ /* * Plug-compatible replacement for getopt() for parsing tar-like @@ -11,7 +11,7 @@ #include #ifndef lint -__RCSID("$NetBSD: getoldopt.c,v 1.5 1997/07/20 20:32:34 christos Exp $"); +__RCSID("$NetBSD: getoldopt.c,v 1.6 1997/09/14 14:54:33 lukem Exp $"); #endif /* not lint */ #include @@ -37,7 +37,7 @@ getoldopt(argc, argv, optstring) optarg = NULL; if (key == NULL) { /* First time */ - if (argc < 2) return EOF; + if (argc < 2) return -1; key = argv[1]; if (*key == '-') use_getopt++; diff --git a/bin/pax/options.c b/bin/pax/options.c index d7c897717454..c923886bae4b 100644 --- a/bin/pax/options.c +++ b/bin/pax/options.c @@ -1,4 +1,4 @@ -/* $NetBSD: options.c,v 1.8 1997/07/20 20:32:35 christos Exp $ */ +/* $NetBSD: options.c,v 1.9 1997/09/14 14:54:34 lukem Exp $ */ /*- * Copyright (c) 1992 Keith Muller. @@ -42,7 +42,7 @@ #if 0 static char sccsid[] = "@(#)options.c 8.2 (Berkeley) 4/18/94"; #else -__RCSID("$NetBSD: options.c,v 1.8 1997/07/20 20:32:35 christos Exp $"); +__RCSID("$NetBSD: options.c,v 1.9 1997/09/14 14:54:34 lukem Exp $"); #endif #endif /* not lint */ @@ -204,7 +204,7 @@ pax_options(argc, argv) * process option flags */ while ((c=getopt(argc,argv,"ab:cdf:iklno:p:rs:tuvwx:zB:DE:G:HLPT:U:XYZ")) - != EOF) { + != -1) { switch (c) { case 'a': /* @@ -610,7 +610,7 @@ tar_options(argc, argv) * process option flags */ while ((c = getoldopt(argc, argv, "b:cef:moprutvwxzBHLPXZ014578")) - != EOF) { + != -1) { switch(c) { case 'b': /* diff --git a/bin/pax/pax.1 b/bin/pax/pax.1 index ff1bfac95b2b..b52af244126d 100644 --- a/bin/pax/pax.1 +++ b/bin/pax/pax.1 @@ -1,4 +1,4 @@ -.\" $NetBSD: pax.1,v 1.4 1996/12/18 23:37:11 pk Exp $ +.\" $NetBSD: pax.1,v 1.5 1997/09/14 14:54:35 lukem Exp $ .\" .\" Copyright (c) 1992 Keith Muller. .\" Copyright (c) 1992, 1993 @@ -44,7 +44,7 @@ .Nm pax .Nd read and write file archives and copy directory hierarchies .Sh SYNOPSIS -.Nm pax +.Nm .Op Fl cdnv .Bk -words .Op Fl f Ar archive @@ -180,10 +180,10 @@ .Op Ar file ... .Ar directory .Sh DESCRIPTION -.Nm Pax +.Nm will read, write, and list the members of an archive file, and will copy directory hierarchies. -.Nm Pax +.Nm operation is independent of the specific archive format, and supports a wide variety of different archive formats. A list of supported archive formats can be found under the description of the @@ -195,7 +195,7 @@ The presence of the and the .Fl w options specifies which of the following functional modes -.Nm pax +.Nm will operate under: .Em list , read , write , and @@ -203,7 +203,7 @@ and .Bl -tag -width 6n .It .Em List . -.Nm Pax +.Nm will write to .Dv standard output a table of contents of the members of the archive file read from @@ -214,7 +214,7 @@ The table of contents contains one filename per line and is written using single line buffering. .It Fl r .Em Read . -.Nm Pax +.Nm extracts the members of the archive file read from the .Dv standard input , with pathnames matching the specified @@ -229,7 +229,7 @@ the extracted files are discussed in more detail under the option. .It Fl w .Em Write . -.Nm Pax +.Nm writes an archive containing the .Ar file operands to @@ -245,7 +245,7 @@ operand is also a directory, the entire file hierarchy rooted at that directory will be included. .It Fl r Fl w .Em Copy . -.Nm Pax +.Nm copies the .Ar file operands to the destination @@ -285,7 +285,7 @@ While processing a damaged archive during a or .Em list operation, -.Nm pax +.Nm will attempt to recover from media defects and will search through the archive to locate and process the largest number of archive members possible (see the .Fl E @@ -299,7 +299,7 @@ If the .Ar directory operand does not exist, or it is not writable by the user, or it is not of type directory, -.Nm Pax +.Nm will exit with a non-zero exit status. .Pp The @@ -318,7 +318,7 @@ be selected. When a .Ar pattern operand does not select at least one archive member, -.Nm pax +.Nm will write these .Ar pattern operands in a diagnostic message to @@ -331,7 +331,7 @@ operand specifies the pathname of a file to be copied or archived. When a .Ar file operand does not select at least one archive member, -.Nm pax +.Nm will write these .Ar file operand pathnames in a diagnostic message to @@ -358,7 +358,7 @@ and as the mode argument. When the selected archive format supports the specification of linked files and these files cannot be linked while the archive is being extracted, -.Nm pax +.Nm will write a diagnostic message to .Dv standard error and exit with a non-zero exit status at the completion of operation. @@ -382,7 +382,7 @@ If an archive format is not specified with a option, the format currently being used in the archive will be selected. Any attempt to append to an archive in a format different from the format already used in the archive will cause -.Nm pax +.Nm to exit immediately with a non-zero exit status. The blocking size used in the archive volume where writing starts @@ -451,7 +451,7 @@ or .Em write ) . A single archive may span multiple files and different archive devices. When required, -.Nm pax +.Nm will prompt for the pathname of the file or device of the next volume in the archive. .It Fl i @@ -461,18 +461,18 @@ For each archive member matching a operand or each file matching a .Ar file operand, -.Nm pax +.Nm will prompt to .Pa /dev/tty giving the name of the file, its file mode and its modification time. -.Nm Pax +.Nm will then read a line from .Pa /dev/tty . If this line is blank, the file or archive member is skipped. If this line consists of a single period, the file or archive member is processed with no modification to its name. Otherwise, its name is replaced with the contents of the line. -.Nm Pax +.Nm will immediately exit with a non-zero exit status if .Dv is encountered when reading a response or if @@ -570,7 +570,7 @@ nor the .Cm o specification character is specified, or the user ID and group ID are not preserved for any reason, -.Nm pax +.Nm will not set the .Dv S_ISUID .Em ( setuid ) @@ -579,7 +579,7 @@ and .Em ( setgid ) bits of the file mode. If the preservation of any of these items fails for any reason, -.Nm pax +.Nm will write a diagnostic message to .Dv standard error . Failure to preserve these items will affect the final exit status, @@ -637,7 +637,7 @@ File or archive member names that substitute to the empty string are not selected and will be skipped. .It Fl t Reset the access times of any file or directory read or accessed by -.Nm pax +.Nm to be the same as they were before being read or accessed by .Nm pax . .It Fl u @@ -690,7 +690,7 @@ is not buffered, and is written only after the file has been read or written. .It Fl x Ar format Specify the output archive format, with the default format being .Ar ustar . -.Nm Pax +.Nm currently supports the following formats: .Bl -tag -width "sv4cpio" .It Ar cpio @@ -700,7 +700,7 @@ standard. The default blocksize for this format is 5120 bytes. Inode and device information about a file (used for detecting file hard links by this format) which may be truncated by this format is detected by -.Nm pax +.Nm and is repaired. .It Ar bcpio The old binary cpio format. @@ -709,21 +709,21 @@ This format is not very portable and should not be used when other formats are available. Inode and device information about a file (used for detecting file hard links by this format) which may be truncated by this format is detected by -.Nm pax +.Nm and is repaired. .It Ar sv4cpio The System V release 4 cpio. The default blocksize for this format is 5120 bytes. Inode and device information about a file (used for detecting file hard links by this format) which may be truncated by this format is detected by -.Nm pax +.Nm and is repaired. .It Ar sv4crc The System V release 4 cpio with file crc checksums. The default blocksize for this format is 5120 bytes. Inode and device information about a file (used for detecting file hard links by this format) which may be truncated by this format is detected by -.Nm pax +.Nm and is repaired. .It Ar tar The old BSD tar format as found in BSD4.3. @@ -749,7 +749,7 @@ The default blocksize for this format is 10240 bytes. Pathnames stored by this format must be 250 characters or less in length. .El .Pp -.Nm Pax +.Nm will detect and report any file that it is unable to store or extract as the result of any specific archive format restrictions. The individual archive formats may impose additional restrictions on use. @@ -791,20 +791,20 @@ archives to .Ar limit . With a positive .Ar limit , -.Nm pax +.Nm will attempt to recover from an archive read error and will continue processing starting with the next file stored in the archive. A .Ar limit of 0 will cause -.Nm pax +.Nm to stop operation after the first read error is detected on an archive volume. A .Ar limit of .Li NONE will cause -.Nm pax +.Nm to attempt to recover from read errors forever. The default .Ar limit @@ -814,7 +814,7 @@ is a small positive number of retries. Using this option with .Li NONE should be used with extreme caution as -.Nm pax +.Nm may get stuck in an infinite loop on a very badly flawed archive. .It Fl G Ar group Select a file based on its @@ -858,7 +858,7 @@ only files with a modification or inode change time of exactly that time will be selected. .Pp When -.Nm pax +.Nm is in the .Em write or @@ -888,7 +888,7 @@ created and had their modification time reset to an older time (as what happens when a file is extracted from an archive and the modification time is preserved). Time comparisons using both file times is useful when -.Nm pax +.Nm is used to create a time based incremental archive (only files that were changed during a specified time range will be archived). .Pp @@ -1094,7 +1094,7 @@ files with the same name found in the source file tree .Pa home . .Sh STANDARDS The -.Nm pax +.Nm utility is a superset of the .St -p1003.2 standard. @@ -1125,7 +1125,7 @@ standard. .Sh AUTHOR Keith Muller at the University of California, San Diego .Sh ERRORS -.Nm pax +.Nm will exit with one of the following values: .Bl -tag -width 2n .It 0 @@ -1135,7 +1135,7 @@ An error occurred. .El .Pp Whenever -.Nm pax +.Nm cannot create a file or a link when reading an archive or cannot find a file when writing an archive, or cannot preserve the user ID, group ID, or file mode when the @@ -1144,28 +1144,28 @@ option is specified, a diagnostic message is written to .Dv standard error and a non-zero exit status will be returned, but processing will continue. In the case where pax cannot create a link to a file, -.Nm pax +.Nm will not create a second copy of the file. .Pp If the extraction of a file from an archive is prematurely terminated by a signal or error, -.Nm pax +.Nm may have only partially extracted a file the user wanted. Additionally, the file modes of extracted files and directories may have incorrect file bits, and the modification and access times may be wrong. .Pp If the creation of an archive is prematurely terminated by a signal or error, -.Nm pax +.Nm may have only partially created the archive which may violate the specific archive format specification. .Pp If while doing a .Em copy , -.Nm pax +.Nm detects a file is about to overwrite itself, the file is not copied, a diagnostic message is written to .Dv standard error and when -.Nm pax +.Nm completes it will exit with a non-zero exit status.