From: Long.inus Date: Wed, 1 May 2013 20:43:56 +0000 (+0900) Subject: tunerec: fix while(), helpmsg X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=93aa0852b6dd82c77616fb2b120cfad09d1d89ce;p=rec10%2Frec10-git.git tunerec: fix while(), helpmsg --- diff --git a/tunerec/tunerec.c b/tunerec/tunerec.c index 0a1d1fe..6be978f 100755 --- a/tunerec/tunerec.c +++ b/tunerec/tunerec.c @@ -113,9 +113,9 @@ void record(int adapter_nr, char* output, int rectime) { sprintf(input, "/dev/dvb/adapter%d/dvr0", adapter_nr); start_time = time(NULL); fin = open(input, (O_RDONLY)); - while ( rt = read(fin, buf, 1316) > 0 ) { + while ( ( rt = read(fin, buf, 1316) ) > 0 ) { shift = 0; - while ( wt = write(fout, buf + shift, rt) > 0) { + while ( ( wt = write(fout, buf + shift, rt) ) > 0) { rt -= wt; if ( rt == 0 ) break; shift += wt; @@ -147,18 +147,13 @@ int main(int argc, char *argv[]) { int rectime; if (argc <= 2) { - fprintf(stderr, "Usage: %s adapter_nr freq [tsid]\n", argv[0]); + fprintf(stderr, "Usage: %s adapter_nr freq tsid rectime output\n", argv[0]); return 1; } adapter_nr = strtol(argv[1], NULL, 0); channel_freq = strtol(argv[2], NULL, 10); - channel_id = rectime = 0; - if ( argc >= 4 ){ - channel_id = strtol(argv[3], NULL, 10); - } - if ( argc >= 5 ) { - rectime = atoi(argv[4]); - } + channel_id = strtol(argv[3], NULL, 10); + rectime = atoi(argv[4]); fd = search(adapter_nr, channel_freq, channel_id); if (fd < 0) return 1;