mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-07-05 17:20:18 +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:
parent
2b8af56a53
commit
804fa981ae
1 changed files with 6 additions and 3 deletions
|
@ -141,7 +141,7 @@ char *
|
||||||
scm_find_executable (const char *name)
|
scm_find_executable (const char *name)
|
||||||
{
|
{
|
||||||
char tbuf[MAXPATHLEN];
|
char tbuf[MAXPATHLEN];
|
||||||
int i = 0;
|
int i = 0, c;
|
||||||
FILE *f;
|
FILE *f;
|
||||||
|
|
||||||
/* fprintf(stderr, "s_f_e checking access %s ->%d\n", name, access(name, X_OK)); fflush(stderr); */
|
/* 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) == '!'))
|
if ((fgetc (f) == '#') && (fgetc (f) == '!'))
|
||||||
{
|
{
|
||||||
while (1)
|
while (1)
|
||||||
switch (tbuf[i++] = fgetc (f))
|
switch (c = fgetc (f))
|
||||||
{
|
{
|
||||||
case /*WHITE_SPACES */ ' ':
|
case /*WHITE_SPACES */ ' ':
|
||||||
case '\t':
|
case '\t':
|
||||||
case '\r':
|
case '\r':
|
||||||
case '\f':
|
case '\f':
|
||||||
case EOF:
|
case EOF:
|
||||||
tbuf[--i] = 0;
|
tbuf[i] = 0;
|
||||||
fclose (f);
|
fclose (f);
|
||||||
return scm_cat_path (0L, tbuf, 0L);
|
return scm_cat_path (0L, tbuf, 0L);
|
||||||
|
default:
|
||||||
|
tbuf[i++] = c;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fclose (f);
|
fclose (f);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue