[n]eqn(1) speedup

Bernard Sieloff bs at sbsvax.UUCP
Mon Aug 8 05:29:19 AEST 1988


Subject: [n]eqn(1) speedup

Description:
This is no *real* bug, but it chews unnecessarily a lot of CPU time, if
you have some BIG [n]eqn input files.
Input to eqn with no effect to eqn itself will be passed unaltered to
stdout, but by calling printf()!
Eqn behavior is heavily sped up, if the "passing"-printf() calls  are
changed to fputs() calls.

Fix:
Apply the following diff with Larry Wall's "patch" program.
The concerned file is io.c in eqn's source directory.

*** io.c.orig	Sun Sep  4 00:19:07 1983
--- io.c	Sun Aug  7 20:39:03 1988
***************
*** 32,38 ****
  		eqline = linect;
  		if (in[0]=='.' && in[1]=='E' && in[2]=='Q') {
  			for (i=11; i<100; used[i++]=0);
! 			printf("%s",in);
  			printf(".nr 99 \\n(.s\n.nr 98 \\n(.f\n");
  			markline = 0;
  			init();
--- 32,38 ----
  		eqline = linect;
  		if (in[0]=='.' && in[1]=='E' && in[2]=='Q') {
  			for (i=11; i<100; used[i++]=0);
! 			fputs(in, stdout); /* [bs] */
  			printf(".nr 99 \\n(.s\n.nr 98 \\n(.f\n");
  			markline = 0;
  			init();
***************
*** 58,64 ****
  		else if (type == lefteq)
  			inline();
  		else
! 			printf("%s",in);
  	}
  	return(0);
  }
--- 58,64 ----
  		else if (type == lefteq)
  			inline();
  		else
! 			fputs(in, stdout); /* [bs] */
  	}
  	return(0);
  }
-- 
 Bernard Sieloff                    | UUCP:  ...!uunet!unido!sbsvax!bs
 Universitaet des Saarlandes        | or bs at sbsvax.UUCP
 FB 10 - Informatik (Dept. of CS)   | CSNET: bs%sbsvax.uucp at Germany.CSnet
 Bau 36, Im Stadtwald 15            | ARPA:  bs%sbsvax.uucp at uunet.UU.NET
 D-6600 Saarbruecken 11, W. Germany | Phone: +49 681 302 2434



More information about the Comp.bugs.4bsd.ucb-fixes mailing list