1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-05 01:00:21 +02:00

(scm_find_executable): Compile fix -- fgetc returns an

unsigned char cast to an int, or -1 for EOS.
This commit is contained in:
Marius Vollmer 2005-12-06 22:57:42 +00:00
parent 2b8af56a53
commit 804fa981ae

View file

@ -141,7 +141,7 @@ char *
scm_find_executable (const char *name)
{
char tbuf[MAXPATHLEN];
int i = 0;
int i = 0, c;
FILE *f;
/* fprintf(stderr, "s_f_e checking access %s ->%d\n", name, access(name, X_OK)); fflush(stderr); */
@ -153,16 +153,19 @@ scm_find_executable (const char *name)
if ((fgetc (f) == '#') && (fgetc (f) == '!'))
{
while (1)
switch (tbuf[i++] = fgetc (f))
switch (c = fgetc (f))
{
case /*WHITE_SPACES */ ' ':
case '\t':
case '\r':
case '\f':
case EOF:
tbuf[--i] = 0;
tbuf[i] = 0;
fclose (f);
return scm_cat_path (0L, tbuf, 0L);
default:
tbuf[i++] = c;
break;
}
}
fclose (f);