From e6933c72f5a3ada5dd955bf388f129971727e345 Mon Sep 17 00:00:00 2001 From: Nathan Wagner Date: Mon, 30 Mar 2015 19:09:52 +0000 Subject: [PATCH] use type flag for file input --- elf/elftype.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/elf/elftype.c b/elf/elftype.c index 7d3365d..146e892 100644 --- a/elf/elftype.c +++ b/elf/elftype.c @@ -62,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); } } -- 2.40.0