make archive routine naming consistent
authorKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Wed, 13 Mar 1991 01:07:45 +0000 (17:07 -0800)
committerKeith Bostic <bostic@ucbvax.Berkeley.EDU>
Wed, 13 Mar 1991 01:07:45 +0000 (17:07 -0800)
SCCS-vsn: usr.bin/ar/append.c 5.5
SCCS-vsn: usr.bin/ar/archive.c 5.6
SCCS-vsn: usr.bin/ar/archive.h 5.6
SCCS-vsn: usr.bin/ar/contents.c 5.6
SCCS-vsn: usr.bin/ar/delete.c 5.6
SCCS-vsn: usr.bin/ar/extract.c 5.5
SCCS-vsn: usr.bin/ar/move.c 5.6
SCCS-vsn: usr.bin/ar/print.c 5.6
SCCS-vsn: usr.bin/ar/replace.c 5.7

usr/src/usr.bin/ar/append.c
usr/src/usr.bin/ar/archive.c
usr/src/usr.bin/ar/archive.h
usr/src/usr.bin/ar/contents.c
usr/src/usr.bin/ar/delete.c
usr/src/usr.bin/ar/extract.c
usr/src/usr.bin/ar/move.c
usr/src/usr.bin/ar/print.c
usr/src/usr.bin/ar/replace.c

index 86e396e..29f3942 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)append.c   5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)append.c   5.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -56,7 +56,7 @@ append(argv)
                        (void)printf("q - %s\n", file);
                cf.rfd = fd;
                cf.rname = file;
                        (void)printf("q - %s\n", file);
                cf.rfd = fd;
                cf.rname = file;
-               put_object(&cf, &sb);
+               put_arobj(&cf, &sb);
                (void)close(fd);
        }
        close_archive(afd);
                (void)close(fd);
        }
        close_archive(afd);
index 7c5e331..6a27d51 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)archive.c  5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)archive.c  5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -95,10 +95,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 +162,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;
 {
@@ -223,12 +223,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 +241,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 +279,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;
index 6e11a3d..d413432 100644 (file)
@@ -5,7 +5,7 @@
  * 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.
  *
- *     @(#)archive.h   5.5 (Berkeley) %G%
+ *     @(#)archive.h   5.6 (Berkeley) %G%
  */
 
 /* Ar(1) options. */
  */
 
 /* Ar(1) options. */
@@ -69,11 +69,11 @@ typedef struct {
 
 __BEGIN_DECLS
 void   close_archive __P((int));
 
 __BEGIN_DECLS
 void   close_archive __P((int));
-void   skipobj __P((int));
-int    copyfile __P((CF *, off_t));
-int    get_header __P((int));
+void   skip_arobj __P((int));
+int    copy_ar __P((CF *, off_t));
+int    get_arobj __P((int));
 int    open_archive __P((int));
 struct stat;
 int    open_archive __P((int));
 struct stat;
-int    put_object __P((CF *, struct stat *));
+int    put_arobj __P((CF *, struct stat *));
 __END_DECLS
 
 __END_DECLS
 
index 5945fdf..cd5519b 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)contents.c 5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)contents.c 5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -42,7 +42,7 @@ contents(argv)
        
        afd = open_archive(O_RDONLY);
 
        
        afd = open_archive(O_RDONLY);
 
-       for (all = !*argv; get_header(afd);) {
+       for (all = !*argv; get_arobj(afd);) {
                if (all)
                        file = chdr.name;
                else if (!(file = files(argv)))
                if (all)
                        file = chdr.name;
                else if (!(file = files(argv)))
@@ -58,7 +58,7 @@ contents(argv)
                        (void)printf("%s\n", file);
                if (!all && !*argv)
                        break;
                        (void)printf("%s\n", file);
                if (!all && !*argv)
                        break;
-next:          skipobj(afd);
+next:          skip_arobj(afd);
        } 
        close_archive(afd);
 
        } 
        close_archive(afd);
 
index e61eacc..264fe55 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)delete.c   5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)delete.c   5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -44,21 +44,21 @@ delete(argv)
 
        /* Read and write to an archive; pad on both. */
        SETCF(afd, archive, tfd, tname, RPAD|WPAD);
 
        /* Read and write to an archive; pad on both. */
        SETCF(afd, archive, tfd, tname, RPAD|WPAD);
