-
-/* Internal function: Stuff to do upon closing any type of stream. */
-void
-stream_close_common(strid_t str, stream_result_t *result)
-{
- /* Remove the stream from the global stream list */
- glk_data->stream_list = g_list_delete_link(glk_data->stream_list, str->stream_list);
-
- /* If it was the current output stream, set that to NULL */
- if(glk_data->current_stream == str)
- glk_data->current_stream = NULL;
-
- /* If it was one or more windows' echo streams, set those to NULL */
- winid_t win;
- for(win = glk_window_iterate(NULL, NULL); win;
- win = glk_window_iterate(win, NULL))
- if(win->echo_stream == str)
- win->echo_stream = NULL;
-
- /* Return the character counts */
- if(result)
- {
- result->readcount = str->read_count;
- result->writecount = str->write_count;
- }
-
- str->magic = MAGIC_FREE;
- g_free(str);
-}
-
-strid_t
-glkunix_stream_open_pathname(char *pathname, glui32 usage, glui32 rock)
-{
- printf("making new fileref: %s\n", pathname);
- frefid_t fileref = fileref_new(pathname, rock, usage, filemode_ReadWrite);
- printf("makeing new stream:\n");
- return file_stream_new(fileref, filemode_ReadWrite, rock, FALSE);
-}