* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
-#define _GNU_SOURCE
#include <getopt.h>
#include <signal.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/wait.h>
#include <unistd.h>
-#include <config.h>
#include <ctype.h>
#include <dirent.h>
#include <byteswap.h>
/* Variables */
static char *progname,
- *opt_viewer_path = DEFAULT_VIEWER,
- *opt_output_path;
+ *opt_viewer_path = NULL,
+ *opt_output_path = NULL;
static char *input_path;
exit(EXIT_FAILURE);
}
- while ((opt = getopt_long(argc, argv, "+Vhvex:", long_options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, argv, "+Vhve:x:", long_options, NULL)) != -1) {
switch (opt) {
case 'V':
version(stdout);
}
break;
case 'e':
+ free(opt_viewer_path);
opt_viewer_path = strdup(optarg);
break;
case 'x':
+ free(opt_output_path);
opt_output_path = strdup(optarg);
break;
case OPT_DUMP_OPTIONS:
}
}
+ if (!opt_viewer_path) {
+ opt_viewer_path = DEFAULT_VIEWER;
+ }
+
/* No leftovers, or more than one input path, print usage and quit */
if ((argc - optind) == 0 || (argc - optind) > 1) {
usage(stderr);
return -EINVAL;
}
- DBG("Copy crash subbuffer at offset %lu", offset);
+ DBG("Copy crash subbuffer at offset %" PRIu64, offset);
sbidx = subbuf_index(offset, buf_size, subbuf_size);
/*
break;
}
case DT_REG:
+ case DT_LNK:
if (!strcmp(entry->d_name, "metadata")) {
ret = extract_one_trace(output_path,
input_path);