]> git.ozlabs.org Git - ppp.git/commitdiff
add `must_exist' parameter to options_from_file
authorPaul Mackerras <paulus@samba.org>
Tue, 23 Nov 1993 23:40:54 +0000 (23:40 +0000)
committerPaul Mackerras <paulus@samba.org>
Tue, 23 Nov 1993 23:40:54 +0000 (23:40 +0000)
pppd/options.c

index 2661fa4d26d141204505e0fb7df3a22c1f423393..769d2e86b55dd083cf6c4343e67ffd8097af6cac 100644 (file)
@@ -18,7 +18,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char rcsid[] = "$Id: options.c,v 1.1 1993/11/11 03:54:25 paulus Exp $";
+static char rcsid[] = "$Id: options.c,v 1.2 1993/11/23 23:40:53 paulus Exp $";
 #endif
 
 #include <stdio.h>
 #endif
 
 #include <stdio.h>
@@ -297,8 +297,9 @@ usage()
  * and interpret them.
  */
 int
  * and interpret them.
  */
 int
-options_from_file(filename)
+options_from_file(filename, must_exist)
     char *filename;
     char *filename;
+    int must_exist;
 {
     FILE *f;
     int i, newline;
 {
     FILE *f;
     int i, newline;
@@ -308,7 +309,7 @@ options_from_file(filename)
     char cmd[MAXWORDLEN];
 
     if ((f = fopen(filename, "r")) == NULL) {
     char cmd[MAXWORDLEN];
 
     if ((f = fopen(filename, "r")) == NULL) {
-       if (errno == ENOENT)
+       if (!must_exist && errno == ENOENT)
            return 1;
        perror(filename);
        exit(1);
            return 1;
        perror(filename);
        exit(1);
@@ -370,7 +371,7 @@ options_from_user()
        novm("init file name");
     strcpy(path, user);
     strcat(path, file);
        novm("init file name");
     strcpy(path, user);
     strcat(path, file);
-    ret = options_from_file(path);
+    ret = options_from_file(path, 0);
     free(path);
     return ret;
 }
     free(path);
     return ret;
 }
@@ -531,7 +532,7 @@ static int
 readfile(argv)
     char **argv;
 {
 readfile(argv)
     char **argv;
 {
-    return options_from_file(*argv);
+    return options_from_file(*argv, 1);
 }
 
 /*
 }
 
 /*