1: #if defined(DOSCCS) && !defined(lint)
2: static char *sccsid = "@(#)size.c 4.4.1 (2.11BSD GTE) 1/1/94";
3: #endif
4:
5: /*
6: * size
7: */
8:
9: #include <stdio.h>
10: #include <a.out.h>
11:
12: int ;
13:
14: main(argc, argv)
15: char **argv;
16: {
17: struct exec buf;
18: long sum;
19: int gorp,i;
20: int err = 0;
21: FILE *f;
22: #ifdef pdp11
23: struct ovlhdr ovlbuf; /* overlay structure */
24: long coresize; /* total text size */
25: short skip; /* skip over overlay sizes of 0 */
26: #endif
27:
28: if (argc==1) {
29: *argv = "a.out";
30: argc++;
31: --argv;
32: }
33: gorp = argc;
34: while(--argc) {
35: ++argv;
36: if ((f = fopen(*argv, "r"))==NULL) {
37: printf("size: %s not found\n", *argv);
38: err++;
39: continue;
40: }
41: if (fread((char *)&buf, sizeof(buf), 1, f) != 1 ||
42: N_BADMAG(buf)) {
43: printf("size: %s not an object file\n", *argv);
44: fclose(f);
45: err++;
46: continue;
47: }
48: if (header == 0) {
49: printf("text\tdata\tbss\tdec\thex\n");
50: header = 1;
51: }
52: printf("%u\t%u\t%u\t", buf.a_text,buf.a_data,buf.a_bss);
53: sum = (long) buf.a_text + (long) buf.a_data + (long) buf.a_bss;
54: printf("%ld\t%lx", sum, sum);
55: if (gorp>2)
56: printf("\t%s", *argv);
57: #ifdef pdp11
58: if (buf.a_magic == A_MAGIC5 || buf.a_magic == A_MAGIC6) {
59: fread(&ovlbuf,sizeof(ovlbuf),1,f);
60: coresize = buf.a_text;
61: for (i = 0; i < NOVL; i++)
62: coresize += ovlbuf.ov_siz[i];
63: printf("\ttotal text: %ld\n\toverlays: ", coresize);
64: for (i = 0,skip = 0; i < NOVL; i++) {
65: if (!ovlbuf.ov_siz[i]) {
66: ++skip;
67: continue;
68: }
69: for (;skip;--skip)
70: fputs(",0",stdout);
71: if (i > 0)
72: putchar(',');
73: printf("%u", ovlbuf.ov_siz[i]);
74: }
75: }
76: #endif
77: printf("\n");
78: fclose(f);
79: }
80: exit(err);
81: }
Defined functions
main
defined in line
14;
never used
Defined variables
defined in line
12; used 2 times
sccsid
defined in line
2;
never used