bin/114465: [patch] [request] script(1): add really cool -d, -p & -r options from NetBSD

h h aakuusta at gmail.com
Wed Sep 28 09:30:13 UTC 2011


The following reply was made to PR bin/114465; it has been noted by GNATS.

From: h h <aakuusta at gmail.com>
To: bug-followup at FreeBSD.org
Cc:  
Subject: Re: bin/114465: [patch] [request] script(1): add really cool -d, -p & -r options from NetBSD
Date: Wed, 28 Sep 2011 09:26:41 +0000

 a few cosmetic changes
 - wrap long lines, also reduces diff with script.c from NetBSD
 - mark playback() as __dead2, it uses exit(3) and err(3)
 - add forgotten word after `the' in the manpage
 
 Also, the previous followup got revisions wrong
 
  - script.c at 1.19 -> script.c at 1.20
  - script.1 at 1.12 -> script.1 at 1.13
 
 --- a.diff begins here ---
 --- usr.bin/script/script.1~
 +++ usr.bin/script/script.1
 @@ -164,7 +164,7 @@ The
  .Fl p
  and
  .Fl r
 -first appeared in
 +options first appeared in
  .Nx 2.0 .
  .Sh BUGS
  The
 --- usr.bin/script/script.c~
 +++ usr.bin/script/script.c
 @@ -86,7 +86,7 @@ static void fail(void);
  static void finish(void);
  static void record(FILE *, char *, size_t, int);
  static void consume(FILE *, off_t, char *, int);
 -static void playback(FILE *);
 +static void playback(FILE *) __dead2;
  static void usage(void);
  
  int
 @@ -108,7 +108,7 @@ main(int argc, char *argv[])
  	aflg = kflg = pflg = 0;
  	usesleep = 1;
  	rawout = 0;
 - 
 +
  	while ((ch = getopt(argc, argv, "adkpqrt:")) != -1)
  		switch(ch) {
  		case 'a':
 @@ -173,11 +173,13 @@ main(int argc, char *argv[])
  		tvec = time(NULL);
  		(void)printf("Script started, output file is %s\n", fname);
  		if (!rawout) {
 -			(void)fprintf(fscript, "Script started on %s", ctime(&tvec));
 +			(void)fprintf(fscript, "Script started on %s",
 +				      ctime(&tvec));
  			if (argv[0]) {
  				fprintf(fscript, "command: ");
  				for (k = 0 ; argv[k] ; ++k)
 -					fprintf(fscript, "%s%s", k ? " " : "", argv[k]);
 +					fprintf(fscript, "%s%s", k ? " " : "",
 +						argv[k]);
  				fprintf(fscript, "\n");
  			}
  		}
 @@ -325,7 +327,8 @@ done(int eno)
  		record(fscript, NULL, 0, 'e');
  	if (!qflg) {
  		if (!rawout)
 -			(void)fprintf(fscript,"\nScript done on %s", ctime(&tvec));
 +			(void)fprintf(fscript,"\nScript done on %s",
 +				      ctime(&tvec));
  		(void)printf("\nScript done, output file is %s\n", fname);
  	}
  	(void)fclose(fscript);
 @@ -333,7 +336,6 @@ done(int eno)
  	exit(eno);
  }
  
 -
  static void
  record(FILE *fp, char *buf, size_t cc, int direction)
  {
 @@ -421,13 +423,15 @@ playback(FILE *fp)
  		switch (stamp.scr_direction) {
  		case 's':
  			if (!qflg)
 -				(void)printf("Script started on %s", ctime(&tclock));
 +			    (void)printf("Script started on %s",
 +				ctime(&tclock));
  			tsi = tso;
  			(void)consume(fp, stamp.scr_len, buf, reg);
  			break;
  		case 'e':
  			if (!qflg)
 -				(void)printf("\nScript done on %s", ctime(&tclock));
 +				(void)printf("\nScript done on %s",
 +				    ctime(&tclock));
  			(void)consume(fp, stamp.scr_len, buf, reg);
  			break;
  		case 'i':
 --- a.diff ends here ---


More information about the freebsd-bugs mailing list