FreeBSD Bugzilla – Attachment 17132 Details for
Bug 31205
[PATCH] WARNSify and add a new option to script(1)
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
script.diff
script.diff (text/plain), 3.29 KB, created by
mux
on 2001-10-10 22:10:07 UTC
(
hide
)
Description:
script.diff
Filename:
MIME Type:
Creator:
mux
Created:
2001-10-10 22:10:07 UTC
Size:
3.29 KB
patch
obsolete
>Index: Makefile >=================================================================== >RCS file: /home/ncvs/src/usr.bin/script/Makefile,v >retrieving revision 1.1.1.1 >diff -u -r1.1.1.1 Makefile >--- Makefile 27 May 1994 12:32:38 -0000 1.1.1.1 >+++ Makefile 10 Oct 2001 20:53:52 -0000 >@@ -4,4 +4,6 @@ > LDADD= -lutil > DPADD= ${LIBUTIL} > >+WARNS?= 2 >+ > .include <bsd.prog.mk> >Index: script.1 >=================================================================== >RCS file: /home/ncvs/src/usr.bin/script/script.1,v >retrieving revision 1.15 >diff -u -r1.15 script.1 >--- script.1 15 Jul 2001 08:01:34 -0000 1.15 >+++ script.1 10 Oct 2001 21:00:46 -0000 >@@ -41,6 +41,7 @@ > .Sh SYNOPSIS > .Nm > .Op Fl a >+.Op Fl A > .Op Fl k > .Op Fl q > .Op Fl t Ar time >@@ -77,6 +78,8 @@ > or > .Pa typescript , > retaining the prior contents. >+.It Fl A >+Skip the ASCII 13 characters from the script output file. > .It Fl k > Log keys sent to program as well as output. > .It Fl q >@@ -141,7 +144,8 @@ > .Nm Script > places > .Sy everything >-in the log file, including linefeeds and backspaces. >+(except if you use the -A option), in the log file, >+including linefeeds and backspaces. > This is not what the naive user expects. > .Pp > It is not possible to specify a command without also naming the script file >Index: script.c >=================================================================== >RCS file: /home/ncvs/src/usr.bin/script/script.c,v >retrieving revision 1.15 >diff -u -r1.15 script.c >--- script.c 26 Jul 2001 11:02:35 -0000 1.15 >+++ script.c 10 Oct 2001 01:08:04 -0000 >@@ -66,8 +66,8 @@ > FILE *fscript; > int master, slave; > int child; >-char *fname; >-int qflg; >+const char *fname; >+int Aflg, qflg; > > struct termios tt; > >@@ -76,6 +76,7 @@ > void doshell __P((char **)); > void fail __P((void)); > void finish __P((void)); >+void log_write __P((const char *, int)); > static void usage __P((void)); > > int >@@ -95,11 +96,14 @@ > int flushtime = 30; > > aflg = kflg = 0; >- while ((ch = getopt(argc, argv, "aqkt:")) != -1) >+ while ((ch = getopt(argc, argv, "aAqkt:")) != -1) > switch(ch) { > case 'a': > aflg = 1; > break; >+ case 'A': >+ Aflg = 1; >+ break; > case 'q': > qflg = 1; > break; >@@ -177,7 +181,7 @@ > (void)write(master, ibuf, cc); > if (kflg && tcgetattr(master, &stt) >= 0 && > ((stt.c_lflag & ECHO) == 0)) { >- (void)fwrite(ibuf, 1, cc, fscript); >+ log_write(ibuf, cc); > } > } > } >@@ -186,7 +190,7 @@ > if (cc <= 0) > break; > (void)write(STDOUT_FILENO, obuf, cc); >- (void)fwrite(obuf, 1, cc, fscript); >+ log_write(obuf, cc); > } > tvec = time(0); > if (tvec - start >= flushtime) { >@@ -202,7 +206,7 @@ > usage() > { > (void)fprintf(stderr, >- "usage: script [-a] [-q] [-k] [-t time] [file] [command]\n"); >+ "usage: script [-a] [-A] [-q] [-k] [-t time] [file] [command]\n"); > exit(1); > } > >@@ -232,7 +236,7 @@ > doshell(av) > char **av; > { >- char *shell; >+ const char *shell; > > shell = getenv("SHELL"); > if (shell == NULL) >@@ -273,4 +277,24 @@ > (void)fclose(fscript); > (void)close(master); > exit(eno); >+} >+ >+void >+log_write(const char *buf, int size) >+{ >+ int off, i; >+ >+ if (!Aflg) { >+ (void)fwrite(buf, 1, size, fscript); >+ return; >+ } >+ off = 0; >+ do { >+ i = 0; >+ while ((off + i < size) && (buf[off + i] != '\r')) >+ i++; >+ if (i > 0) >+ (void)fwrite(buf + off, 1, i, fscript); >+ off += i + 1; >+ } while (off < size); > }
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 31205
: 17132