comparison recpt1/recpt1.c @ 57:d3929562b8e7

- added --list option to show channel list. - tweaked help format.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sun, 13 Sep 2009 13:01:22 +0900
parents 6bcdd17c12f6
children aeb885ed4e7e
comparison
equal deleted inserted replaced
56:521d796003b2 57:d3929562b8e7
307 } 307 }
308 308
309 void 309 void
310 show_usage(char *cmd) 310 show_usage(char *cmd)
311 { 311 {
312 fprintf(stderr, "\n");
313 fprintf(stderr, "Usage: \n%s [--b25 [--round N] [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] channel rectime destfile\n", cmd); 312 fprintf(stderr, "Usage: \n%s [--b25 [--round N] [--strip] [--EMM]] [--udp [--addr hostname --port portnumber]] [--device devicefile] channel rectime destfile\n", cmd);
314 fprintf(stderr, "\n"); 313 fprintf(stderr, "\n");
315 fprintf(stderr, "Remarks:\n"); 314 fprintf(stderr, "Remarks:\n");
316 fprintf(stderr, "if rectime is '-', records indefinitely.\n"); 315 fprintf(stderr, "if rectime is '-', records indefinitely.\n");
317 fprintf(stderr, "if destfile is '-', stdout is used for output.\n"); 316 fprintf(stderr, "if destfile is '-', stdout is used for output.\n");
318 fprintf(stderr, "\n");
319 } 317 }
320 318
321 void 319 void
322 show_options(void) 320 show_options(void)
323 { 321 {
330 fprintf(stderr, " --addr hostname: Hostname or address to connect\n"); 328 fprintf(stderr, " --addr hostname: Hostname or address to connect\n");
331 fprintf(stderr, " --port portnumber: Port number to connect\n"); 329 fprintf(stderr, " --port portnumber: Port number to connect\n");
332 fprintf(stderr, "--device devicefile: Specify devicefile to use\n"); 330 fprintf(stderr, "--device devicefile: Specify devicefile to use\n");
333 fprintf(stderr, "--help: Show this help\n"); 331 fprintf(stderr, "--help: Show this help\n");
334 fprintf(stderr, "--version: Show version\n"); 332 fprintf(stderr, "--version: Show version\n");
335 fprintf(stderr, "\n"); 333 fprintf(stderr, "--list: Show channel list\n");
336 } 334 }
337 void 335 void
338 show_channels(void) 336 show_channels(void)
339 { 337 {
340 fprintf(stderr, "Available Channels:\n"); 338 fprintf(stderr, "Available Channels:\n");
350 fprintf(stderr, "191ch:WOWOW\n"); 348 fprintf(stderr, "191ch:WOWOW\n");
351 fprintf(stderr, "200ch:Star Channel\n"); 349 fprintf(stderr, "200ch:Star Channel\n");
352 fprintf(stderr, "211ch:BS11 Digital\n"); 350 fprintf(stderr, "211ch:BS11 Digital\n");
353 fprintf(stderr, "222ch:TwellV\n"); 351 fprintf(stderr, "222ch:TwellV\n");
354 fprintf(stderr, "CS2-CS24:CS Channels\n"); 352 fprintf(stderr, "CS2-CS24:CS Channels\n");
355 fprintf(stderr, "\n");
356 } 353 }
357 354
358 float 355 float
359 getsignal_isdb_s(int signal) 356 getsignal_isdb_s(int signal)
360 { 357 {
542 { "addr", 1, NULL, 'a'}, 539 { "addr", 1, NULL, 'a'},
543 { "port", 1, NULL, 'p'}, 540 { "port", 1, NULL, 'p'},
544 { "device", 1, NULL, 'd'}, 541 { "device", 1, NULL, 'd'},
545 { "help", 0, NULL, 'h'}, 542 { "help", 0, NULL, 'h'},
546 { "version", 0, NULL, 'v'}, 543 { "version", 0, NULL, 'v'},
544 { "list", 0, NULL, 'l'},
547 {0, 0, NULL, 0} /* terminate */ 545 {0, 0, NULL, 0} /* terminate */
548 }; 546 };
549 547
550 int use_b25 = FALSE; 548 int use_b25 = FALSE;
551 int use_udp = FALSE; 549 int use_udp = FALSE;
556 sock_data *sockdata = NULL; 554 sock_data *sockdata = NULL;
557 char *device = NULL; 555 char *device = NULL;
558 char **tuner; 556 char **tuner;
559 int num_devs; 557 int num_devs;
560 558
561 while((result = getopt_long(argc, argv, "br:smua:p:d:hv", 559 while((result = getopt_long(argc, argv, "br:smua:p:d:hvl",
562 long_options, &option_index)) != -1) { 560 long_options, &option_index)) != -1) {
563 switch(result) { 561 switch(result) {
564 case 'b': 562 case 'b':
565 use_b25 = TRUE; 563 use_b25 = TRUE;
566 fprintf(stderr, "using B25...\n"); 564 fprintf(stderr, "using B25...\n");
577 use_udp = TRUE; 575 use_udp = TRUE;
578 host_to = "localhost"; 576 host_to = "localhost";
579 fprintf(stderr, "enable UDP broadcasting\n"); 577 fprintf(stderr, "enable UDP broadcasting\n");
580 break; 578 break;
581 case 'h': 579 case 'h':
580 fprintf(stderr, "\n");
582 show_usage(argv[0]); 581 show_usage(argv[0]);
582 fprintf(stderr, "\n");
583 show_options(); 583 show_options();
584 fprintf(stderr, "\n");
584 show_channels(); 585 show_channels();
586 fprintf(stderr, "\n");
585 exit(0); 587 exit(0);
586 break; 588 break;
587 case 'v': 589 case 'v':
588 fprintf(stderr, "%s %s\n", argv[0], version); 590 fprintf(stderr, "%s %s\n", argv[0], version);
589 fprintf(stderr, "recorder command for PT1 digital tuner.\n"); 591 fprintf(stderr, "recorder command for PT1 digital tuner.\n");
592 exit(0);
593 break;
594 case 'l':
595 show_channels();
590 exit(0); 596 exit(0);
591 break; 597 break;
592 /* following options require argument */ 598 /* following options require argument */
593 case 'r': 599 case 'r':
594 dopt.round = atoi(optarg); 600 dopt.round = atoi(optarg);