diff options
author | Robert de Bath <rdebath@poboxes.com> | 2002-07-22 23:35:31 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2013-10-23 23:48:47 +0200 |
commit | 673f690a37f6673a3262e933709c79de8a66f48c (patch) | |
tree | 3acd007863bf23ce8549f9edb5e51d23a3bc6078 /tests/size.c | |
parent | 352e3b3230dfc6746be6d53325ffe1e33efc5289 (diff) | |
download | dev86-673f690a37f6673a3262e933709c79de8a66f48c.tar.gz |
Import Dev86src-0.16.4.tar.gzv0.16.4
Diffstat (limited to 'tests/size.c')
-rw-r--r-- | tests/size.c | 83 |
1 files changed, 0 insertions, 83 deletions
diff --git a/tests/size.c b/tests/size.c deleted file mode 100644 index 6b08f46..0000000 --- a/tests/size.c +++ /dev/null @@ -1,83 +0,0 @@ -#include <fcntl.h> -#include <a.out.h> - -int verbose = 0; - -void size(filename) - char *filename; -{ - int f; - struct exec ex; - long total; - int cc; - - if ((f = open(filename, O_RDONLY)) < 0 ) - { - perror(filename); - return; - } - cc = read(f, &ex, sizeof(ex)); - - if (cc == sizeof(ex) && !BADMAG(ex)) - { - total = ex.a_text + ex.a_data + ex.a_bss; - if( verbose ) - { - printf("Text segment of %s = %5ld (0x%lx)\n", - filename, ex.a_text, ex.a_text); - printf("Init data of %s = %5ld (0x%lx)\n", - filename, ex.a_data, ex.a_data); - printf("Uninit data of %s = %5ld (0x%lx)\n", - filename, ex.a_bss, ex.a_bss); - printf("Data segment of %s = %5ld (0x%lx)\n", - filename, ex.a_total, ex.a_total); - printf("Minimum size of %s = %5ld (0x%lx)\n", - filename, total, total); - - total = ex.a_total; - if( ex.a_flags & A_SEP ) - total += ex.a_text; - printf("Maximum size of %s = %5ld (0x%lx)\n", - filename, total, total); - } - else - printf("%-ld\t%-ld\t%-ld\t%-ld\t%-lx\t%s\n", - ex.a_text, ex.a_data, ex.a_bss, total, total, - filename); - } - else if( cc > 16 && memcmp(&ex, "\243\206\001\000*", 5) == 0 ) - { /* *.o file */ - total = ((unsigned char*)&ex)[9] + - ((unsigned char*)&ex)[10] * 256; - if( verbose ) - printf("Size of object %s = %5ld (0x%lx)\n", - filename, total, total); - else - printf("\t\t\t%-ld\t%-lx\t%s\n", - total, total, filename); - } - else - printf("%s: Not an a.out file\n", filename); - close(f); -} - -int main(argc, argv) - int argc; - char **argv; -{ - if (argc > 1 && strcmp(argv[1], "-v") == 0 ) - { - verbose++; - argc--, argv++; - } - if (argc < 2) - { - printf("Usage: %s [-v] file\n", argv[0]); - exit(1); - } - if(!verbose) - printf("text\tdata\tbss\tdec\thex\tfilename\n"); - for (--argc, ++argv; argc > 0; --argc, ++argv) - size(*argv); - exit(0); -} |