diff recpt1/recpt1.c @ 59:aeb885ed4e7e

recpt1 shows list of terrestrial channels if .recpt1-channels is available in the home directory.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 03 Oct 2009 13:07:43 +0900
parents d3929562b8e7
children f1553492e8bb
line wrap: on
line diff
--- a/recpt1/recpt1.c	Tue Sep 22 01:13:34 2009 +0900
+++ b/recpt1/recpt1.c	Sat Oct 03 13:07:43 2009 +0900
@@ -335,8 +335,23 @@
 void
 show_channels(void)
 {
+    FILE *f;
+    char *home;
+    char buf[255], filename[255];
+
     fprintf(stderr, "Available Channels:\n");
-    fprintf(stderr, "13-62:Terrestrial Channels\n");
+
+    home = getenv("HOME");
+    sprintf(filename, "%s/.recpt1-channels", home);
+    f = fopen(filename, "r");
+    if(f) {
+        while(fgets(buf, 255, f))
+            fprintf(stderr, "%s", buf);
+        fclose(f);
+    }
+    else
+        fprintf(stderr, "13-62:Terrestrial Channels\n");
+
     fprintf(stderr, "101ch:NHK BS1\n");
     fprintf(stderr, "102ch:NHK BS2\n");
     fprintf(stderr, "103ch:NHK BShi\n");