changeset 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 521d796003b2
children 7a03d5185067
files recpt1/recpt1.c
diffstat 1 files changed, 11 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/recpt1/recpt1.c	Sun Sep 13 11:48:40 2009 +0900
+++ b/recpt1/recpt1.c	Sun Sep 13 13:01:22 2009 +0900
@@ -309,13 +309,11 @@
 void
 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 rectime destfile\n", cmd);
     fprintf(stderr, "\n");
     fprintf(stderr, "Remarks:\n");
     fprintf(stderr, "if rectime  is '-', records indefinitely.\n");
     fprintf(stderr, "if destfile is '-', stdout is used for output.\n");
-    fprintf(stderr, "\n");
 }
 
 void
@@ -332,7 +330,7 @@
     fprintf(stderr, "--device devicefile: Specify devicefile to use\n");
     fprintf(stderr, "--help:              Show this help\n");
     fprintf(stderr, "--version:           Show version\n");
-    fprintf(stderr, "\n");
+    fprintf(stderr, "--list:              Show channel list\n");
 }
 void
 show_channels(void)
@@ -352,7 +350,6 @@
     fprintf(stderr, "211chˇ§BS11 Digital\n");
     fprintf(stderr, "222chˇ§TwellV\n");
     fprintf(stderr, "CS2-CS24ˇ§CS Channels\n");
-    fprintf(stderr, "\n");
 }
 
 float
@@ -544,6 +541,7 @@
         { "device",    1, NULL, 'd'},
         { "help",      0, NULL, 'h'},
         { "version",   0, NULL, 'v'},
+        { "list",      0, NULL, 'l'},
         {0, 0, NULL, 0} /* terminate */
     };
 
@@ -558,7 +556,7 @@
     char **tuner;
     int num_devs;
 
-    while((result = getopt_long(argc, argv, "br:smua:p:d:hv",
+    while((result = getopt_long(argc, argv, "br:smua:p:d:hvl",
                                 long_options, &option_index)) != -1) {
         switch(result) {
         case 'b':
@@ -579,9 +577,13 @@
             fprintf(stderr, "enable UDP broadcasting\n");
             break;
         case 'h':
+            fprintf(stderr, "\n");
             show_usage(argv[0]);
+            fprintf(stderr, "\n");
             show_options();
+            fprintf(stderr, "\n");
             show_channels();
+            fprintf(stderr, "\n");
             exit(0);
             break;
         case 'v':
@@ -589,6 +591,10 @@
             fprintf(stderr, "recorder command for PT1 digital tuner.\n");
             exit(0);
             break;
+        case 'l':
+            show_channels();
+            exit(0);
+            break;
         /* following options require argument */
         case 'r':
             dopt.round = atoi(optarg);