X-Git-Url: https://pd.if.org/git/?a=blobdiff_plain;f=elf%2Felftype.c;h=146e892be614d5a88c325b6607ebb27c28156b27;hb=2e690698fef46656959d76b7d69b7162b734a96d;hp=94e68b9306f17bff1bce062c8d2c4a8972d666d5;hpb=6cacaf0ab8b08aef3976a56936f4473039aaa0b7;p=zpackage diff --git a/elf/elftype.c b/elf/elftype.c index 94e68b9..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,11 +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)) { - fprintf(stderr, "checking %s\n", 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); } }