diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2009-11-07 17:25:27 +1000 |
---|---|---|
committer | Peter Hutterer <peter.hutterer@who-t.net> | 2009-11-11 09:35:15 +1000 |
commit | be616bbbf063b41dca526d00dd0f300e5f6363b1 (patch) | |
tree | 594d891ea807e14c58528ebcd8ef78f3bd9d09b9 | |
parent | 89b8aa466e1edd1566353bd335d12acbf7938d8e (diff) |
evtest-capture: Take extra parameter for output file.
Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
-rw-r--r-- | evtest-capture.c | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/evtest-capture.c b/evtest-capture.c index 1d8819d..db5eeea 100644 --- a/evtest-capture.c +++ b/evtest-capture.c @@ -721,11 +721,11 @@ error: return -1; } -static int init_xml(xmlTextWriterPtr *writer) +static int init_xml(xmlTextWriterPtr *writer, const char *outfile) { LIBXML_TEST_VERSION - *writer = xmlNewTextWriterFilename("evtest-capture.xml", 0); + *writer = xmlNewTextWriterFilename(outfile, 0); if (!*writer) return -1; @@ -797,19 +797,24 @@ int main(int argc, char **argv) { int fd = 0; int rc; + char *outfile = "evtest-capture.xml"; xmlTextWriterPtr writer; if (argc < 2) { - printf("Usage: %s /dev/input/eventX\n", argv[0]); - printf("Where X = input device number.\n"); + printf("Usage: %s /dev/input/eventX [evtest-capture.xml]\n", argv[0]); + printf("Where X = input device number and\n"); + printf("outfile.xml is the output file. Default: evtest-capture.xml\n"); return 1; } - if ((fd = open(argv[argc - 1], O_RDONLY)) < 0) + if ((fd = open(argv[1], O_RDONLY)) < 0) goto error; - init_xml(&writer); + if (argc >= 3) + outfile = argv[2]; + + init_xml(&writer, outfile); start(BAD_CAST "evtest-capture"); |