678 |
return o; |
return o; |
679 |
} |
} |
680 |
|
|
681 |
|
/* Set begpp to point to the first non-whitespace character of the string, |
682 |
|
* and endpp to point to the last non-whitespace character of the string. |
683 |
|
* If the string is empty or contains nothing but whitespace, endpp will be |
684 |
|
* begpp-1. |
685 |
|
*/ |
686 |
static char * |
static char * |
687 |
strip_whitespace (const char **begpp, const char **endpp) |
strip_whitespace (const char **begpp, const char **endpp) |
688 |
{ |
{ |
1139 |
func_if (char *o, char **argv, const char *funcname) |
func_if (char *o, char **argv, const char *funcname) |
1140 |
{ |
{ |
1141 |
const char *begp = argv[0]; |
const char *begp = argv[0]; |
1142 |
const char *endp = begp + strlen (argv[0]); |
const char *endp = begp + strlen (argv[0]) - 1; |
1143 |
int result = 0; |
int result = 0; |
1144 |
|
|
1145 |
/* Find the result of the condition: if we have a value, and it's not |
/* Find the result of the condition: if we have a value, and it's not |
1148 |
|
|
1149 |
strip_whitespace (&begp, &endp); |
strip_whitespace (&begp, &endp); |
1150 |
|
|
1151 |
if (begp < endp) |
if (begp <= endp) |
1152 |
{ |
{ |
1153 |
char *expansion = expand_argument (begp, NULL); |
char *expansion = expand_argument (begp, endp+1); |
1154 |
|
|
1155 |
result = strlen (expansion); |
result = strlen (expansion); |
1156 |
free (expansion); |
free (expansion); |