386BSD 0.1 development
[unix-history] / usr / src / usr.bin / ar / archive.c
index 7c5e331..1ba6bb6 100644 (file)
@@ -5,11 +5,37 @@
  * This code is derived from software contributed to Berkeley by
  * Hugh Smith at The University of Guelph.
  *
  * This code is derived from software contributed to Berkeley by
  * Hugh Smith at The University of Guelph.
  *
- * %sccs.include.redist.c%
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ *    must display the following acknowledgement:
+ *     This product includes software developed by the University of
+ *     California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ *    may be used to endorse or promote products derived from this software
+ *    without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)archive.c  5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)archive.c  5.7 (Berkeley) 3/21/91";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -95,10 +121,10 @@ close_archive(fd)
 }
 
 /*
 }
 
 /*
- * get_header --
+ * get_arobj --
  *     read the archive header for this member
  */
  *     read the archive header for this member
  */
-get_header(fd)
+get_arobj(fd)
        int fd;
 {
        struct ar_hdr *hdr;
        int fd;
 {
        struct ar_hdr *hdr;
@@ -162,10 +188,10 @@ get_header(fd)
 static int already_written;
 
 /*
 static int already_written;
 
 /*
- * put_object --
+ * put_arobj --
  *     Write an archive member to a file.
  */
  *     Write an archive member to a file.
  */
-put_object(cfp, sb)
+put_arobj(cfp, sb)
        CF *cfp;
        struct stat *sb;
 {
        CF *cfp;
        struct stat *sb;
 {
@@ -189,7 +215,7 @@ put_object(cfp, sb)
                 * a space, use extended format 1.
                 */
                lname = strlen(name);
                 * a space, use extended format 1.
                 */
                lname = strlen(name);
-               if (options & AR_S) {
+               if (options & AR_TR) {
                        if (lname > OLDARMAXNAME) {
                                (void)fflush(stdout);
                                (void)fprintf(stderr,
                        if (lname > OLDARMAXNAME) {
                                (void)fflush(stdout);
                                (void)fprintf(stderr,
@@ -223,12 +249,12 @@ put_object(cfp, sb)
                        error(cfp->wname);
                already_written = lname;
        }
                        error(cfp->wname);
                already_written = lname;
        }
-       copyfile(cfp, size);
+       copy_ar(cfp, size);
        already_written = 0;
 }
 
 /*
        already_written = 0;
 }
 
 /*
- * copyfile --
+ * copy_ar --
  *     Copy size bytes from one file to another - taking care to handle the
  *     extra byte (for odd size files) when reading archives and writing an
  *     extra byte if necessary when adding files to archive.  The length of
  *     Copy size bytes from one file to another - taking care to handle the
  *     extra byte (for odd size files) when reading archives and writing an
  *     extra byte if necessary when adding files to archive.  The length of
@@ -241,7 +267,7 @@ put_object(cfp, sb)
  *     because 16-bit word addressed copies were faster?)  Anyhow, it should
  *     have been ripped out long ago.
  */
  *     because 16-bit word addressed copies were faster?)  Anyhow, it should
  *     have been ripped out long ago.
  */
-copyfile(cfp, size)
+copy_ar(cfp, size)
        CF *cfp;
        off_t size;
 {
        CF *cfp;
        off_t size;
 {
@@ -279,11 +305,11 @@ copyfile(cfp, size)
 }
 
 /*
 }
 
 /*
- * skipobj -
+ * skip_arobj -
  *     Skip over an object -- taking care to skip the pad bytes.
  */
 void
  *     Skip over an object -- taking care to skip the pad bytes.
  */
 void
-skipobj(fd)
+skip_arobj(fd)
        int fd;
 {
        off_t len;
        int fd;
 {
        off_t len;