comparison main.c @ 181:44ea61019069

Accept "-" as the input file, or as the output file. Has no effect (input or output remains stdin and/or stdout respectively)
author David A. Holland
date Fri, 12 Jun 2015 03:16:04 -0400
parents 3e7e696fe558
children f7814226906c
comparison
equal deleted inserted replaced
180:d65a2f2184cb 181:44ea61019069
1051 complain_init(progname); 1051 complain_init(progname);
1052 1052
1053 init(); 1053 init();
1054 1054
1055 for (i=1; i<argc; i++) { 1055 for (i=1; i<argc; i++) {
1056 if (argv[i][0] != '-') { 1056 if (argv[i][0] != '-' || argv[i][1] == 0) {
1057 break; 1057 break;
1058 } 1058 }
1059 place_setcommandline(&cmdplace, i, 1); 1059 place_setcommandline(&cmdplace, i, 1);
1060 if (check_ignore_option(argv[i]+1)) { 1060 if (check_ignore_option(argv[i]+1)) {
1061 continue; 1061 continue;
1076 } 1076 }
1077 usage(progname, "Invalid option %s", argv[i]); 1077 usage(progname, "Invalid option %s", argv[i]);
1078 } 1078 }
1079 if (i < argc) { 1079 if (i < argc) {
1080 inputfile = argv[i++]; 1080 inputfile = argv[i++];
1081 if (!strcmp(inputfile, "-")) {
1082 inputfile = NULL;
1083 }
1081 } 1084 }
1082 if (i < argc) { 1085 if (i < argc) {
1083 outputfile = argv[i++]; 1086 outputfile = argv[i++];
1087 if (!strcmp(outputfile, "-")) {
1088 outputfile = NULL;
1089 }
1084 } 1090 }
1085 if (i < argc) { 1091 if (i < argc) {
1086 usage(progname, "Extra non-option argument %s", argv[i]); 1092 usage(progname, "Extra non-option argument %s", argv[i]);
1087 } 1093 }
1088 1094