summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-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;