Mercurial > pt1.oyama
changeset 38:3228f5cde349
recpt1 now accepts 1[HhMmSs] as recording duration. formats like 1Hour or 1hour are also be accepted.
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Thu, 16 Apr 2009 22:18:58 +0900 |
parents | c359e7adf700 |
children | b03685d25fee |
files | recpt1/recpt1.c |
diffstat | 1 files changed, 12 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- 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);