View | Details | Raw Unified | Return to bug 169773 | Differences between
and this patch

Collapse All | Expand All

(-)b/lib/libedit/read.c (-7 / +11 lines)
Lines 238-245 read_getcmd(EditLine *el, el_action_t *cmdnum, char *ch) Link Here
238
	el->el_errno = 0;
238
	el->el_errno = 0;
239
	do {
239
	do {
240
		if ((num = el_getc(el, ch)) != 1) {	/* if EOF or error */
240
		if ((num = el_getc(el, ch)) != 1) {	/* if EOF or error */
241
			el->el_errno = num == 0 ? 0 : errno;
241
			return (num < 0 ? 1 : 0);
242
			return (num);
243
		}
242
		}
244
243
245
#ifdef	KANJI
244
#ifdef	KANJI
Lines 294-309 read_char(EditLine *el, char *cp) Link Here
294
293
295
 again:
294
 again:
296
	el->el_signal->sig_no = 0;
295
	el->el_signal->sig_no = 0;
297
	while ((num_read = read(el->el_infd, cp, 1)) == -1) {
296
	while ((num_read = read(el->el_infd, cp, 1)) < 0) {
297
		int e = errno;
298
		if (el->el_signal->sig_no == SIGCONT) {
298
		if (el->el_signal->sig_no == SIGCONT) {
299
			sig_set(el);
299
			sig_set(el);
300
			el_set(el, EL_REFRESH);
300
			el_set(el, EL_REFRESH);
301
			goto again;
301
			goto again;
302
		}
302
		}
303
		if (!tried && read__fixio(el->el_infd, errno) == 0)
303
		if (!tried && read__fixio(el->el_infd, e) == 0)
304
			tried = 1;
304
			tried = 1;
305
		else {
305
		else {
306
			*cp = '\0';
306
			*cp = '\0';
307
			errno = e;
307
			return (-1);
308
			return (-1);
308
		}
309
		}
309
	}
310
	}
Lines 369-376 el_getc(EditLine *el, char *cp) Link Here
369
	(void) fprintf(el->el_errfile, "Reading a character\n");
370
	(void) fprintf(el->el_errfile, "Reading a character\n");
370
#endif /* DEBUG_READ */
371
#endif /* DEBUG_READ */
371
	num_read = (*el->el_read.read_char)(el, cp);
372
	num_read = (*el->el_read.read_char)(el, cp);
373
	if (num_read < 0)
374
		el->el_errno = errno;
372
#ifdef DEBUG_READ
375
#ifdef DEBUG_READ
373
	(void) fprintf(el->el_errfile, "Got it %c\n", *cp);
376
	(void) fprintf(el->el_errfile, "Got <%c> (return %d)\n", *cp, num_read);
374
#endif /* DEBUG_READ */
377
#endif /* DEBUG_READ */
375
	return (num_read);
378
	return (num_read);
376
}
379
}
Lines 426-432 el_gets(EditLine *el, int *nread) Link Here
426
		char *cp = el->el_line.buffer;
429
		char *cp = el->el_line.buffer;
427
		size_t idx;
430
		size_t idx;
428
431
429
		while ((*el->el_read.read_char)(el, cp) == 1) {
432
		while ((num = (*el->el_read.read_char)(el, cp)) == 1) {
430
			/* make sure there is space for next character */
433
			/* make sure there is space for next character */
431
			if (cp + 1 >= el->el_line.limit) {
434
			if (cp + 1 >= el->el_line.limit) {
432
				idx = (cp - el->el_line.buffer);
435
				idx = (cp - el->el_line.buffer);
Lines 479-485 el_gets(EditLine *el, int *nread) Link Here
479
482
480
		term__flush(el);
483
		term__flush(el);
481
484
482
		while ((*el->el_read.read_char)(el, cp) == 1) {
485
		while ((num = (*el->el_read.read_char)(el, cp)) == 1) {
483
			/* make sure there is space next character */
486
			/* make sure there is space next character */
484
			if (cp + 1 >= el->el_line.limit) {
487
			if (cp + 1 >= el->el_line.limit) {
485
				idx = (cp - el->el_line.buffer);
488
				idx = (cp - el->el_line.buffer);
Lines 511-516 el_gets(EditLine *el, int *nread) Link Here
511
#endif /* DEBUG_EDIT */
514
#endif /* DEBUG_EDIT */
512
		/* if EOF or error */
515
		/* if EOF or error */
513
		if ((num = read_getcmd(el, &cmdnum, &ch)) != OKCMD) {
516
		if ((num = read_getcmd(el, &cmdnum, &ch)) != OKCMD) {
517
			num = -1;
514
#ifdef DEBUG_READ
518
#ifdef DEBUG_READ
515
			(void) fprintf(el->el_errfile,
519
			(void) fprintf(el->el_errfile,
516
			    "Returning from el_gets %d\n", num);
520
			    "Returning from el_gets %d\n", num);

Return to bug 169773