From 93aa0852b6dd82c77616fb2b120cfad09d1d89ce Mon Sep 17 00:00:00 2001 From: "Long.inus" Date: Thu, 2 May 2013 05:43:56 +0900 Subject: [PATCH] tunerec: fix while(), helpmsg --- tunerec/tunerec.c | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) 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; -- 2.11.0