]> Pileus Git - ~andy/fetchmail/commitdiff
Enable - as config file argument.
authorEric S. Raymond <esr@thyrsus.com>
Thu, 5 Nov 1998 06:48:22 +0000 (06:48 -0000)
committerEric S. Raymond <esr@thyrsus.com>
Thu, 5 Nov 1998 06:48:22 +0000 (06:48 -0000)
svn path=/trunk/; revision=2175

fetchmail.man
rcfile_y.y

index 27bdc69d2d43df4e8e0fc7084dc842cf5e416b23..255853cbceda940f792f6ab3d8a9aac0273d0cdc 100644 (file)
@@ -420,8 +420,11 @@ option does not work with ETRN.
 .B \-f pathname, --fetchmailrc pathname
 Specify a non-default name for the 
 .I .fetchmailrc
-run control file.  Unless the --version option is also on, the file must have
-permissions no more open than  0600 (u=rw,g=,o=) or else be /dev/null.
+run control file.  The pathname argument must be either "-" (a single
+dash, meaning to read the configuration from standard input) or a
+filename.  Unless the --version option is also on, a named file
+argument must have permissions no more open than 0600 (u=rw,g=,o=) or
+else be /dev/null.
 .TP
 .B \-i pathname, --idfile pathname
 (Keyword: idfile)
index 12851030c57143111450451da93b4dbf76b33b46..3170ccca4bf08207692192fb8611e03932bb134f 100644 (file)
@@ -357,10 +357,14 @@ int prc_filecheck(const char *pathname, const flag securecheck)
 
     errno = 0;
 
-    /* special cases useful for debugging purposes */
+    /* special case useful for debugging purposes */
     if (strcmp("/dev/null", pathname) == 0)
        return(PS_SUCCESS);
 
+    /* pass through the special name for stdin */
+    if (strcmp("-", pathname) == 0)
+       return(PS_SUCCESS);
+
     /* the run control file must have the same uid as the REAL uid of this 
        process, it must have permissions no greater than 600, and it must not 
        be a symbolic link.  We check these conditions here. */
@@ -413,8 +417,10 @@ int prc_parse_file (const char *pathname, const flag securecheck)
     if (errno == ENOENT)
        return(PS_SUCCESS);
 
-    /* Open the configuration and feed it to the lexer. */
-    if ((yyin = fopen(pathname,"r")) == (FILE *)NULL) {
+    /* Open the configuration file and feed it to the lexer. */
+    if (strcmp(pathname, "-") == 0)
+       yyin = stdin;
+    else if ((yyin = fopen(pathname,"r")) == (FILE *)NULL) {
        error(0, errno, "open: %s", pathname);
        return(PS_IOERR);
     }