Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 21147 | Differences between
and this patch

Collapse All | Expand All

(-)util-linux-2.11z/misc-utils/script.1 (+5 lines)
Lines 40-45 Link Here
40
.Sh SYNOPSIS
40
.Sh SYNOPSIS
41
.Nm script
41
.Nm script
42
.Op Fl a
42
.Op Fl a
43
.Op Fl c Ar COMMAND
43
.Op Fl f
44
.Op Fl f
44
.Op Fl q
45
.Op Fl q
45
.Op Fl t
46
.Op Fl t
Lines 69-74 Link Here
69
or
70
or
70
.Pa typescript ,
71
.Pa typescript ,
71
retaining the prior contents.
72
retaining the prior contents.
73
.It Fl c Ar COMMAND
74
Run the COMMAND rather than an interactive shell.
75
This makes it easy for a script to capture the output of a program that
76
behaves differently when its stdout is not a tty.
72
.It Fl f
77
.It Fl f
73
Flush output after each write. This is nice for telecooperation:
78
Flush output after each write. This is nice for telecooperation:
74
One person does `mkfifo foo; script -f foo' and another can
79
One person does `mkfifo foo; script -f foo' and another can
(-)util-linux-2.11z/misc-utils/script.c (-3 / +8 lines)
Lines 91-96 Link Here
91
char	line[] = "/dev/ptyXX";
91
char	line[] = "/dev/ptyXX";
92
#endif
92
#endif
93
int	aflg = 0;
93
int	aflg = 0;
94
char	*cflg;
94
int	fflg = 0;
95
int	fflg = 0;
95
int	qflg = 0;
96
int	qflg = 0;
96
int	tflg = 0;
97
int	tflg = 0;
Lines 135-145 Link Here
135
		}
136
		}
136
	}
137
	}
137
138
138
	while ((ch = getopt(argc, argv, "afqt")) != -1)
139
	while ((ch = getopt(argc, argv, "ac:fqt")) != -1)
139
		switch((char)ch) {
140
		switch((char)ch) {
140
		case 'a':
141
		case 'a':
141
			aflg++;
142
			aflg++;
142
			break;
143
			break;
144
		case 'c':
145
			cflg = optarg;
146
			break;
143
		case 'f':
147
		case 'f':
144
			fflg++;
148
			fflg++;
145
			break;
149
			break;
Lines 284-289 Link Here
284
288
285
void
289
void
286
doshell() {
290
doshell() {
291
	char *opt = cflg? "-c" : "-i";
287
	/***
292
	/***
288
	int t;
293
	int t;
289
294
Lines 301-309 Link Here
301
	(void) dup2(slave, 2);
306
	(void) dup2(slave, 2);
302
	(void) close(slave);
307
	(void) close(slave);
303
#ifdef __linux__
308
#ifdef __linux__
304
	execl(shell, strrchr(shell, '/') + 1, "-i", 0);
309
	execl(shell, strrchr(shell, '/') + 1, opt, cflg, 0);
305
#else
310
#else
306
	execl(shell, "sh", "-i", 0);
311
	execl(shell, "sh", opt, cflg, 0);
307
#endif
312
#endif
308
	perror(shell);
313
	perror(shell);
309
	fail();
314
	fail();

Return to bug 21147