gps af malfeature

kc at rna.UUCP kc at rna.UUCP
Thu Jul 17 03:36:07 AEST 1986


In my previous posting about the af command line parameter problem
my solution neglected the possibility of negative exponents.  Sorry.
What follows is the correct (I hope) code to improve af so that it
allows scientific notation in its command line parameters. This fix
supersedes the previous.

*** aeparse.c.orig	Tue Jul 15 17:29:33 1986
--- aeparse.c	Tue Jul 15 21:55:58 1986
***************
*** 1,5
  static char SCCSID[]="@(#)aeparse.c	1.2";
  /* <: t-5 d :> */
  
  #include "s.h"
  #include "stdio.h"

--- 1,6 -----
  static char SCCSID[]="@(#)aeparse.c	1.2";
  /* <: t-5 d :> */
+ /* kc 7/86 command line exponential notation allowed */
  
  #include "s.h"
  #include "stdio.h"
***************
*** 172,177
  	case IDENT: while( ISID(**p) || **p=='/' ) *buf++ = *(*p)++;
  			break;
  	case CONST: while( ISNUM(**p) ) *buf++ = *(*p)++;
  			break;
  	default: if(!silent) ERRPR1(? %c,*(*p)++); break;
  	}

--- 173,186 -----
  	case IDENT: while( ISID(**p) || **p=='/' ) *buf++ = *(*p)++;
  			break;
  	case CONST: while( ISNUM(**p) ) *buf++ = *(*p)++;
+ 		/* following four lines added by kc 7/86 to allow
+ 			exponents on the command line */
+ 		if( (**p == 'e') || (**p == 'E') ) /* exponent */
+ 			*buf++ = *(*p)++;
+ 		if( **p == '-' ) /* sign */
+ 			*buf++ = *(*p)++;
+ 		while( ISNUM(**p) )
+ 			*buf++ = *(*p)++;
  			break;
  	default: if(!silent) ERRPR1(? %c,*(*p)++); break;
  	}

Once again, sorry for the inconvenience of two messages when one should
have been enough.

Kaare Christian
cmcl2!rna!kc



More information about the Net.bugs mailing list