X-Git-Url: https://git.subgeniuskitty.com/unix-history/.git/blobdiff_plain/2b84abb596f52ab2068d52108adc96838ad4340a..31cef89cb428866f787983e68246030321893df4:/usr/src/cmd/strip.c diff --git a/usr/src/cmd/strip.c b/usr/src/cmd/strip.c index b74747c7bf..c9a06986e9 100644 --- a/usr/src/cmd/strip.c +++ b/usr/src/cmd/strip.c @@ -1,3 +1,4 @@ +static char *sccsid = "@(#)strip.c 4.1 (Berkeley) 10/1/80"; #include #include #include @@ -7,7 +8,6 @@ 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; @@ -50,9 +50,7 @@ char *name; 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; @@ -63,13 +61,11 @@ char *name; } 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)); - if (head.a_magic == 0412 || head.a_magic == 0413) { + if (head.a_magic == ZMAGIC) size += PAGSIZ - sizeof (head); - } - if(copy(name, f, tf, size)) { + if (copy(name, f, tf, size)) { status = 1; goto out; }