Mercurial > pt1
comparison recpt1/recpt1.c @ 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 | b17f95181af4 |
children | b03685d25fee |
comparison
equal
deleted
inserted
replaced
37:c359e7adf700 | 38:3228f5cde349 |
---|---|
305 | 305 |
306 void | 306 void |
307 show_usage(char *cmd) | 307 show_usage(char *cmd) |
308 { | 308 { |
309 fprintf(stderr, "\n"); | 309 fprintf(stderr, "\n"); |
310 fprintf(stderr, "Usage: \n%s [--b25 [--round N] [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] channel recsec destfile\n", cmd); | 310 fprintf(stderr, "Usage: \n%s [--b25 [--round N] [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] channel rectime destfile\n", cmd); |
311 fprintf(stderr, "\n"); | 311 fprintf(stderr, "\n"); |
312 fprintf(stderr, "Remarks:\n"); | 312 fprintf(stderr, "Remarks:\n"); |
313 fprintf(stderr, "if recsec is '-', records indefinitely.\n"); | 313 fprintf(stderr, "if rectime is '-', records indefinitely.\n"); |
314 fprintf(stderr, "if destfile is '-', stdout is used for output.\n"); | 314 fprintf(stderr, "if destfile is '-', stdout is used for output.\n"); |
315 fprintf(stderr, "\n"); | 315 fprintf(stderr, "\n"); |
316 } | 316 } |
317 | 317 |
318 void | 318 void |
691 | 691 |
692 /* show signal strength */ | 692 /* show signal strength */ |
693 calc_cn(tfd, ptr->type); | 693 calc_cn(tfd, ptr->type); |
694 | 694 |
695 /* get recsec */ | 695 /* get recsec */ |
696 char *recsecstr = argv[optind + 1]; | 696 char *rectimestr = argv[optind + 1]; |
697 if(!strcmp("-", recsecstr)) { | 697 if(!strcmp("-", rectimestr)) { |
698 indefinite = TRUE; | 698 indefinite = TRUE; |
699 recsec = -1; | 699 recsec = -1; |
700 } | 700 } |
701 else { | 701 else if(strrchr(rectimestr, 'H') || strrchr(rectimestr, 'h')) |
702 recsec = atoi(recsecstr); | 702 recsec = atoi(rectimestr) * 3600; |
703 } | 703 else if(strrchr(rectimestr, 'M') || strrchr(rectimestr, 'm')) |
704 recsec = atoi(rectimestr) * 60; | |
705 else | |
706 recsec = atoi(rectimestr); | |
704 | 707 |
705 /* open output file */ | 708 /* open output file */ |
706 char *destfile = argv[optind + 2]; | 709 char *destfile = argv[optind + 2]; |
707 if(destfile && !strcmp("-", destfile)) { | 710 if(destfile && !strcmp("-", destfile)) { |
708 use_stdout = TRUE; | 711 use_stdout = TRUE; |
709 wfd = 1; /* stdout */ | 712 wfd = 1; /* stdout */ |
710 } | 713 } |
711 else { | 714 else { |
712 if(!fileless) { | 715 if(!fileless) { |
713 wfd = open(argv[optind + 2], (O_RDWR | O_CREAT | O_TRUNC), 0666); | 716 wfd = open(argv[optind + 2], (O_RDWR | O_CREAT | O_TRUNC), 0666); |
714 if(wfd < 0) { | 717 if(wfd < 0) { |
715 fprintf(stderr, "Cannot open output file: %s\n", | 718 fprintf(stderr, "Cannot open output file: %s\n", |