X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=elf%2Felftype.c;h=146e892be614d5a88c325b6607ebb27c28156b27;hb=34b87ea8d597c1858dab26fa32b25b617d5f5f26;hp=79c7d0016e20cd6b2a8ba575d14bda163c822250;hpb=ac6eb2a7774e22a9679a5bb9b277b8f706519cc5;p=zpackage diff --git a/elf/elftype.c b/elf/elftype.c index 79c7d00..146e892 100644 --- a/elf/elftype.c +++ b/elf/elftype.c @@ -48,7 +48,6 @@ int main(int ac, char **av) { case '0': zeroterm = 1; break; case 'f': if (optarg[0] == '-' && optarg[1] == 0) { - fprintf(stderr, "opening stdin\n"); list = stdin; } else { list = fopen(optarg, "r"); @@ -63,10 +62,25 @@ int main(int ac, char **av) { if (!want) want = (RELOCATABLE|EXECUTABLE|DYNAMIC|CORE); if (list) { + int type; quiet = 2; perr = 0; while (readline(list, fn)) { - if (checkfile(fn, want,perr,quiet)) { + if ((type = checkfile(fn, want,perr,quiet)) & want) { + if (printtype) { + switch (type) { + case RELOCATABLE: + printf("relocatable "); break; + case EXECUTABLE: + printf("executable "); break; + case DYNAMIC: + printf("dynamic "); break; + case CORE: + printf("core "); break; + default: + printf("notelf "); break; + } + } printf("%s\n", fn); } }