1: static  char *sccsid = "@(#)size.c	4.4 (Berkeley) 4/22/85";
   2: /*
   3:  * size
   4:  */
   5: 
   6: #include    <stdio.h>
   7: #include    <a.out.h>
   8: 
   9: int header;
  10: 
  11: main(argc, argv)
  12: char **argv;
  13: {
  14:     struct exec buf;
  15:     long sum;
  16:     int gorp,i;
  17:     int err = 0;
  18:     FILE *f;
  19: 
  20:     if (argc==1) {
  21:         *argv = "a.out";
  22:         argc++;
  23:         --argv;
  24:     }
  25:     gorp = argc;
  26:     while(--argc) {
  27:         ++argv;
  28:         if ((f = fopen(*argv, "r"))==NULL) {
  29:             printf("size: %s not found\n", *argv);
  30:             err++;
  31:             continue;
  32:         }
  33:         if (fread((char *)&buf, sizeof(buf), 1, f) != 1 ||
  34:             N_BADMAG(buf)) {
  35:             printf("size: %s not an object file\n", *argv);
  36:             fclose(f);
  37:             err++;
  38:             continue;
  39:         }
  40:         if (header == 0) {
  41:             printf("text\tdata\tbss\tdec\thex\n");
  42:             header = 1;
  43:         }
  44:         printf("%u\t%u\t%u\t", buf.a_text,buf.a_data,buf.a_bss);
  45:         sum = (long) buf.a_text + (long) buf.a_data + (long) buf.a_bss;
  46:         printf("%ld\t%lx", sum, sum);
  47:         if (gorp>2)
  48:             printf("\t%s", *argv);
  49:         printf("\n");
  50:         fclose(f);
  51:     }
  52:     exit(err);
  53: }

Defined functions

main defined in line 11; never used

Defined variables

header defined in line 9; used 2 times
sccsid defined in line 1; never used
Last modified: 1985-04-22
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 1048
Valid CSS Valid XHTML 1.0 Strict