From: Uwe Hermann Date: Fri, 21 Aug 2015 13:23:58 +0000 (+0200) Subject: Restore the default of "pulseview foo.sr" opening the file. X-Git-Tag: pulseview-0.3.0~138 X-Git-Url: https://sigrok.org/gitaction?a=commitdiff_plain;h=3e5bc2687fc23309ad46872fc5accde2af82ea87;p=pulseview.git Restore the default of "pulseview foo.sr" opening the file. This used to work in e.g. the 0.2.0 release and is much more convenient than having to supply "-i" for every file. It also allows for (easier, at least) association of the .sr extension with PulseView on most OSes. --- diff --git a/main.cpp b/main.cpp index 62397239..97a61280 100644 --- a/main.cpp +++ b/main.cpp @@ -128,9 +128,11 @@ int main(int argc, char *argv[]) } } - if (argc != optind) { - fprintf(stderr, "Unexpected argument: %s\n", argv[optind]); + if (argc - optind > 1) { + fprintf(stderr, "Only one file can be openened.\n"); return 1; + } else if (argc - optind == 1) { + open_file = argv[argc - 1]; } // Initialise libsigrok