prettyness police
[unix-history] / usr / src / usr.bin / ar / delete.c
index e61eacc..f031f3d 100644 (file)
@@ -1,6 +1,6 @@
 /*-
 /*-
- * Copyright (c) 1990 The Regents of the University of California.
- * All rights reserved.
+ * Copyright (c) 1990, 1993
+ *     The Regents of the University of California.  All rights reserved.
  *
  * 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.
@@ -9,30 +9,29 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)delete.c   5.5 (Berkeley) %G%";
+static char sccsid[] = "@(#)delete.c   8.2 (Berkeley) %G%";
 #endif /* not lint */
 
 #include <sys/param.h>
 #include <sys/stat.h>
 #endif /* not lint */
 
 #include <sys/param.h>
 #include <sys/stat.h>
-#include <fcntl.h>
+
+#include <ar.h>
 #include <dirent.h>
 #include <dirent.h>
-#include <unistd.h>
+#include <fcntl.h>
 #include <stdio.h>
 #include <stdio.h>
-#include <ar.h>
+#include <unistd.h>
+
 #include "archive.h"
 #include "extern.h"
 #include "pathnames.h"
 
 #include "archive.h"
 #include "extern.h"
 #include "pathnames.h"
 
-extern CHDR chdr;                      /* converted header */
-extern char *archive;                  /* archive name */
-extern char *tname;                     /* temporary file "name" */
-
 /*-
  * delete --
  *     Deletes named members from the archive.
  */
 /*-
  * delete --
  *     Deletes named members from the archive.
  */
+int
 delete(argv)
 delete(argv)
-       register char **argv;
+       char **argv;
 {
        CF cf;
        off_t size;
 {
        CF cf;
        off_t size;
@@ -44,28 +43,28 @@ 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);
 
        if (*argv) {
                orphans(argv);
        (void)close(tfd);
        (void)ftruncate(afd, size + SARMAG);
        close_archive(afd);
 
        if (*argv) {
                orphans(argv);
-               return(1);
+               return (1);
        }
        }
-       return(0);
+       return (0);
 }      
 }