Mailing List archive

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

[linux-dvb] linuxtv-dvb-apps usagehelp patches



When installing the various binaries, lots of information in the source
code is not present - and manual pages do not exist either. The
following patches do something verrry simple - the top-of-source
comment /** ... */ is converted to a #define USAGE "...." \ and
appended to the simple-help string as

- fprintf(stderr,"usage: %s args\n", argv[0]
+ fprintf(stderr,"usage: %s args\n" USAGE, argv[0]

Effectivly, most binaries are now a lot more verbose in telling
what they want to do - just call them without any arguments.
For example:

# dvb_setvoltage
usage: dvb_setvoltage <13|18>


Test switching the voltage signal high and low on a SAT frontend.
(Note: DiSEqC equipment ignores this after it has once seen a diseqc
 sequence; reload the driver or unplug/replug the SAT cable to reset.)

usage: FRONTEND=/dev/dvb/adapterX/frontendX setvoltage {13|18}

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)
--- test/diseqc.c.orig	2004-01-17 17:59:46.000000000 +0100
+++ test/diseqc.c	2004-02-13 22:41:14.000000000 +0100
@@ -1,8 +1,9 @@
-/*
- * Test sending DiSEqC commands on a SAT frontend.
- *
- * usage: FRONTEND=/dev/dvb/adapterX/frontendX diseqc [test_seq_no]
- */
+#define USAGE \
+"\n" \
+"\nTest sending DiSEqC commands on a SAT frontend." \
+"\n" \
+"\nusage: FRONTEND=/dev/dvb/adapterX/frontendX diseqc [test_seq_no|'all']" \
+"\n"
 
 #include <pthread.h>
 #include <time.h>
@@ -109,7 +110,10 @@
 		return -1;
 	}
 
