mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 12:20:26 +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
08f489c98b
commit
d9c36d2a6f
2 changed files with 13 additions and 3 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2005-12-07 Marius Vollmer <mvo@zagadka.de>
|
||||||
|
|
||||||
|
From Andy Wingo.
|
||||||
|
|
||||||
|
* script.c (scm_find_executable): Compile fix -- fgetc returns an
|
||||||
|
unsigned char cast to an int, or -1 for EOS.
|
||||||
|
|
||||||
2005-12-06 Marius Vollmer <mvo@zagadka.de>
|
2005-12-06 Marius Vollmer <mvo@zagadka.de>
|
||||||
|
|
||||||
* srfi-4.h, srfi-4.c, srfi-4.i.c (take_uvec): Make BASE pointer
|
* srfi-4.h, srfi-4.c, srfi-4.i.c (take_uvec): Make BASE pointer
|
||||||
|
|
|
@ -120,7 +120,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); */
|
||||||
|
@ -132,16 +132,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