diff options
author | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2004-06-10 20:40:46 +0000 |
---|---|---|
committer | Jose Antonio Ortega Ruiz <jao@gnu.org> | 2004-06-10 20:40:46 +0000 |
commit | 7e0800a701d47969e95cc7fd8201d5eff86892fa (patch) | |
tree | e86f19b494fca59b38cbc4d92b3c97dea24e2fe3 /mixlib | |
parent | 4c8a805561b11dfde31e7d5c43de330876612cdd (diff) | |
download | mdk-7e0800a701d47969e95cc7fd8201d5eff86892fa.tar.gz mdk-7e0800a701d47969e95cc7fd8201d5eff86892fa.tar.bz2 |
allow truncated lines in char input device files.
Diffstat (limited to 'mixlib')
-rw-r--r-- | mixlib/mix_io.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mixlib/mix_io.c b/mixlib/mix_io.c index 74cca66..893449c 100644 --- a/mixlib/mix_io.c +++ b/mixlib/mix_io.c @@ -166,17 +166,20 @@ mix_io_write_word_array_as_char (mix_iochannel_t *ioc, const mix_word_t *w, size_t s) { guint k, j; + guchar value; if ((ioc == NULL) || (w == NULL)) return FALSE; + printf ("->\n"); for (k = 0; k < s; k++) for (j = 1; j < 6; j++) { - mix_char_t ch = mix_word_get_byte (w[k], j); - guchar value = mix_char_to_ascii (ch); + mix_char_t ch = mix_byte_to_char (mix_word_get_byte (w[k], j)); + value = mix_char_to_ascii (ch); if (!write_data_ (ioc, &value, 1)) return FALSE; } - return TRUE; + value = '\n'; + return write_data_ (ioc, &value, 1); } gboolean @@ -194,7 +197,7 @@ mix_io_read_word_array_as_char (mix_iochannel_t *ioc, for (j = 1; j < 6; j++) { if (!eol && !read_data_ (ioc, &value, 1)) return FALSE; - eol = eol || (value == '\n'); + eol = eol || (value == '\n') || (value == EOF); mix_word_set_byte (&w[k], j, eol? spc : mix_ascii_to_char (value)); } for (; k < s; ++k) w[k] = MIX_WORD_ZERO; |