ref: 1349c9f1b440a812228766fa193dc130c23c268f
parent: 88c39cb9f5e6969d77a6ec63abae3b7e83077364
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Tue May 19 14:07:46 EDT 2020
9gc: exit when stdin is broken; print \r before every message is sent
--- a/9gc.c
+++ b/9gc.c
@@ -352,10 +352,13 @@
for (;;) {
if ((n = read(0, s+sz, sizeof(a->rdbuf)-sz)) > 0)
sz += n;
+ else
+ exit(0);
if (s[sz-1] != '\n'){
s[sz-1] = '\n';
}else{
c9write(ctx, &tag, Chatfid, 0, s, sz);
+ write(1, "\r", 1);
break;
}
}