1: /*
   2:  * Copyright (c) 1983 Regents of the University of California.
   3:  * All rights reserved.  The Berkeley software License Agreement
   4:  * specifies the terms and conditions for redistribution.
   5:  */
   6: 
   7: #if defined(DOSCCS) && !defined(lint)
   8: char copyright[] =
   9: "@(#) Copyright (c) 1983 Regents of the University of California.\n\
  10:  All rights reserved.\n";
  11: 
  12: static char sccsid[] = "@(#)strip.c	5.1.1 (2.11BSD GTE) 1/1/94";
  13: #endif
  14: 
  15: #include <a.out.h>
  16: #include <signal.h>
  17: #include <stdio.h>
  18: #include <sys/file.h>
  19: 
  20: struct  xexec head;
  21: int status;
  22: 
  23: main(argc, argv)
  24:     char *argv[];
  25: {
  26:     register i;
  27: 
  28:     signal(SIGHUP, SIG_IGN);
  29:     signal(SIGINT, SIG_IGN);
  30:     signal(SIGQUIT, SIG_IGN);
  31:     for (i = 1; i < argc; i++) {
  32:         strip(argv[i]);
  33:         if (status > 1)
  34:             break;
  35:     }
  36:     exit(status);
  37: }
  38: 
  39: strip(name)
  40:     char *name;
  41: {
  42:     register f;
  43:     long size;
  44: 
  45:     f = open(name, O_RDWR);
  46:     if (f < 0) {
  47:         fprintf(stderr, "strip: "); perror(name);
  48:         status = 1;
  49:         goto out;
  50:     }
  51:     if (read(f, (char *)&head, sizeof (head)) < 0 || N_BADMAG(head.e)) {
  52:         printf("strip: %s not in a.out format\n", name);
  53:         status = 1;
  54:         goto out;
  55:     }
  56:     if ((head.e.a_syms == 0) && ((head.e.a_flag & 1) != 0))
  57:         goto out;
  58: 
  59:     size = N_DATOFF(head) + head.e.a_data;
  60:     head.e.a_syms = 0;
  61:     head.e.a_flag |= 1;
  62:     if (ftruncate(f, size) < 0) {
  63:         fprintf("strip: "); perror(name);
  64:         status = 1;
  65:         goto out;
  66:     }
  67:     (void) lseek(f, (long)0, L_SET);
  68:     (void) write(f, (char *)&head.e, sizeof (head.e));
  69: out:
  70:     close(f);
  71: }

Defined functions

main defined in line 23; never used
strip defined in line 39; used 1 times
  • in line 32

Defined variables

copyright defined in line 8; never used
head defined in line 20; used 11 times
sccsid defined in line 12; never used
status defined in line 21; used 5 times
Last modified: 1994-01-11
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 3328
Valid CSS Valid XHTML 1.0 Strict