summaryrefslogtreecommitdiffhomepage
path: root/mixlib
diff options
context:
space:
mode:
authorJose Antonio Ortega Ruiz <jao@gnu.org>2004-06-10 20:40:46 +0000
committerJose Antonio Ortega Ruiz <jao@gnu.org>2004-06-10 20:40:46 +0000
commit7730d8d95c6e8649effed055e6f5747cf208cef0 (patch)
treed54e7b06751a8a03096c1567a7dabff246edda36 /mixlib
parent7c8b9f2999f95934f1f9e3d21ff29f8ea28003df (diff)
downloadmdk-7730d8d95c6e8649effed055e6f5747cf208cef0.tar.gz
mdk-7730d8d95c6e8649effed055e6f5747cf208cef0.tar.bz2
allow truncated lines in char input device files.
Diffstat (limited to 'mixlib')
-rw-r--r--mixlib/mix_io.c11
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;