BSD 4 release
[unix-history] / usr / src / cmd / strip.c
index b74747c..c9a0698 100644 (file)
@@ -1,3 +1,4 @@
+static char *sccsid = "@(#)strip.c     4.1 (Berkeley) 10/1/80";
 #include <a.out.h>
 #include <signal.h>
 #include <pagsiz.h>
 #include <a.out.h>
 #include <signal.h>
 #include <pagsiz.h>
@@ -7,7 +8,6 @@
 char   *tname;
 char   *mktemp();
 struct exec head;
 char   *tname;
 char   *mktemp();
 struct exec head;
-int    a_magic[] = {A_MAGIC1, A_MAGIC2, A_MAGIC3, A_MAGIC4, 0412, 0413, 0};
 int    status;
 int    tf;
 
 int    status;
 int    tf;
 
@@ -50,9 +50,7 @@ char *name;
                goto out;
        }
        read(f, (char *)&head, sizeof(head));
                goto out;
        }
        read(f, (char *)&head, sizeof(head));
-       for(i=0;a_magic[i];i++)
-               if(a_magic[i] == head.a_magic) break;
-       if(a_magic[i] == 0) {
+       if (N_BADMAG(head)) {
                printf("%s not in a.out format\n", name);
                status = 1;
                goto out;
                printf("%s not in a.out format\n", name);
                status = 1;
                goto out;
@@ -63,13 +61,11 @@ char *name;
        }
        size = (long)head.a_text + head.a_data;
        head.a_syms = head.a_trsize = head.a_drsize = 0 ;
        }
        size = (long)head.a_text + head.a_data;
        head.a_syms = head.a_trsize = head.a_drsize = 0 ;
-
        lseek(tf, (long)0, 0);
        write(tf, (char *)&head, sizeof(head));
        lseek(tf, (long)0, 0);
        write(tf, (char *)&head, sizeof(head));
-       if (head.a_magic == 0412 || head.a_magic == 0413) {
+       if (head.a_magic == ZMAGIC)
                size += PAGSIZ - sizeof (head);
                size += PAGSIZ - sizeof (head);
-       }
-       if(copy(name, f, tf, size)) {
+       if (copy(name, f, tf, size)) {
                status = 1;
                goto out;
        }
                status = 1;
                goto out;
        }