From 30b203b9c34cfa5cdf6d3c8321bfebf7abcd150a Mon Sep 17 00:00:00 2001 From: ian Date: Sun, 10 Sep 2006 19:42:36 +0000 Subject: [PATCH] get input initialisation and parser errors a bit more right --- hostside/realtime.c | 20 ++++++++++---------- hostside/record.c | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/hostside/realtime.c b/hostside/realtime.c index 629b515..18e1f13 100644 --- a/hostside/realtime.c +++ b/hostside/realtime.c @@ -227,16 +227,6 @@ int main(int argc, const char **argv) { const char *arg; int r; - while ((arg=*++argv) && *arg=='-') { - arg++; - switch (*arg++) { - case 's': device= arg; break; - default: badusage("unknown option"); - } - } - - records_parse(argv); - sys_events= oop_sys_new(); if (!sys_events) diee("oop_sys_new"); events= oop_sys_source(sys_events); massert(events); @@ -247,6 +237,16 @@ int main(int argc, const char **argv) { cmdin_new(&cmdi, 0); + while ((arg=*++argv) && *arg=='-') { + arg++; + switch (*arg++) { + case 's': device= arg; break; + default: badusage("unknown option"); + } + } + + records_parse(argv); + serial_open(device); r= oop_fd_nonblock(serial_fd, 1); if (r) diee("nonblock(serial_fd,1)"); diff --git a/hostside/record.c b/hostside/record.c index 1f357af..45bcca6 100644 --- a/hostside/record.c +++ b/hostside/record.c @@ -21,7 +21,7 @@ static const char *filename; void record_yyerror(const char *m) { - die("config: %s:%d: %s\n", filename, record_yylineno, m); + die("config: %s:%d: %s", filename, record_yylineno, m); } /*---------- pname lookup (also handles train counting) ----------*/ -- 2.30.2