From 0e6678e5e13da6f0ba10bac1e3412c620e19bc53 Mon Sep 17 00:00:00 2001 From: ballen4705 <ballen4705@4ea69e1a-61f1-4043-bf83-b5c94c648137> Date: Sat, 26 Oct 2002 09:58:05 +0000 Subject: [PATCH] Added newline warning for lines that just exceed max length by 1 git-svn-id: https://smartmontools.svn.sourceforge.net/svnroot/smartmontools/trunk@139 4ea69e1a-61f1-4043-bf83-b5c94c648137 --- sm5/smartd.c | 11 ++++++++--- sm5/smartd.cpp | 11 ++++++++--- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/sm5/smartd.c b/sm5/smartd.c index 1e041e38b..6680421c6 100644 --- a/sm5/smartd.c +++ b/sm5/smartd.c @@ -39,7 +39,7 @@ // CVS ID strings extern const char *CVSid1, *CVSid2; -const char *CVSid3="$Id: smartd.c,v 1.33 2002/10/26 09:38:26 ballen4705 Exp $" +const char *CVSid3="$Id: smartd.c,v 1.34 2002/10/26 09:58:05 ballen4705 Exp $" CVSID1 CVSID4 CVSID7; // This function prints either to stdout or to the syslog as needed @@ -509,8 +509,13 @@ int parseconfigfile(){ // See if line is too long len=strlen(line); if (len>MAXLINELEN){ - printout(LOG_CRIT,"Error: line %d of file %s is more than than %d characters long.\n", - lineno,CONFIGFILE,MAXLINELEN); + char *warn; + if (line[len-1]=='\n') + warn="(including newline!) "; + else + warn=""; + printout(LOG_CRIT,"Error: line %d of file %s %sis more than than %d characters long.\n", + lineno,CONFIGFILE,warn,MAXLINELEN); exit(1); } diff --git a/sm5/smartd.cpp b/sm5/smartd.cpp index 5651802da..c9b16d763 100644 --- a/sm5/smartd.cpp +++ b/sm5/smartd.cpp @@ -39,7 +39,7 @@ // CVS ID strings extern const char *CVSid1, *CVSid2; -const char *CVSid3="$Id: smartd.cpp,v 1.33 2002/10/26 09:38:26 ballen4705 Exp $" +const char *CVSid3="$Id: smartd.cpp,v 1.34 2002/10/26 09:58:05 ballen4705 Exp $" CVSID1 CVSID4 CVSID7; // This function prints either to stdout or to the syslog as needed @@ -509,8 +509,13 @@ int parseconfigfile(){ // See if line is too long len=strlen(line); if (len>MAXLINELEN){ - printout(LOG_CRIT,"Error: line %d of file %s is more than than %d characters long.\n", - lineno,CONFIGFILE,MAXLINELEN); + char *warn; + if (line[len-1]=='\n') + warn="(including newline!) "; + else + warn=""; + printout(LOG_CRIT,"Error: line %d of file %s %sis more than than %d characters long.\n", + lineno,CONFIGFILE,warn,MAXLINELEN); exit(1); } -- GitLab