to match a filename should be performed. */
char *
quote_string_for_globbing (pathname, qflags)
- char *pathname;
+ const char *pathname;
int qflags;
{
char *temp;
for (i = j = 0; pathname[i]; i++)
{
if (pathname[i] == CTLESC)
- {
- if ((qflags & QGLOB_FILENAME) && pathname[i+1] == '/')
- continue;
+ {
+ if ((qflags & QGLOB_FILENAME) && pathname[i+1] == '/')
+ continue;
temp[j++] = '\\';
- }
+ }
else
- temp[j++] = pathname[i];
+ temp[j++] = pathname[i];
}
temp[j] = '\0';
for (t = temp, s = string; *s; )
{
switch (*s)
- {
- case '*':
- case '[':
- case ']':
- case '?':
- case '\\':
- *t++ = '\\';
- break;
- case '+':
- case '@':
- case '!':
+ {
+ case '*':
+ case '[':
+ case ']':
+ case '?':
+ case '\\':
+ *t++ = '\\';
+ break;
+ case '+':
+ case '@':
+ case '!':
if (s[1] == '(') /*(*/
*t++ = '\\';
break;
- }
+ }
*t++ = *s++;
}
*t = '\0';
/* Call the glob library to do globbing on PATHNAME. */
char **
shell_glob_filename (pathname)
- char *pathname;
+ const char *pathname;
{
#if defined (USE_POSIX_GLOB_LIBRARY)
register int i;
- char *temp, **return_value;
+ char *temp, **results;
glob_t filenames;
int glob_flags;
free (temp);
- if (i == GLOB_NOSPACE || i == GLOB_ABEND)
+ if (i == GLOB_NOSPACE || i == GLOB_ABORTED)
return ((char **)NULL);
else if (i == GLOB_NOMATCH)
filenames.gl_pathv = (char **)NULL;
for (p = globignore.ignores; p->val; p++)
{
if (fnmatch (p->val, name, flags) != FNM_NOMATCH)
- return (0);
+ return (0);
}
return (1);
}
for (n = i = 0; names[i]; i++)
{
if ((*name_func) (names[i]))
- newnames[n++] = names[i];
+ newnames[n++] = names[i];
else
free (names[i]);
}
ivp->ignores[numitems].len = strlen (colon_bit);
ivp->ignores[numitems].flags = 0;
if (ivp->item_func)
- (*ivp->item_func) (&ivp->ignores[numitems]);
+ (*ivp->item_func) (&ivp->ignores[numitems]);
numitems++;
}
ivp->ignores[numitems].val = (char *)NULL;