projects
/
tinc
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (from parent 1:
8ea23d9
)
Use readline() in read_config_file() instead of fgets.
author
Ivo Timmermans
<ivo@lychnis.net>
Wed, 29 Nov 2000 14:27:24 +0000
(14:27 +0000)
committer
Ivo Timmermans
<ivo@lychnis.net>
Wed, 29 Nov 2000 14:27:24 +0000
(14:27 +0000)
src/conf.c
patch
|
blob
|
history
diff --git
a/src/conf.c
b/src/conf.c
index
7399c82
..
aaa4489
100644
(file)
--- a/
src/conf.c
+++ b/
src/conf.c
@@
-19,7
+19,7
@@
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- $Id: conf.c,v 1.9.4.2
4 2000/11/29 14:24:40
zarq Exp $
+ $Id: conf.c,v 1.9.4.2
5 2000/11/29 14:27:24
zarq Exp $
*/
#include "config.h"
*/
#include "config.h"
@@
-197,7
+197,7
@@
int read_config_file(config_t **base, const char *fname)
{
int err = -1;
FILE *fp;
{
int err = -1;
FILE *fp;
- char
line[MAXBUFSIZE]; /* There really should not be any line longer than this... */
+ char
*line;
char *p, *q;
int i, lineno = 0;
config_t *cfg;
char *p, *q;
int i, lineno = 0;
config_t *cfg;
@@
-209,21
+209,15
@@
cp
for(;;)
{
for(;;)
{
- if(
fgets(line, MAXBUFSIZE, fp
) == NULL)
-
{
-
err = 0
;
-
break;
-
}
+ if(
(line = readline(fp)
) == NULL)
+ {
+
err = -1
;
+ break;
+ }
lineno++;
lineno++;
- if(!index(line, '\n'))
- {
- syslog(LOG_ERR, _("Line %d too long while reading config file %s"), lineno, fname);
- break;
- }
-
- if((p = strtok(line, "\t\n\r =")) == NULL)
+ if((p = strtok(line, "\t =")) == NULL)
continue; /* no tokens on this line */
if(p[0] == '#')
continue; /* no tokens on this line */
if(p[0] == '#')