From f6222a95cf584c26530d4de5204bce7105de0f2b Mon Sep 17 00:00:00 2001 From: "Frank Ch. Eigler" Date: Fri, 7 Feb 2020 09:12:00 -0500 Subject: debuginfod: support optional CMD for -Z option --- debuginfod/debuginfod.cxx | 6 ++++-- doc/debuginfod.8 | 16 ++++++++-------- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 0de6bbae..6d729023 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -432,10 +432,12 @@ parse_opt (int key, char *arg, case 'Z': { char* extension = strchr(arg, '='); - if (extension) + if (arg[0] == '\0') + argp_failure(state, 1, EINVAL, "missing EXT"); + else if (extension) scan_archives[string(arg, (extension-arg))]=string(extension+1); else - argp_failure(state, 1, EINVAL, "bad EXT=CMD format"); + scan_archives[string(arg)]=string("cat"); } break; case 'L': diff --git a/doc/debuginfod.8 b/doc/debuginfod.8 index 789184fa..ca844aed 100644 --- a/doc/debuginfod.8 +++ b/doc/debuginfod.8 @@ -86,15 +86,15 @@ debuginfod servers. Activate ELF/DWARF file scanning. The default is off. .TP -.B "\-Z EXT=CMD" +.B "\-Z EXT" "\-Z EXT=CMD" Activate an additional pattern in archive scanning. Files with name -extension EXT (include the dot) will be processed with CMD. CMD is -invoked with the file name added to its argument list. CMD should -produce the archive on its standard output. Since debuginfod -internally uses \fBlibarchive\fP to process CMD's result, it can -accept a wide range of archive formats and compression modes. -Therefore, making CMD simply \fBcat\fP may very well work, try it! -The default is no additional patterns. This option may be repeated. +extension EXT (include the dot) will be processed. If CMD is given, +it is invoked with the file name added to its argument list, and +should produce a common archive on its standard output. Otherwise, +the file is read as if CMD were "cat". Since debuginfod internally +uses \fBlibarchive\fP to read archive files, it can accept a wide +range of archive formats and compression modes. The default is no +additional patterns. This option may be repeated. .TP .B "\-R" -- cgit v1.2.1