From c0ebd8c5a8443e41cba8ce0b3f5897b3c2e1f346 Mon Sep 17 00:00:00 2001 From: Mikael Djurfeldt Date: Tue, 4 Mar 1997 18:54:52 +0000 Subject: [PATCH] * filesys.c (scm_stat): stat now takes fport arguments too as documented in the manual. --- libguile/ChangeLog | 10 ++++++++++ libguile/filesys.c | 31 ++++++++++++++++--------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/libguile/ChangeLog b/libguile/ChangeLog index 57c6831f9..95a297dc5 100644 --- a/libguile/ChangeLog +++ b/libguile/ChangeLog @@ -1,3 +1,13 @@ +Tue Mar 4 19:50:07 1997 Mikael Djurfeldt + + * filesys.c (scm_stat): stat now takes fport arguments too as + documented in the manual. + +Mon Mar 3 07:11:33 1997 Mikael Djurfeldt + + * 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 * ports.c (scm_char_ready_p): bug fix: in SCM_PROC char-ready's diff --git a/libguile/filesys.c b/libguile/filesys.c index 88a1e3aea..297e341ed 100644 --- a/libguile/filesys.c +++ b/libguile/filesys.c @@ -361,28 +361,29 @@ scm_stat2scm (stat_temp) SCM_PROC (s_stat, "stat", 1, 0, 0, scm_stat); SCM -scm_stat (fd_or_path) - SCM fd_or_path; +scm_stat (file) + SCM file; { int rv = 1; struct stat stat_temp; - if (SCM_INUMP (fd_or_path)) - { - rv = SCM_INUM (fd_or_path); - SCM_SYSCALL (rv = fstat (rv, &stat_temp)); - } + if (SCM_INUMP (file)) + SCM_SYSCALL (rv = fstat (SCM_INUM (file), &stat_temp)); else { - SCM_ASSERT (SCM_NIMP (fd_or_path), fd_or_path, SCM_ARG1, s_stat); - SCM_ASSERT (SCM_ROSTRINGP (fd_or_path), fd_or_path, SCM_ARG1, s_stat); - if (SCM_ROSTRINGP (fd_or_path)) + SCM_ASSERT (SCM_NIMP (file), file, SCM_ARG1, s_stat); + if (SCM_FPORTP (file)) + SCM_SYSCALL (rv = fstat (fileno ((FILE *) SCM_STREAM (file)), + &stat_temp)); + else { - if (SCM_SUBSTRP (fd_or_path)) - fd_or_path = scm_makfromstr (SCM_ROCHARS (fd_or_path), SCM_ROLENGTH (fd_or_path), 0); - SCM_SYSCALL (rv = stat (SCM_CHARS (fd_or_path), &stat_temp)); + SCM_ASSERT (SCM_ROSTRINGP (file), file, SCM_ARG1, s_stat); + if (SCM_SUBSTRP (file)) + file = scm_makfromstr (SCM_ROCHARS (file), + SCM_ROLENGTH (file), + 0); + SCM_SYSCALL (rv = stat (SCM_CHARS (file), &stat_temp)); } - } if (rv != 0) { @@ -390,7 +391,7 @@ scm_stat (fd_or_path) scm_syserror_msg (s_stat, "%s: %S", scm_listify (scm_makfrom0str (strerror (errno)), - fd_or_path, + file, SCM_UNDEFINED), en); }