FreeBSD Bugzilla – Attachment 62997 Details for
Bug 94052
[patch] Adds option to script(1) to suppress carriage-returns in log file.
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
diff.txt
diff.txt (text/plain), 1.72 KB, created by
James Bailie
on 2006-03-03 17:40:03 UTC
(
hide
)
Description:
diff.txt
Filename:
MIME Type:
Creator:
James Bailie
Created:
2006-03-03 17:40:03 UTC
Size:
1.72 KB
patch
obsolete
>diff -ruN /usr/src/usr.bin/script/script.1 script/script.1 >--- /usr/src/usr.bin/script/script.1 Fri Jul 2 20:24:43 2004 >+++ script/script.1 Fri Mar 3 12:14:48 2006 >@@ -80,6 +80,9 @@ > Log keys sent to program as well as output. > .It Fl q > Run in quiet mode, omit the start and stop status messages. >+.It Fl c >+Collape carriage-return/newline sequences into single newlines when writing >+data to log file. > .It Fl t Ar time > Specify time interval between flushing script output file. > A value of 0 >diff -ruN /usr/src/usr.bin/script/script.c script/script.c >--- /usr/src/usr.bin/script/script.c Sun Feb 15 12:30:13 2004 >+++ script/script.c Fri Mar 3 12:18:58 2006 >@@ -81,19 +81,20 @@ > int > main(int argc, char *argv[]) > { >- int cc; >+ int cc, ccount; > struct termios rtt, stt; > struct winsize win; >- int aflg, kflg, ch, n; >+ int aflg, kflg, cflg, ch, n; > struct timeval tv, *tvp; > time_t tvec, start; >+ char *ptr; > char obuf[BUFSIZ]; > char ibuf[BUFSIZ]; > fd_set rfd; > int flushtime = 30; > >- aflg = kflg = 0; >- while ((ch = getopt(argc, argv, "aqkt:")) != -1) >+ aflg = kflg = cflg = 0; >+ while ((ch = getopt(argc, argv, "aqkct:")) != -1) > switch(ch) { > case 'a': > aflg = 1; >@@ -104,6 +105,9 @@ > case 'k': > kflg = 1; > break; >+ case 'c': >+ cflg = 1; >+ break; > case 't': > flushtime = atoi(optarg); > if (flushtime < 0) >@@ -195,6 +199,17 @@ > if (cc <= 0) > break; > (void)write(STDOUT_FILENO, obuf, cc); >+ >+ /* >+ * Suppress carriage-returns if cflg set. >+ */ >+ >+ if ( cflg ) { >+ for ( ptr = strnstr( obuf, "\r\n", cc ); ptr != NULL; >+ ptr = strnstr( ptr, "\r\n", ccount )) >+ bcopy( ptr + 1, ptr, ccount = --cc - ( ptr - obuf )); >+ } >+ > (void)fwrite(obuf, 1, cc, fscript); > } > tvec = time(0);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 94052
: 62997