summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFrank Ch. Eigler <fche@redhat.com>2020-02-07 09:12:00 -0500
committerFrank Ch. Eigler <fche@redhat.com>2020-02-07 09:12:00 -0500
commitf6222a95cf584c26530d4de5204bce7105de0f2b (patch)
treee6b272be08758c7cbb00fd54b733460ff31659b5
parent8cfb206474966bbe957db65af2ed467492f63332 (diff)
downloadelfutils-f6222a95cf584c26530d4de5204bce7105de0f2b.tar.gz
debuginfod: support optional CMD for -Z option
-rw-r--r--debuginfod/debuginfod.cxx6
-rw-r--r--doc/debuginfod.816
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"