# HG changeset patch # User Yoshiki Yazawa # Date 1239887938 -32400 # Node ID 3228f5cde349d6456be5249f6a51094c590b7eae # Parent c359e7adf7007a01fa1dff83451edd53111eee32 recpt1 now accepts 1[HhMmSs] as recording duration. formats like 1Hour or 1hour are also be accepted. diff -r c359e7adf700 -r 3228f5cde349 recpt1/recpt1.c --- a/recpt1/recpt1.c Tue Apr 07 05:42:18 2009 +0900 +++ b/recpt1/recpt1.c Thu Apr 16 22:18:58 2009 +0900 @@ -307,10 +307,10 @@ show_usage(char *cmd) { fprintf(stderr, "\n"); - fprintf(stderr, "Usage: \n%s [--b25 [--round N] [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] channel recsec destfile\n", cmd); + fprintf(stderr, "Usage: \n%s [--b25 [--round N] [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] channel rectime destfile\n", cmd); fprintf(stderr, "\n"); fprintf(stderr, "Remarks:\n"); - fprintf(stderr, "if recsec is '-', records indefinitely.\n"); + fprintf(stderr, "if rectime is '-', records indefinitely.\n"); fprintf(stderr, "if destfile is '-', stdout is used for output.\n"); fprintf(stderr, "\n"); } @@ -693,21 +693,24 @@ calc_cn(tfd, ptr->type); /* get recsec */ - char *recsecstr = argv[optind + 1]; - if(!strcmp("-", recsecstr)) { + char *rectimestr = argv[optind + 1]; + if(!strcmp("-", rectimestr)) { indefinite = TRUE; recsec = -1; - } - else { - recsec = atoi(recsecstr); } + else if(strrchr(rectimestr, 'H') || strrchr(rectimestr, 'h')) + recsec = atoi(rectimestr) * 3600; + else if(strrchr(rectimestr, 'M') || strrchr(rectimestr, 'm')) + recsec = atoi(rectimestr) * 60; + else + recsec = atoi(rectimestr); /* open output file */ char *destfile = argv[optind + 2]; - if(destfile && !strcmp("-", destfile)) { + if(destfile && !strcmp("-", destfile)) { use_stdout = TRUE; wfd = 1; /* stdout */ - } + } else { if(!fileless) { wfd = open(argv[optind + 2], (O_RDWR | O_CREAT | O_TRUNC), 0666);