Make test stripping locale independent
This commit is contained in:
parent
353b5e08ba
commit
2637faa450
@ -24,6 +24,8 @@
|
|||||||
#include <fcntl.h> /* for _O_BINARY */
|
#include <fcntl.h> /* for _O_BINARY */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define l_isspace(c) ((c) == ' ' || (c) == '\n' || (c) == '\r' || (c) == '\t')
|
||||||
|
|
||||||
static int getenv_int(const char *name)
|
static int getenv_int(const char *name)
|
||||||
{
|
{
|
||||||
char *value, *end;
|
char *value, *end;
|
||||||
@ -47,14 +49,14 @@ static const char *strip(char *str)
|
|||||||
{
|
{
|
||||||
size_t length;
|
size_t length;
|
||||||
char *result = str;
|
char *result = str;
|
||||||
while(*result && isspace(*result))
|
while(*result && l_isspace(*result))
|
||||||
result++;
|
result++;
|
||||||
|
|
||||||
length = strlen(result);
|
length = strlen(result);
|
||||||
if(length == 0)
|
if(length == 0)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
while(isspace(result[length - 1]))
|
while(l_isspace(result[length - 1]))
|
||||||
result[--length] = '\0';
|
result[--length] = '\0';
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user