diff options
Diffstat (limited to 'util-linux/hexdump.c')
-rw-r--r-- | util-linux/hexdump.c | 21 |
1 files changed, 5 insertions, 16 deletions
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index 4d2b059..8ac12f0 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c @@ -14,24 +14,13 @@ /* This is a NOEXEC applet. Be very careful! */ - static void bb_dump_addfile(dumper_t *dumper, char *name) { - char *p; - FILE *fp; - char *buf; - - fp = xfopen(name, "r"); - - while ((buf = xmalloc_fgetline(fp)) != NULL) { - p = skip_whitespace(buf); - - if (*p && (*p != '#')) { - bb_dump_add(dumper, p); - } - free(buf); + parser_t *parser = config_open2(name, xfopen_for_read); + while (config_read(parser, &name, 1, 1, "# \t", 0)) { + bb_dump_add(dumper, name); } - fclose(fp); + config_close(parser); } static const char *const add_strings[] = { @@ -131,7 +120,7 @@ int hexdump_main(int argc, char **argv) do { char *buf; - fp = xfopen(*argv, "r"); + fp = xfopen_for_read(*argv); jump_in: while ((buf = xmalloc_fgetline(fp)) != NULL) { p = buf; |