Copyright (C) 1991, 1992 Ian Lance Taylor
This file is part of the Taylor UUCP package.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2 of the
License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
The author of the program may be contacted at ian@airs.com or
c/o Infinity Development Systems, P.O. Box 520, Waltham, MA 02254.
#if HAVE_GLOB && ! HAVE_GLOB_H
/* Local variables to hold the wildcard in progress. */
static char *zSwildcard_alloc
;
/* Start getting a wildcarded file spec. Use the glob function if it
is available, and otherwise use the shell. */
fsysdep_wildcard_start (zfile
)
ulog (LOG_FATAL
, "fsysdep_wildcard: %s: Can't happen", zfile
);
if (glob (zfile
, 0, (int (*) ()) NULL
, &sSglob
) != 0)
ulog (LOG_FATAL
, "fsysdep_wildcard: %s: Can't happen", zfile
);
zcmd
= zbufalc (sizeof ECHO_PROGRAM
+ sizeof " " + 2 * strlen (zfile
));
memcpy (zcmd
, ECHO_PROGRAM
, sizeof ECHO_PROGRAM
- 1);
zto
= zcmd
+ sizeof ECHO_PROGRAM
- 1;
/* To avoid shell trickery, we quote all characters except
letters, digits, and wildcard specifiers. We don't quote '/'
to avoid an Ultrix sh bug. */
e
= espopen (azargs
, TRUE
, &ipid
);
ulog (LOG_ERROR
, "espopen: %s", strerror (errno
));
if (getline (&zSwildcard_alloc
, &c
, e
) <= 0)
xfree ((pointer
) zSwildcard_alloc
);
if (ixswait ((unsigned long) ipid
, ECHO_PROGRAM
) != 0)
xfree ((pointer
) zSwildcard_alloc
);
if (zSwildcard_alloc
== NULL
)
DEBUG_MESSAGE1 (DEBUG_EXECUTE
,
"fsysdep_wildcard_start: got \"%s\"",
zSwildcard
= zSwildcard_alloc
;
/* Get the next wildcard spec. */
if (iSglob
>= sSglob
.gl_pathc
)
zret
= zbufcpy (sSglob
.gl_pathv
[iSglob
]);
if (zSwildcard_alloc
== NULL
|| zSwildcard
== NULL
)
while (*zSwildcard
!= '\0' && ! isspace (BUCHAR (*zSwildcard
)))
while (*zSwildcard
!= '\0' && isspace (BUCHAR (*zSwildcard
)))
/* Finish up getting wildcard specs. */
xfree ((pointer
) zSwildcard_alloc
);