Source

9menu / debian / patches / 03_stdin.diff

Description: Allow '-file -' to cause stdin to be read as the file
Forwarded: yes
Author: Andrew Stribblehill <ads@debian.org>
Origin: vendor
Last-Update: 2003-09-02

--- a/9menu.1
+++ b/9menu.1
@@ -99,7 +99,7 @@
 in addition to any other command line arguments.  This is intended for use
 with
 .B #!
-in scripts.
+in scripts. If the filename is "-" read from stdin.
 .TP
 .BI \-fg " foreground-color"
 Set the foreground color to
--- a/9menu.c
+++ b/9menu.c
@@ -264,7 +264,11 @@
 		char fbuf[1024];
 		FILE *fp;
 
-		fp = fopen(filename, "r");
+                if (strcmp(filename, "-") == 0) {
+                        fp = stdin;
+                } else {
+                        fp = fopen(filename, "r");
+                }
 		if (fp == NULL) {
 			fprintf(stderr, "%s: couldn't open '%s'\n", progname,
 				filename);