diff options
author | Andy Wingo <wingo@pobox.com> | 2011-03-11 20:53:13 +0100 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2011-03-11 20:53:13 +0100 |
commit | bfb85df7084e26a276142cdc62315a85c7a0ba20 (patch) | |
tree | 532a25e30af0cd724a7ebeb92592395021ef87a2 /libguile/init.c | |
parent | 06fc34c23f2c6987ba1dc8cbf5a084ff24a83e53 (diff) | |
download | guile-bfb85df7084e26a276142cdc62315a85c7a0ba20.tar.gz |
fix port-filename without readline to match the docs
* libguile/init.c (stream_body, scm_standard_stream_to_port): Don't name
stdin, stdout, and stderr -- at least not as strings. That confuses
any code which tries to treat port-filename as a real filename, like
the syntax expander, or the `load' procedure/macro. Also this
behavior matches the docs now.
Diffstat (limited to 'libguile/init.c')
-rw-r--r-- | libguile/init.c | 20 |
1 files changed, 5 insertions, 15 deletions
diff --git a/libguile/init.c b/libguile/init.c index 9b8c4d086..d6a710504 100644 --- a/libguile/init.c +++ b/libguile/init.c @@ -157,7 +157,6 @@ typedef struct { int fdes; char *mode; - char *name; } stream_body_data; /* proc to be called in scope of exception handler stream_handler. */ @@ -165,8 +164,7 @@ static SCM stream_body (void *data) { stream_body_data *body_data = (stream_body_data *) data; - SCM port = scm_fdes_to_port (body_data->fdes, body_data->mode, - scm_from_locale_string (body_data->name)); + SCM port = scm_fdes_to_port (body_data->fdes, body_data->mode, SCM_BOOL_F); SCM_REVEALED (port) = 1; return port; @@ -182,21 +180,19 @@ stream_handler (void *data SCM_UNUSED, } /* Convert a file descriptor to a port, using scm_fdes_to_port. - - NAME is a C string, not a Guile string - set the revealed count for FILE's file descriptor to 1, so that fdes won't be closed when the port object is GC'd. - catch exceptions: allow Guile to be able to start up even if it has been handed bogus stdin/stdout/stderr. replace the bad ports with void ports. */ static SCM -scm_standard_stream_to_port (int fdes, char *mode, char *name) +scm_standard_stream_to_port (int fdes, char *mode) { SCM port; stream_body_data body_data; body_data.fdes = fdes; body_data.mode = mode; - body_data.name = name; port = scm_internal_catch (SCM_BOOL_T, stream_body, &body_data, stream_handler, NULL); if (scm_is_false (port)) @@ -223,17 +219,11 @@ scm_init_standard_ports () block buffering for higher performance. */ scm_set_current_input_port - (scm_standard_stream_to_port (0, - isatty (0) ? "r0" : "r", - "standard input")); + (scm_standard_stream_to_port (0, isatty (0) ? "r0" : "r")); scm_set_current_output_port - (scm_standard_stream_to_port (1, - isatty (1) ? "w0" : "w", - "standard output")); + (scm_standard_stream_to_port (1, isatty (1) ? "w0" : "w")); scm_set_current_error_port - (scm_standard_stream_to_port (2, - isatty (2) ? "w0" : "w", - "standard error")); + (scm_standard_stream_to_port (2, isatty (2) ? "w0" : "w")); } |