mirror of
https://github.com/osmarks/ngircd.git
synced 2024-10-28 04:46:17 +00:00
Fix up ngt_TrimStr() once more ... :-/
This commit is contained in:
parent
c7bd9da446
commit
097c7bd741
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "portab.h"
|
#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 "imp.h"
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -40,18 +40,20 @@ ngt_TrimStr(char *String)
|
|||||||
start = String;
|
start = String;
|
||||||
|
|
||||||
/* Remove whitespaces at the beginning of the string ... */
|
/* Remove whitespaces at the beginning of the string ... */
|
||||||
while (*start == ' ' || *start == '\t')
|
while (*start == ' ' || *start == '\t' ||
|
||||||
|
*start == '\n' || *start == '\r')
|
||||||
start++;
|
start++;
|
||||||
|
|
||||||
if (!*start) {
|
if (!*start) {
|
||||||
*String = 0;
|
*String = '\0';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ... and at the end: */
|
/* ... and at the end: */
|
||||||
end = strchr(start, '\0');
|
end = strchr(start, '\0');
|
||||||
end--;
|
end--;
|
||||||
while ((*end == ' ' || *end == '\t' || *end == '\n' || *end == '\r')
|
while ((*end == ' ' || *end == '\t' || *end == '\n' || *end == '\r')
|
||||||
&& end > start)
|
&& end >= start)
|
||||||
end--;
|
end--;
|
||||||
|
|
||||||
/* New trailing NULL byte */
|
/* New trailing NULL byte */
|
||||||
|
Loading…
Reference in New Issue
Block a user