-	if (argc > 1) {
+	if (argc != 2) {
+	    fprintf (stderr, "usage: %s [number|'all']\n" USAGE, argv[0]);
+	    return 1;
+	} else if (strcmp(argv[1], "all")) {
 		int i = atol(argv[1]);
 		cmd[0] = &switch_cmds[i];
 		diseqc_send_msg(fd,
--- test/sendburst.c.orig	2004-01-17 17:59:46.000000000 +0100
+++ test/sendburst.c	2004-02-13 22:42:19.000000000 +0100
@@ -1,8 +1,9 @@
-/*
- * Test sending the burst mini command A/B on a SAT frontend.
- *
- * usage: FRONTEND=/dev/dvb/adapterX/frontendX sendburst {a|b}
- */
+#define USAGE \
+"\n" \
+"\nTest sending the burst mini command A/B on a SAT frontend." \
+"\n" \
+"\nusage: FRONTEND=/dev/dvb/adapterX/frontendX sendburst {a|b}" \
+"\n"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -22,7 +23,7 @@
    int fd, r;
 
    if (argc != 2 || (strcmp(argv[1], "a") && strcmp(argv[1], "b"))) {
-      fprintf (stderr, "usage: %s <a|b>\n", argv[0]);
+      fprintf (stderr, "usage: %s <a|b>\n" USAGE, argv[0]);
       return 1;
    }
 
--- test/set22k.c.orig	2004-01-17 17:59:46.000000000 +0100
+++ test/set22k.c	2004-02-13 22:44:17.000000000 +0100
@@ -1,10 +1,11 @@
-/*
- * Test switching the 22kHz tone signal on and off on a SAT frontend.
- * (Note: DiSEqC equipment ignores this after it has once seen a diseqc
- *  sequence; reload the driver or unplug/replug the SAT cable to reset.)
- *
- * usage: FRONTEND=/dev/dvb/adapterX/frontendX set22k {on|off}
- */
+#define USAGE \
+"\n" \
+"\nTest switching the 22kHz tone signal on and off on a SAT frontend." \
+"\n(Note: DiSEqC equipment ignores this after it has once seen a diseqc" \
+"\n sequence; reload the driver or unplug/replug the SAT cable to reset.)" \
+"\n" \
+"\nusage: FRONTEND=/dev/dvb/adapterX/frontendX set22k {on|off}" \
+"\n"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -24,7 +25,7 @@
    int fd, r;
 
    if (argc != 2 || (strcmp(argv[1], "on") && strcmp(argv[1], "off"))) {
-      fprintf (stderr, "usage: %s <on|off>\n", argv[0]);
+      fprintf (stderr, "usage: %s <on|off>\n" USAGE, argv[0]);
       return 1;
    }
    if (getenv("FRONTEND"))
--- test/setpid.c.orig	2004-01-17 17:59:46.000000000 +0100
+++ test/setpid.c	2004-02-13 22:45:58.000000000 +0100
@@ -1,9 +1,10 @@
-/*
- * Set video and audio PIDs in the demux; useful only if you have
- * a hardware MPEG decoder and you're tuned to a transport stream.
- *
- * usage: DEMUX=/dev/dvb/adapterX/demuxX setpid video_pid audio_pid
- */
+#define USAGE \
+"\n" \
+"\nSet video and audio PIDs in the demux; useful only if you have" \
+"\na hardware MPEG decoder and you're tuned to a transport stream." \
+"\n" \
+"\nusage: DEMUX=/dev/dvb/adapterX/demuxX setpid video_pid audio_pid" \
+"\n"
 
 #include <unistd.h>
 #include <stdlib.h>
@@ -69,7 +70,7 @@
    int video_pid, audio_pid;
 
    if (argc != 3) {
-      printf ("\nusage: %s <video pid> <audio pid>\n\n", argv[0]);
+      printf ("\nusage: %s <video pid> <audio pid>\n\n" USAGE, argv[0]);
       exit (1);
    }
    if (getenv("DEMUX"))
--- test/setvoltage.c.orig	2004-01-17 17:59:46.000000000 +0100
+++ test/setvoltage.c	2004-02-13 22:48:02.000000000 +0100
@@ -1,10 +1,11 @@
-/*
- * Test switching the voltage signal high and low on a SAT frontend.
- * (Note: DiSEqC equipment ignores this after it has once seen a diseqc
- *  sequence; reload the driver or unplug/replug the SAT cable to reset.)
- *
- * usage: FRONTEND=/dev/dvb/adapterX/frontendX setvoltage {13|18}
- */
+#define USAGE \
+"\n" \
+"\nTest switching the voltage signal high and low on a SAT frontend." \
+"\n(Note: DiSEqC equipment ignores this after it has once seen a diseqc" \
+"\n sequence; reload the driver or unplug/replug the SAT cable to reset.)" \
+"\n" \
+"\nusage: FRONTEND=/dev/dvb/adapterX/frontendX setvoltage {13|18}" \
+"\n"
 
 #include <stdlib.h>
 #include <stdio.h>
@@ -23,7 +24,7 @@
    int fd, r;
 
    if (argc != 2 || (strcmp(argv[1], "13") && strcmp(argv[1], "18"))) {
-      fprintf (stderr, "usage: %s <13|18>\n", argv[0]);
+      fprintf (stderr, "usage: %s <13|18>\n" USAGE, argv[0]);
       return -1;
    }
    if (getenv("FRONTEND"))
--- test/video.c.orig	2004-01-17 17:59:46.000000000 +0100
+++ test/video.c	2004-02-13 22:50:43.000000000 +0100
@@ -1,13 +1,14 @@
- /**
- *  A tiny video watching application, just starts capturing /dev/video
- *  into /dev/fb0.
- *  Be shure to have >8Bit/pixel color resolution and r/w access for 
- *  /dev/video0, /dev/fb0 and /dev/tty0 to let this work...
- *
- *   compile with
- *
- *   $ gcc -g -Wall -O2 -o video video.c -I../../ost/include
- */
+#define USAGE \
+"\n" \
+"\n A tiny video watching application, just starts capturing /dev/video" \
+"\n into /dev/fb0." \
+"\n Be shure to have >8Bit/pixel color resolution and r/w access for " \
+"\n /dev/video0, /dev/fb0 and /dev/tty0 to let this work..." \
+"\n" \
+"\n  compile with" \
+"\n" \
+"\n  $ gcc -g -Wall -O2 -o video video.c -I../../ost/include" \
+"\n"
 
 #include <sys/mman.h>
 #include <sys/ioctl.h>
@@ -173,7 +174,7 @@
 		video_devname = argv[1];
 
 	if (argc != 1 && argc != 2 && !(argc == 3 && stop)) {
-		fprintf (stderr, "usage: %s <devname> <stop>\n", argv[0]);
+		fprintf(stderr, "usage: %s <devname> <stop>\n" USAGE, argv[0]);
 		exit (-1);
 	}
 

Home | Main Index | Thread Index