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);
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.