-       while (get_header(afd)) {
+       while (get_arobj(afd)) {
                if (*argv && (file = files(argv))) {
                        if (options & AR_V)
                                (void)printf("d - %s\n", file);
                if (*argv && (file = files(argv))) {
                        if (options & AR_V)
                                (void)printf("d - %s\n", file);
-                       skipobj(afd);
+                       skip_arobj(afd);
                        continue;
                }
                        continue;
                }
-               put_object(&cf, (struct stat *)NULL);
+               put_arobj(&cf, (struct stat *)NULL);
        }
 
        size = lseek(tfd, (off_t)0, SEEK_CUR);
        (void)lseek(tfd, (off_t)0, SEEK_SET);
        (void)lseek(afd, (off_t)SARMAG, SEEK_SET);
        SETCF(tfd, tname, afd, archive, NOPAD);
        }
 
        size = lseek(tfd, (off_t)0, SEEK_CUR);
        (void)lseek(tfd, (off_t)0, SEEK_SET);
        (void)lseek(afd, (off_t)SARMAG, SEEK_SET);
        SETCF(tfd, tname, afd, archive, NOPAD);
-       copyfile(&cf, size);
+       copy_ar(&cf, size);
        (void)close(tfd);
        (void)ftruncate(afd, size + SARMAG);
        close_archive(afd);
        (void)close(tfd);
        (void)ftruncate(afd, size + SARMAG);
        close_archive(afd);
index 8219fee..af44657 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)extract.c  5.4 (Berkeley) %G%";
+static char sccsid[] = "@(#)extract.c  5.5 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -52,11 +52,11 @@ extract(argv)
 
        /* Read from an archive, write to disk; pad on read. */
        SETCF(afd, archive, 0, 0, RPAD);
 
        /* Read from an archive, write to disk; pad on read. */
        SETCF(afd, archive, 0, 0, RPAD);
