summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKarol Lewandowski <k.lewandowsk@samsung.com>2019-11-20 16:57:08 +0100
committerMateusz Moscicki <m.moscicki2@partner.samsung.com>2019-11-22 17:42:57 +0100
commitef61cdc5ba8a460361ef16455edcb365826e3cf5 (patch)
treea4b192722d830a530f59048be703ac705e49149c
parent3f820f88f067be0e1ddc63e13313361e0f95958e (diff)
downloadcrash-worker-ef61cdc5ba8a460361ef16455edcb365826e3cf5.tar.gz
crash-worker-ef61cdc5ba8a460361ef16455edcb365826e3cf5.tar.bz2
crash-worker-ef61cdc5ba8a460361ef16455edcb365826e3cf5.zip
dump_systemstate: Ensure extra-files and extra-programs are included by default
Needed as regular dump_systemstate functionality has been implemented via .conf files. Change-Id: I32d1c4cb954f6556c5782ff2e56f0f1c9d06acd4
-rw-r--r--src/dump_systemstate/dump_systemstate.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/dump_systemstate/dump_systemstate.c b/src/dump_systemstate/dump_systemstate.c
index 46f11f3..c4e56fe 100644
--- a/src/dump_systemstate/dump_systemstate.c
+++ b/src/dump_systemstate/dump_systemstate.c
@@ -59,16 +59,17 @@ static struct dump_item {
static void usage()
{
- fprintf(stderr, "usage: dump_systemstate [-b] [-k] [-d] [-j] [-p] [-e] [-f file]\n"
+ fprintf(stderr, "usage: dump_systemstate [-b] [-k] [-d] [-j] [-p] [-e] [-E] [-f file]\n"
" -b: dump Buxton data\n"
" -f: write to file (instead of stdout)\n"
" -k: dump kernel messages (only root)\n"
" -d: dump dlog messages\n"
" -j: dump journal log messages\n"
" -p: dump list of installed packages\n"
- " -e: dump extras defined in the config\n"
+ " -e: dump extras defined in the config (default)\n"
" at " DUMP_SYSTEMSTATE_CONFIG_DIR_PROGRAMS_PATH "\n"
" and " DUMP_SYSTEMSTATE_CONFIG_DIR_FILES_PATH "\n"
+ " -E: without extras defined in the config\n"
);
}
@@ -96,15 +97,19 @@ int main(int argc, char *argv[])
bool arg_buxton = false;
bool arg_dlog = false;
bool arg_dmesg = false;
- bool arg_extras = false;
+ bool arg_extras = true;
bool arg_journal = false;
bool arg_pkgs = false;
char timestr[80];
time_t cur_time;
struct tm gm_tm;
struct tm loc_tm;
+ const struct option long_options[] = {
+ { "no-extra", no_argument, NULL, 'E' },
+ { "help", no_argument, NULL, 'h' },
+ };
- while ((c = getopt(argc, argv, "hf:kdbjep")) != -1) {
+ while ((c = getopt_long(argc, argv, "hf:kdbjeEp", long_options, NULL)) != -1) {
switch (c) {
case 'b':
arg_buxton = true;
@@ -115,9 +120,12 @@ int main(int argc, char *argv[])
case 'k':
arg_dmesg = true;
break;
- case 'e':
+ case 'e': // This flag is here for backward compatibility
arg_extras = true;
break;
+ case 'E':
+ arg_extras = false;
+ break;
case 'j':
arg_journal = true;
break;