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

Collapse All | Expand All

(-)script.c (+30 lines)
Lines 428-433 Link Here
428
} while (0/*CONSTCOND*/)
428
} while (0/*CONSTCOND*/)
429
429
430
static void
430
static void
431
termset(void)
432
{
433
	struct termios traw;
434
435
	if (tcgetattr(STDOUT_FILENO, &tt) == -1) {
436
		if (errno == EBADF)
437
			err(1, "%d not valid fd", STDOUT_FILENO);
438
		/* errno == ENOTTY */
439
		return;
440
	}
441
	ttyflg = 1;
442
	traw = tt;
443
	cfmakeraw(&traw);
444
	traw.c_lflag |= ISIG;
445
        (void)tcsetattr(STDOUT_FILENO, TCSANOW, &traw);
446
}
447
448
static void
449
termreset(void)
450
{
451
	if (ttyflg)
452
		tcsetattr(STDOUT_FILENO, TCSADRAIN, &tt);
453
454
	ttyflg = 0;
455
}
456
457
static void
431
playback(FILE *fp)
458
playback(FILE *fp)
432
{
459
{
433
	struct timespec tsi, tso;
460
	struct timespec tsi, tso;
Lines 470-477 Link Here
470
				ctime(&tclock));
497
				ctime(&tclock));
471
			tsi = tso;
498
			tsi = tso;
472
			(void)consume(fp, stamp.scr_len, buf, reg);
499
			(void)consume(fp, stamp.scr_len, buf, reg);
500
			termset();
501
			atexit(termreset);
473
			break;
502
			break;
474
		case 'e':
503
		case 'e':
504
			termreset();
475
			if (!qflg)
505
			if (!qflg)
476
				(void)printf("\nScript done on %s",
506
				(void)printf("\nScript done on %s",
477
				    ctime(&tclock));
507
				    ctime(&tclock));

Return to bug 248377