From 690c13620d4bc337a234aed0e4ad51db99ab8691 Mon Sep 17 00:00:00 2001 From: Wichert Akkerman Date: Thu, 23 Nov 2000 18:27:17 +0000 Subject: [PATCH] properly chomp lines --- ChangeLog | 4 ++++ lib/myopt.c | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 7d2ee259..e5c78195 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Thu Nov 23 19:13:21 CET 2000 Wichert Akkerman + + * lib/myopt.c: properly chomp read lines + Thu Nov 23 17:52:44 CET 2000 Wichert Akkerman * lib/fields.c, lib/dump.c: fix two memory leaks diff --git a/lib/myopt.c b/lib/myopt.c index bbfe0246..90e66284 100644 --- a/lib/myopt.c +++ b/lib/myopt.c @@ -41,9 +41,11 @@ void myfileopt(const char* fn, const struct cmdinfo* cmdinfos) { while (fgets(linebuf, sizeof(linebuf), file)) { char* opt; const struct cmdinfo *cip; + int l; if ((linebuf[0]=='#') || (linebuf[0]=='\n') || (linebuf[0]==0)) continue; - linebuf[strlen(linebuf)-1]=0; + l=strlen(linebuf); + if (linebuf[l-1]=='\n') linebuf[l-1]=0; for (opt=linebuf;isalnum(*opt)||*opt=='-';opt++) ; if (*opt==0) opt=NULL; -- 2.39.5