View | Details | Raw Unified | Return to bug 94052
Collapse All | Expand All

(-)script/script.1 (+3 lines)
Lines 80-85 Link Here
80
Log keys sent to program as well as output.
80
Log keys sent to program as well as output.
81
.It Fl q
81
.It Fl q
82
Run in quiet mode, omit the start and stop status messages.
82
Run in quiet mode, omit the start and stop status messages.
83
.It Fl c
84
Collape carriage-return/newline sequences into single newlines when writing
85
data to log file.
83
.It Fl t Ar time
86
.It Fl t Ar time
84
Specify time interval between flushing script output file.
87
Specify time interval between flushing script output file.
85
A value of 0
88
A value of 0
(-)script/script.c (-4 / +19 lines)
Lines 81-99 Link Here
81
int
81
int
82
main(int argc, char *argv[])
82
main(int argc, char *argv[])
83
{
83
{
84
	int cc;
84
	int cc, ccount;
85
	struct termios rtt, stt;
85
	struct termios rtt, stt;
86
	struct winsize win;
86
	struct winsize win;
87
	int aflg, kflg, ch, n;
87
	int aflg, kflg, cflg, ch, n;
88
	struct timeval tv, *tvp;
88
	struct timeval tv, *tvp;
89
	time_t tvec, start;
89
	time_t tvec, start;
90
	char *ptr;
90
	char obuf[BUFSIZ];
91
	char obuf[BUFSIZ];
91
	char ibuf[BUFSIZ];
92
	char ibuf[BUFSIZ];
92
	fd_set rfd;
93
	fd_set rfd;
93
	int flushtime = 30;
94
	int flushtime = 30;
94
95
95
	aflg = kflg = 0;
96
	aflg = kflg = cflg = 0;
96
	while ((ch = getopt(argc, argv, "aqkt:")) != -1)
97
	while ((ch = getopt(argc, argv, "aqkct:")) != -1)
97
		switch(ch) {
98
		switch(ch) {
98
		case 'a':
99
		case 'a':
99
			aflg = 1;
100
			aflg = 1;
Lines 104-109 Link Here
104
		case 'k':
105
		case 'k':
105
			kflg = 1;
106
			kflg = 1;
106
			break;
107
			break;
108
		case 'c':
109
			cflg = 1;
110
			break;
107
		case 't':
111
		case 't':
108
			flushtime = atoi(optarg);
112
			flushtime = atoi(optarg);
109
			if (flushtime < 0)
113
			if (flushtime < 0)
Lines 195-200 Link Here
195
			if (cc <= 0)
199
			if (cc <= 0)
196
				break;
200
				break;
197
			(void)write(STDOUT_FILENO, obuf, cc);
201
			(void)write(STDOUT_FILENO, obuf, cc);
202
203
			/* 
204
			* Suppress carriage-returns if cflg set.
205
			*/
206
207
			if ( cflg ) {
208
				for ( ptr = strnstr( obuf, "\r\n", cc ); ptr != NULL; 
209
				      ptr = strnstr( ptr, "\r\n", ccount ))
210
					bcopy( ptr + 1, ptr, ccount = --cc - ( ptr - obuf ));
211
			}
212
198
			(void)fwrite(obuf, 1, cc, fscript);
213
			(void)fwrite(obuf, 1, cc, fscript);
199
		}
214
		}
200
		tvec = time(0);
215
		tvec = time(0);

Return to bug 94052