version 1.139, 2012/09/21 10:53:07 |
version 1.140, 2012/09/21 10:55:04 |
|
|
{ |
{ |
glob_t g; |
glob_t g; |
char *tmp, *tmp2, ins[3]; |
char *tmp, *tmp2, ins[3]; |
u_int i, hadglob, pwdlen, len, tmplen, filelen, isabs; |
u_int i, hadglob, pwdlen, len, tmplen, filelen, cesc, isesc, isabs; |
const LineInfo *lf; |
const LineInfo *lf; |
|
|
/* Glob from "file" location */ |
/* Glob from "file" location */ |
|
|
tmplen = strlen(tmp); |
tmplen = strlen(tmp); |
filelen = strlen(file); |
filelen = strlen(file); |
|
|
if (tmplen > filelen) { |
/* Count the number of escaped characters in the input string. */ |
tmp2 = tmp + filelen; |
cesc = isesc = 0; |
|
for (i = 0; i < filelen; i++) { |
|
if (!isesc && file[i] == '\\' && i + 1 < filelen){ |
|
isesc = 1; |
|
cesc++; |
|
} else |
|
isesc = 0; |
|
} |
|
|
|
if (tmplen > (filelen - cesc)) { |
|
tmp2 = tmp + filelen - cesc; |
len = strlen(tmp2); |
len = strlen(tmp2); |
/* quote argument on way out */ |
/* quote argument on way out */ |
for (i = 0; i < len; i++) { |
for (i = 0; i < len; i++) { |
|
|
case '\t': |
case '\t': |
case '[': |
case '[': |
case ' ': |
case ' ': |
|
case '#': |
|
case '*': |
if (quote == '\0' || tmp2[i] == quote) { |
if (quote == '\0' || tmp2[i] == quote) { |
if (el_insertstr(el, ins) == -1) |
if (el_insertstr(el, ins) == -1) |
fatal("el_insertstr " |
fatal("el_insertstr " |