From: ian Date: Thu, 12 Aug 2004 18:27:54 +0000 (+0000) Subject: allow stdin; opposite polarity X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ijackson/git?a=commitdiff_plain;h=33f4a9fe7e1ab8d979dca3488fc87fc885e91551;p=trains.git allow stdin; opposite polarity --- diff --git a/parport/train-pic-prog-select.c b/parport/train-pic-prog-select.c index c10229a..f443deb 100644 --- a/parport/train-pic-prog-select.c +++ b/parport/train-pic-prog-select.c @@ -79,15 +79,19 @@ int main(int argc, const char *const *argv) { if (ep==arg) badusage("syntactically incorrect range"); } if (*ep) badusage("syntactically incorrect picno or range"); - if (first<0 || last>COLUMNS*ROWS-1 || firstCOLUMNS*ROWS-1 || first>last) badusage("picno or range out of permissible range"); for (; first<=last; first++) { if (yesses.lin[first]) badusage("one pic specified more than once"); yesses.lin[first]= 1; } } - fd= open(parport, O_RDWR); - if (fd<0) { perror(parport); exit(-1); } + if (!strcmp(parport,"stdin")) { + fd= 0; + } else { + fd= open(parport, O_RDWR); + if (fd<0) { perror(parport); exit(-1); } + } setvbuf(stdout,0,_IONBF,0); @@ -97,7 +101,7 @@ int main(int argc, const char *const *argv) { for (row=0; row