about summary refs log tree commit diff
path: root/src/tool/tool.c
diff options
context:
space:
mode:
authorAlexander Barton <alex@barton.de>2006-04-09 12:53:07 +0000
committerAlexander Barton <alex@barton.de>2006-04-09 12:53:07 +0000
commit097c7bd741931bfbb9deef26fca4861b42e3bda6 (patch)
treebca02770d6146b28f70340a1e293889504635878 /src/tool/tool.c
parentc7bd9da4461d502f1114bf52637a596650a72905 (diff)
downloadngircd-097c7bd741931bfbb9deef26fca4861b42e3bda6.tar.gz
ngircd-097c7bd741931bfbb9deef26fca4861b42e3bda6.zip
Fix up ngt_TrimStr() once more ... :-/
Diffstat (limited to 'src/tool/tool.c')
-rw-r--r--src/tool/tool.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/tool/tool.c b/src/tool/tool.c
index 27051ced..01d892fd 100644
--- a/src/tool/tool.c
+++ b/src/tool/tool.c
@@ -14,7 +14,7 @@
 
 #include "portab.h"
 
-static char UNUSED id[] = "$Id: tool.c,v 1.5 2006/03/24 23:25:39 fw Exp $";
+static char UNUSED id[] = "$Id: tool.c,v 1.6 2006/04/09 12:53:07 alex Exp $";
 
 #include "imp.h"
 #include <assert.h>
@@ -40,18 +40,20 @@ ngt_TrimStr(char *String)
 	start = String;
 
 	/* Remove whitespaces at the beginning of the string ... */
-	while (*start == ' ' || *start == '\t')
+	while (*start == ' ' || *start == '\t' ||
+	       *start == '\n' || *start == '\r')
 		start++;
 
 	if (!*start) {
-		*String = 0;
+		*String = '\0';
 		return;
 	}
+
 	/* ... and at the end: */
 	end = strchr(start, '\0');
 	end--;
 	while ((*end == ' ' || *end == '\t' || *end == '\n' || *end == '\r')
-	       && end > start)
+	       && end >= start)
 		end--;
 
 	/* New trailing NULL byte */