-       for (all = !*argv; get_header(afd);) {
+       for (all = !*argv; get_arobj(afd);) {
                if (all)
                        file = chdr.name;
                else if (!(file = files(argv))) {
                if (all)
                        file = chdr.name;
                else if (!(file = files(argv))) {
-                       skipobj(afd);
+                       skip_arobj(afd);
                        continue;
                }
 
                        continue;
                }
 
@@ -67,7 +67,7 @@ extract(argv)
                if ((tfd = open(file, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR)) < 0) {
                        (void)fprintf(stderr, "ar: %s: %s.\n",
                            file, strerror(errno));
                if ((tfd = open(file, O_WRONLY|O_CREAT|O_TRUNC, S_IWUSR)) < 0) {
                        (void)fprintf(stderr, "ar: %s: %s.\n",
                            file, strerror(errno));
-                       skipobj(afd);
+                       skip_arobj(afd);
                        eval = 1;
                        continue;
                }
                        eval = 1;
                        continue;
                }
@@ -77,7 +77,7 @@ extract(argv)
 
                cf.wfd = tfd;
                cf.wname = file;
 
                cf.wfd = tfd;
                cf.wname = file;
-               copyfile(&cf, chdr.size);
+               copy_ar(&cf, chdr.size);
 
                if (fchmod(tfd, (short)chdr.mode)) {
                        (void)fprintf(stderr, "ar: %s: chmod: %s\n",
 
                if (fchmod(tfd, (short)chdr.mode)) {
                        (void)fprintf(stderr, "ar: %s: chmod: %s\n",
index 60ec054..5b9e578 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)move.c     5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)move.c     5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -60,12 +60,12 @@ move(argv)
 
        /* Read and write to an archive; pad on both. */
        SETCF(afd, archive, 0, tname, RPAD|WPAD);
 
        /* Read and write to an archive; pad on both. */
        SETCF(afd, archive, 0, tname, RPAD|WPAD);
-       for (curfd = tfd1; get_header(afd);) {  
+       for (curfd = tfd1; get_arobj(afd);) {   
                if (*argv && (file = files(argv))) {
                        if (options & AR_V)
                                (void)printf("m - %s\n", file);
                        cf.wfd = tfd2;
                if (*argv && (file = files(argv))) {
                        if (options & AR_V)
                                (void)printf("m - %s\n", file);
                        cf.wfd = tfd2;
-                       put_object(&cf, (struct stat *)NULL);
+                       put_arobj(&cf, (struct stat *)NULL);
                        continue;
                }
                if (mods && compare(posname)) {
                        continue;
                }
                if (mods && compare(posname)) {
@@ -73,12 +73,12 @@ move(argv)
                        if (options & AR_B)
                                curfd = tfd3;
                        cf.wfd = curfd;
                        if (options & AR_B)
                                curfd = tfd3;
                        cf.wfd = curfd;
-                       put_object(&cf, (struct stat *)NULL);
+                       put_arobj(&cf, (struct stat *)NULL);
                        if (options & AR_A)
                                curfd = tfd3;
                } else {
                        cf.wfd = curfd;
                        if (options & AR_A)
                                curfd = tfd3;
                } else {
                        cf.wfd = curfd;
-                       put_object(&cf, (struct stat *)NULL);
+                       put_arobj(&cf, (struct stat *)NULL);
                }
        }
 
                }
        }
 
@@ -93,17 +93,17 @@ move(argv)
        SETCF(tfd1, tname, afd, archive, NOPAD);
        tsize = size = lseek(tfd1, (off_t)0, SEEK_CUR);
        (void)lseek(tfd1, (off_t)0, SEEK_SET);
        SETCF(tfd1, tname, afd, archive, NOPAD);
        tsize = size = lseek(tfd1, (off_t)0, SEEK_CUR);
        (void)lseek(tfd1, (off_t)0, SEEK_SET);
-       copyfile(&cf, size);
+       copy_ar(&cf, size);
 
        tsize += size = lseek(tfd2, (off_t)0, SEEK_CUR);
        (void)lseek(tfd2, (off_t)0, SEEK_SET);
        cf.rfd = tfd2;
 
        tsize += size = lseek(tfd2, (off_t)0, SEEK_CUR);
        (void)lseek(tfd2, (off_t)0, SEEK_SET);
        cf.rfd = tfd2;
-       copyfile(&cf, size);
+       copy_ar(&cf, size);
 
        tsize += size = lseek(tfd3, (off_t)0, SEEK_CUR);
        (void)lseek(tfd3, (off_t)0, SEEK_SET);
        cf.rfd = tfd3;
 
        tsize += size = lseek(tfd3, (off_t)0, SEEK_CUR);
        (void)lseek(tfd3, (off_t)0, SEEK_SET);
        cf.rfd = tfd3;
-       copyfile(&cf, size);
+       copy_ar(&cf, size);
 
        (void)ftruncate(afd, tsize + SARMAG);
        close_archive(afd);
 
        (void)ftruncate(afd, tsize + SARMAG);
        close_archive(afd);
index 4358758..178ba55 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)print.c    5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)print.c    5.6 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -39,18 +39,18 @@ print(argv)
 
        /* Read from an archive, write to stdout; pad on read. */
        SETCF(afd, archive, STDOUT_FILENO, "stdout", RPAD);
 
        /* Read from an archive, write to stdout; pad on read. */
        SETCF(afd, archive, STDOUT_FILENO, "stdout", RPAD);
-       for (all = !*argv; get_header(afd);) {
+       for (all = !*argv; get_arobj(afd);) {
                if (all)
                        file = chdr.name;
                else if (!(file = files(argv))) {
                if (all)
                        file = chdr.name;
                else if (!(file = files(argv))) {
-                       skipobj(afd);
+                       skip_arobj(afd);
                        continue;
                }
                if (options & AR_V) {
                        (void)printf("\n<%s>\n\n", file);
                        (void)fflush(stdout);
                }
                        continue;
                }
                if (options & AR_V) {
                        (void)printf("\n<%s>\n\n", file);
                        (void)fflush(stdout);
                }
-               copyfile(&cf, chdr.size);
+               copy_ar(&cf, chdr.size);
                if (!all && !*argv)
                        break;
        }
                if (!all && !*argv)
                        break;
        }
index 09b17ec..97a3efa 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)replace.c  5.6 (Berkeley) %G%";
+static char sccsid[] = "@(#)replace.c  5.7 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #endif /* not lint */
 
 #include <sys/param.h>
@@ -71,7 +71,7 @@ replace(argv)
         * all back together at the end.
         */
        mods = (options & (AR_A|AR_B));
         * all back together at the end.
         */
        mods = (options & (AR_A|AR_B));
-       for (err = 0, curfd = tfd1; get_header(afd);) {
+       for (err = 0, curfd = tfd1; get_arobj(afd);) {
                if (*argv && (file = files(argv))) {
                        if ((sfd = open(file, O_RDONLY)) < 0) {
                                err = 1;
                if (*argv && (file = files(argv))) {
                        if ((sfd = open(file, O_RDONLY)) < 0) {
                                err = 1;
@@ -88,9 +88,9 @@ replace(argv)
 
                        /* Read from disk, write to an archive; pad on write */
                        SETCF(sfd, file, curfd, tname, WPAD);
 
                        /* Read from disk, write to an archive; pad on write */
                        SETCF(sfd, file, curfd, tname, WPAD);
-                       put_object(&cf, &sb);
+                       put_arobj(&cf, &sb);
                        (void)close(sfd);
                        (void)close(sfd);
-                       skipobj(afd);
+                       skip_arobj(afd);
                        continue;
                }
 
                        continue;
                }
 
@@ -100,13 +100,13 @@ replace(argv)
                                curfd = tfd2;
                        /* Read and write to an archive; pad on both. */
                        SETCF(afd, archive, curfd, tname, RPAD|WPAD);
                                curfd = tfd2;
                        /* Read and write to an archive; pad on both. */
                        SETCF(afd, archive, curfd, tname, RPAD|WPAD);
-                       put_object(&cf, (struct stat *)NULL);
+                       put_arobj(&cf, (struct stat *)NULL);
                        if (options & AR_A)
                                curfd = tfd2;
                } else {
                        /* Read and write to an archive; pad on both. */
 useold:                        SETCF(afd, archive, curfd, tname, RPAD|WPAD);
                        if (options & AR_A)
                                curfd = tfd2;
                } else {
                        /* Read and write to an archive; pad on both. */
 useold:                        SETCF(afd, archive, curfd, tname, RPAD|WPAD);
-                       put_object(&cf, (struct stat *)NULL);
+                       put_arobj(&cf, (struct stat *)NULL);
                }
        }
 
                }
        }
 
@@ -131,7 +131,7 @@ append:     while (file = *argv++) {
                /* Read from disk, write to an archive; pad on write. */
                SETCF(sfd, file,
                    options & (AR_A|AR_B) ? tfd1 : tfd2, tname, WPAD);
                /* Read from disk, write to an archive; pad on write. */
                SETCF(sfd, file,
                    options & (AR_A|AR_B) ? tfd1 : tfd2, tname, WPAD);
-               put_object(&cf, &sb);
+               put_arobj(&cf, &sb);
                (void)close(sfd);
        }
        
                (void)close(sfd);
        }
        
@@ -141,14 +141,14 @@ append:   while (file = *argv++) {
        if (tfd1 != -1) {
                tsize = size = lseek(tfd1, (off_t)0, SEEK_CUR);
                (void)lseek(tfd1, (off_t)0, SEEK_SET);
        if (tfd1 != -1) {
                tsize = size = lseek(tfd1, (off_t)0, SEEK_CUR);
                (void)lseek(tfd1, (off_t)0, SEEK_SET);
-               copyfile(&cf, size);
+               copy_ar(&cf, size);
        } else
                tsize = 0;
 
        tsize += size = lseek(tfd2, (off_t)0, SEEK_CUR);
        (void)lseek(tfd2, (off_t)0, SEEK_SET);
        cf.rfd = tfd2;
        } else
                tsize = 0;
 
        tsize += size = lseek(tfd2, (off_t)0, SEEK_CUR);
        (void)lseek(tfd2, (off_t)0, SEEK_SET);
        cf.rfd = tfd2;
-       copyfile(&cf, size);
+       copy_ar(&cf, size);
 
        (void)ftruncate(afd, tsize + SARMAG);
        close_archive(afd);
 
        (void)ftruncate(afd, tsize + SARMAG);
        close_archive(afd);