aboutsummaryrefslogtreecommitdiff
path: root/jim-aio.c
diff options
context:
space:
mode:
authorSteve Bennett <steveb@workware.net.au>2010-01-24 11:32:03 +1000
committerSteve Bennett <steveb@workware.net.au>2010-10-15 11:02:41 +1000
commitc5bf0eb2d41b437999394486dc4d7eace5dc0c27 (patch)
tree25a42d2f8a8e2419be8503c2fece94ff917e7a9d /jim-aio.c
parentb0950211281e786a633692eee2a4096e8457ed82 (diff)
downloadjimtcl-c5bf0eb2d41b437999394486dc4d7eace5dc0c27.zip
jimtcl-c5bf0eb2d41b437999394486dc4d7eace5dc0c27.tar.gz
jimtcl-c5bf0eb2d41b437999394486dc4d7eace5dc0c27.tar.bz2
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
Diffstat (limited to 'jim-aio.c')
-rw-r--r--jim-aio.c8
1 files changed, 6 insertions, 2 deletions
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;