From c5bf0eb2d41b437999394486dc4d7eace5dc0c27 Mon Sep 17 00:00:00 2001 From: Steve Bennett Date: Sun, 24 Jan 2010 11:32:03 +1000 Subject: Bug fixes, documentation updates jimsh - retry on EINTR from fgets() Fix 0 -> NULL for 64 bit systems Fix overlapping memcpy Fix jim array dereferencing bug *: Counting of parentheses was incorrect with nested array references *: The result for array dereference wasn't being used properly Add os.uptime command Documentation: autogenerated command index Fix gets when last line has no newline --- jim-aio.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'jim-aio.c') diff --git a/jim-aio.c b/jim-aio.c index 0fb5e75..ef69337 100644 --- a/jim-aio.c +++ b/jim-aio.c @@ -203,8 +203,12 @@ static int aio_cmd_gets(Jim_Interp *interp, int argc, Jim_Obj *const *argv) if (more) { Jim_AppendString(interp, objPtr, buf, AIO_BUF_LEN-1); } else { - /* strip "\n" */ - Jim_AppendString(interp, objPtr, buf, strlen(buf)-1); + int len = strlen(buf); + if (len) { + int hasnl = (buf[len - 1] == '\n'); + /* strip "\n" */ + Jim_AppendString(interp, objPtr, buf, strlen(buf) - hasnl); + } } if (!more) break; -- cgit v1.1