Mailing List archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[linux-dvb] linuxtv-dvb-apps-showconfigs.patch




Ludwig Nussel wrote:
>
> JFYI, the SUSE rpm puts the remote config files in
> /usr/share/av7110_loadkeys, include files in /usr/include/dvb and
> the test programs in /usr/lib/dvb/test. The channels.conf* and scan
> config files are just in /usr/share/doc/packages/dvb.
>

hmmm, okay, so I added that location as well. ;-)

here is a patch that will make `dvbscan` to list the series of
initial-data-files being installed in the system. It works on
all of /etc/dvb/dvb-?/* /usr/share/dvb/dvb-?/* and of course
that /usr/share/doc/packages/dvb/dvb-?/* ... it may help user
to get a clue (it's shown when no cmdline arguments are given).

Btw, I was thinking over to give this function its own getopt
but hey "-l" is taken :-/ ... and what makes me wonder, why
is there "q:" while the usagedoc says it does not require an
argument (i.e. --quiet)?

cheers,
-- guido                                  http://google.de/search?q=guidod
GCS/E/S/P C++/++++$ ULHS L++w- N++@ s+:a d(+-) r+@>+++ y++ 5++X- (geekcode)
? dvb-apps-dvbscan-rename-cleanup.patch
? linuxtv-dvb-apps-showconfigs.patch
Index: util/scan/scan.c
===================================================================
RCS file: /cvs/linuxtv/dvb-apps/util/scan/scan.c,v
retrieving revision 1.6
diff -u -r1.6 scan.c
--- util/scan/scan.c	14 Feb 2004 22:42:46 -0000	1.6
+++ util/scan/scan.c	14 Feb 2004 23:23:35 -0000
@@ -22,6 +22,7 @@
 #include <errno.h>
 #include <signal.h>
 #include <assert.h>
+#include <glob.h>
 
 #include <linux/dvb/frontend.h>
 #include <linux/dvb/dmx.h>
@@ -1714,6 +1715,30 @@
 	info("Done.\n");
 }
 
+static void show_existing_tuning_data_files(void)
+{
+#ifndef PREFIX
+#define PREFIX "/usr/local"
+#endif
+	static const char* prefixlist[] = { PREFIX"/share/dvb", 
+					    "/usr/share/dvb", "/etc/dvb", 
+					    "/usr/share/doc/packages/dvb", 0 };
+	int i;
+	const char **prefix;
+	fprintf(stderr, "initial tuning data files:\n");
+	for (prefix = prefixlist; *prefix; prefix++) {
+		glob_t globbuf = {0};
+		char* globspec = malloc (strlen(*prefix)+9);
+		strcpy (globspec, *prefix); strcat (globspec, "/dvb-?/*");
+		if (! glob (globspec, 0, 0, &globbuf)) {
+			for (i=0; i < globbuf.gl_pathc; i++) 
+				fprintf(stderr, " file: %s\n", globbuf.gl_pathv[i]);
+		}
+		free (globspec);
+		globfree (&globbuf);
+	}
+}
+
 static void handle_sigint(int sig)
 {
 	error("interrupted by SIGINT, dumping partial result...\n");
@@ -1750,17 +1775,21 @@
 	"	-u      UK DVB-T Freeview channel numbering for VDR\n";
 
 void
-bad_usage(char *pname, int prlnb)
+bad_usage(char *pname, int problem)
 {
-int i;
-struct lnb_types_st *lnbp;
-char **cp;
+	int i;
+	struct lnb_types_st *lnbp;
+	char **cp;
 
-	if (!prlnb) {
+	switch (problem) {
+	default:
+	case 0:
 		fprintf (stderr, usage, pname);
-	} else {
+		break;
+	case 1:
 		i = 0;
-		fprintf(stderr, "-l <lnb-type> or -l low[,high[,switch]] in Mhz\nwhere <lnb-type> is:\n");
+		fprintf(stderr, "-l <lnb-type> or -l low[,high[,switch]] in Mhz\n"
+			"where <lnb-type> is:\n");
 		while(NULL != (lnbp = lnb_enum(i))) {
 			fprintf (stderr, "%s\n", lnbp->name);
 			for (cp = lnbp->desc; *cp ; cp++) {
@@ -1768,6 +1797,10 @@
 			}
 			i++;
 		}
+		break;
+	case 2:
+		show_existing_tuning_data_files();
+		fprintf (stderr, usage, pname);
 	}
 }
 
@@ -1780,6 +1813,11 @@
 	int fe_open_mode;
 	const char *initial = NULL;
 
+	if (argc <= 1) {
+	    bad_usage(argv[0], 2);
+	    return -1;
+	}
+
 	/* start with default lnb type */
 	lnb_type = *lnb_enum(0);
 	while ((opt = getopt(argc, argv, "5cnpa:f:d:s:o:x:e:t:i:l:vq:u")) != -1) {

Home | Main Index | Thread Index