comparison main.c @ 580:e9001b0f53bc

applied Jukka's stdinread patch
author arg@mig29
date Sun, 26 Nov 2006 13:31:36 +0100
parents 8cb54d02a5b6
children 601842ee4484
comparison
equal deleted inserted replaced
579:010118c94013 580:e9001b0f53bc
272 continue; 272 continue;
273 else 273 else
274 eprint("select failed\n"); 274 eprint("select failed\n");
275 } 275 }
276 if(FD_ISSET(STDIN_FILENO, &rd)) { 276 if(FD_ISSET(STDIN_FILENO, &rd)) {
277 switch(r = read(STDIN_FILENO, stext, sizeof(stext))) { 277 switch(r = read(STDIN_FILENO, stext, sizeof(stext) - 1)) {
278 case -1: 278 case -1:
279 strncpy(stext, strerror(errno), sizeof(stext)); 279 strncpy(stext, strerror(errno), sizeof(stext));
280 stext[sizeof(stext) - 1] = '\0';
280 readin = False; 281 readin = False;
281 break; 282 break;
282 case 0: 283 case 0:
283 strncpy(stext, "EOF", sizeof(stext)); 284 strncpy(stext, "EOF", sizeof(stext));
284 readin = False; 285 readin = False;
285 break; 286 break;
286 default: 287 default:
287 stext[r-1] = 0; 288 stext[r - (stext[r - 1] == '\n' ? 1 : 0)] = '\0';
288 } 289 }
289 drawstatus(); 290 drawstatus();
290 } 291 }
291 if(FD_ISSET(xfd, &rd)) 292 if(FD_ISSET(xfd, &rd))
292 procevent(); 293 procevent();