1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-20 11:40:18 +02:00

* filesys.c (scm_stat): stat now takes fport arguments too as

documented in the manual.
This commit is contained in:
Mikael Djurfeldt 1997-03-04 18:54:52 +00:00
parent 2c4bd736ca
commit c0ebd8c5a8
2 changed files with 26 additions and 15 deletions

View file

@ -1,3 +1,13 @@
Tue Mar 4 19:50:07 1997 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
* filesys.c (scm_stat): stat now takes fport arguments too as
documented in the manual.
Mon Mar 3 07:11:33 1997 Mikael Djurfeldt <mdj@mdj.nada.kth.se>
* debug.c (scm_single_step): Bugfix: Call continuation with
scm_call_continuation instead of throwing to it.
Mon Mar 3 09:07:56 1997 Gary Houston <ghouston@actrix.gen.nz> Mon Mar 3 09:07:56 1997 Gary Houston <ghouston@actrix.gen.nz>
* ports.c (scm_char_ready_p): bug fix: in SCM_PROC char-ready's * ports.c (scm_char_ready_p): bug fix: in SCM_PROC char-ready's

View file

@ -361,28 +361,29 @@ scm_stat2scm (stat_temp)
SCM_PROC (s_stat, "stat", 1, 0, 0, scm_stat); SCM_PROC (s_stat, "stat", 1, 0, 0, scm_stat);
SCM SCM
scm_stat (fd_or_path) scm_stat (file)
SCM fd_or_path; SCM file;
{ {
int rv = 1; int rv = 1;
struct stat stat_temp; struct stat stat_temp;
if (SCM_INUMP (fd_or_path)) if (SCM_INUMP (file))
{ SCM_SYSCALL (rv = fstat (SCM_INUM (file), &stat_temp));
rv = SCM_INUM (fd_or_path);
SCM_SYSCALL (rv = fstat (rv, &stat_temp));
}
else else
{ {
SCM_ASSERT (SCM_NIMP (fd_or_path), fd_or_path, SCM_ARG1, s_stat); SCM_ASSERT (SCM_NIMP (file), file, SCM_ARG1, s_stat);
SCM_ASSERT (SCM_ROSTRINGP (fd_or_path), fd_or_path, SCM_ARG1, s_stat); if (SCM_FPORTP (file))
if (SCM_ROSTRINGP (fd_or_path)) SCM_SYSCALL (rv = fstat (fileno ((FILE *) SCM_STREAM (file)),
&stat_temp));
else
{ {
if (SCM_SUBSTRP (fd_or_path)) SCM_ASSERT (SCM_ROSTRINGP (file), file, SCM_ARG1, s_stat);
fd_or_path = scm_makfromstr (SCM_ROCHARS (fd_or_path), SCM_ROLENGTH (fd_or_path), 0); if (SCM_SUBSTRP (file))
SCM_SYSCALL (rv = stat (SCM_CHARS (fd_or_path), &stat_temp)); file = scm_makfromstr (SCM_ROCHARS (file),
SCM_ROLENGTH (file),
0);
SCM_SYSCALL (rv = stat (SCM_CHARS (file), &stat_temp));
} }
} }
if (rv != 0) if (rv != 0)
{ {
@ -390,7 +391,7 @@ scm_stat (fd_or_path)
scm_syserror_msg (s_stat, "%s: %S", scm_syserror_msg (s_stat, "%s: %S",
scm_listify (scm_makfrom0str (strerror (errno)), scm_listify (scm_makfrom0str (strerror (errno)),
fd_or_path, file,
SCM_UNDEFINED), SCM_UNDEFINED),
en); en);
} }