diff options
| -rw-r--r-- | Makefile | 5 | ||||
| -rw-r--r-- | process_args.c | 2 | ||||
| -rw-r--r-- | process_args.h | 4 | ||||
| -rw-r--r-- | rat2float.c | 15 | 
4 files changed, 22 insertions, 4 deletions
| @@ -37,9 +37,10 @@ docstrings: ${DOCHEADERS}  rat2float.h: rat2float.doc -rat2float: rat2float.c rat2float.h $(MPOBJ) process_args.o -	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ $(MPOBJ) process_args.o $(LDFLAGS) $< +rat2float: rat2float.o $(MPOBJ) process_args.o +	$(CC) $(CPPFLAGS) $(CFLAGS) -o $@  $^ $(LDFLAGS) +rat2float.o: rat2float.c rat2float.h  rat2canon.h: rat2canon.doc diff --git a/process_args.c b/process_args.c index 6e6827d..3b82500 100644 --- a/process_args.c +++ b/process_args.c @@ -1,5 +1,7 @@ +#include "process_args.h"  #include <stdio.h>  #include <stdlib.h> +  void process_args(int argc, char **argv,char *docstring){    if (argc > 1 && argv[1][0]=='-' && argv[1][1]=='h') {      fprintf(stderr,docstring);   diff --git a/process_args.h b/process_args.h new file mode 100644 index 0000000..dacadd3 --- /dev/null +++ b/process_args.h @@ -0,0 +1,4 @@ +#ifndef PROCESS_ARGS_H +#define PROCESS_ARGS_H +void process_args(int argc, char **argv,char *docstring); +#endif diff --git a/rat2float.c b/rat2float.c index a23df4f..cfb3a0a 100644 --- a/rat2float.c +++ b/rat2float.c @@ -6,13 +6,12 @@   *   */ -static char rcsid[]="$Id$"; -  #include <stdlib.h>  #include <stdio.h>  #include <string.h>  #include <float.h> +#include "process_args.h"  #ifdef LRSMP  #include "lrsmp.h"  #endif @@ -44,9 +43,18 @@ void my_readrat(long *num_p, long * denom_p) {  void rattodouble(integer_t num, integer_t denom, double *out_p){    *out_p=(double)num/(double)denom;  } +  #else  typedef  lrs_mp integer_t;  #define MP_DIGITS 1000L +FILE *lrs_ifp; +FILE *lrs_ofp; + +void +lrs_overflow (int ignored) { +  fprintf (stderr, "lrs_overflow called. exiting\n"); +  exit(1); +}  #endif  #include "rat2float.h" @@ -62,6 +70,9 @@ int main(argc,argv)    char format[BUFSIZ];    char  buf[BUFSIZ]; + +  lrs_ifp = stdin; +  lrs_ofp = stdout;    process_args(argc,argv,DOCSTRING); | 
