version 1.5, 1997/01/15 23:43:13 |
version 1.6, 1997/01/28 07:12:27 |
|
|
#include <stdio.h> |
#include <stdio.h> |
#include <err.h> |
#include <err.h> |
|
|
|
unsigned long total_text, total_data, total_bss, total_total; |
int ignore_bad_archive_entries = 1; |
int ignore_bad_archive_entries = 1; |
|
int print_totals = 0; |
|
|
int process_file __P((int, char *)); |
int process_file __P((int, char *)); |
int show_archive __P((int, char *, FILE *)); |
int show_archive __P((int, char *, FILE *)); |
|
|
{ |
{ |
int ch, eval; |
int ch, eval; |
|
|
while ((ch = getopt(argc, argv, "w")) != -1) |
while ((ch = getopt(argc, argv, "wt")) != -1) |
switch(ch) { |
switch(ch) { |
case 'w': |
case 'w': |
ignore_bad_archive_entries = 0; |
ignore_bad_archive_entries = 0; |
break; |
break; |
|
case 't': |
|
print_totals = 1; |
|
break; |
case '?': |
case '?': |
default: |
default: |
usage(); |
usage(); |
|
|
} while (*++argv); |
} while (*++argv); |
else |
else |
eval |= process_file(1, "a.out"); |
eval |= process_file(1, "a.out"); |
|
|
|
if (print_totals) |
|
(void)printf("\n%lu\t%lu\t%lu\t%lu\t%lx\tTOTAL\n", |
|
total_text, total_data, total_bss, |
|
total_total, total_total); |
exit(eval); |
exit(eval); |
} |
} |
|
|
|
|
FILE *fp; |
FILE *fp; |
int retval; |
int retval; |
char magic[SARMAG]; |
char magic[SARMAG]; |
|
|
if (!(fp = fopen(fname, "r"))) { |
if (!(fp = fopen(fname, "r"))) { |
warnx("cannot read %s", fname); |
warnx("cannot read %s", fname); |
return(1); |
return(1); |
|
|
head.a_bss, total, total); |
head.a_bss, total, total); |
if (count > 1) |
if (count > 1) |
(void)printf("\t%s", name); |
(void)printf("\t%s", name); |
|
|
|
total_text += head.a_text; |
|
total_data += head.a_data; |
|
total_bss += head.a_bss; |
|
total_total += total; |
|
|
(void)printf("\n"); |
(void)printf("\n"); |
return (0); |
return (0); |
} |
} |