|
|
1.1 ! root 1: static char *sccsid = "@(#)size.c 4.3 (Berkeley) 7/2/81"; ! 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: FILE *f; ! 18: ! 19: if (argc==1) { ! 20: *argv = "a.out"; ! 21: argc++; ! 22: --argv; ! 23: } ! 24: gorp = argc; ! 25: while(--argc) { ! 26: ++argv; ! 27: if ((f = fopen(*argv, "r"))==NULL) { ! 28: printf("size: %s not found\n", *argv); ! 29: continue; ! 30: } ! 31: if (fread((char *)&buf, sizeof(buf), 1, f) != 1 || ! 32: N_BADMAG(buf)) { ! 33: printf("size: %s not an object file\n", *argv); ! 34: fclose(f); ! 35: continue; ! 36: } ! 37: if (header == 0) { ! 38: printf("text\tdata\tbss\tdec\thex\n"); ! 39: header = 1; ! 40: } ! 41: printf("%u\t%u\t%u\t", buf.a_text,buf.a_data,buf.a_bss); ! 42: sum = (long) buf.a_text + (long) buf.a_data + (long) buf.a_bss; ! 43: printf("%ld\t%lx", sum, sum); ! 44: if (gorp>2) ! 45: printf("\t%s", *argv); ! 46: printf("\n"); ! 47: fclose(f); ! 48: } ! 49: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.