From 9d522000aa2738bcc215e01539eaf3cfb574ef81 Mon Sep 17 00:00:00 2001 From: Paul Mackerras Date: Tue, 23 Nov 1993 23:40:54 +0000 Subject: [PATCH] add `must_exist' parameter to options_from_file --- pppd/options.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/pppd/options.c b/pppd/options.c index 2661fa4..769d2e8 100644 --- a/pppd/options.c +++ b/pppd/options.c @@ -18,7 +18,7 @@ */ #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 @@ -297,8 +297,9 @@ usage() * and interpret them. */ int -options_from_file(filename) +options_from_file(filename, must_exist) char *filename; + int must_exist; { FILE *f; int i, newline; @@ -308,7 +309,7 @@ options_from_file(filename) char cmd[MAXWORDLEN]; if ((f = fopen(filename, "r")) == NULL) { - if (errno == ENOENT) + if (!must_exist && errno == ENOENT) return 1; perror(filename); exit(1); @@ -370,7 +371,7 @@ options_from_user() 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; } @@ -531,7 +532,7 @@ static int readfile(argv) char **argv; { - return options_from_file(*argv); + return options_from_file(*argv, 1); } /* -- 2.39.2