changeset 281:feb2ee302d25

librftab compiles
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 17 Nov 2017 23:46:27 +0000
parents 36922911e6bb
children 90c475877d34
files librftab/Makefile librftab/rftablerd.c
diffstat 2 files changed, 24 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/librftab/Makefile	Fri Nov 17 23:46:27 2017 +0000
@@ -0,0 +1,13 @@
+CC=	gcc
+CFLAGS=	-O2
+OBJS=	rftablerd.o rftablewr.o
+LIB=	librftab.a
+
+all:	${LIB}
+
+${LIB}:	${OBJS}
+	ar rcu $@ ${OBJS}
+	ranlib $@
+
+clean:
+	rm -f *.[oa] errs
--- a/librftab/rftablerd.c	Fri Nov 17 23:43:38 2017 +0000
+++ b/librftab/rftablerd.c	Fri Nov 17 23:46:27 2017 +0000
@@ -1,5 +1,7 @@
 /*
- * Reading RF tables from formatted ASCII files for the rftw command
+ * Reading RF tables from formatted ASCII files: used for the rftw command
+ * in fc-tmsh, for the upload-rf-table command in fc-fsio, and in the
+ * standalone fc-cal2bin utility.
  */
 
 #include <sys/types.h>
@@ -8,9 +10,7 @@
 #include <string.h>
 #include <strings.h>
 #include <stdlib.h>
-#include "localtypes.h"
-#include "l1tm.h"
-#include "exitcodes.h"
+#include "../rvinterf/include/exitcodes.h"
 
 #define	MAX_FIELDS_PER_LINE	64
 
@@ -21,7 +21,7 @@
 static unsigned line_nfields, line_field_ptr;
 static char *format;
 static u_char *writeptr;
-static unsigned written_size;
+static unsigned written_size, maxsize;
 
 static int
 read_line()
@@ -283,7 +283,7 @@
 		if (!rc)
 			break;
 		number = strtoul(field, 0, 16);
-		if (written_size >= MAX_RF_TABLE_SIZE) {
+		if (written_size >= maxsize) {
 			printf("error: raw table %s exceeds maximum size\n",
 				filename);
 			return(ERROR_USAGE);
@@ -316,7 +316,7 @@
 	{0, 0}
 };
 
-read_rf_table(filename_arg, rdbuf, format_ret, size_ret)
+read_rf_table_ext(filename_arg, rdbuf, allow_large, format_ret, size_ret)
 	char *filename_arg;
 	u_char *rdbuf;
 	char **format_ret;
@@ -359,6 +359,10 @@
 		*format_ret = format;
 	writeptr = rdbuf;
 	written_size = 0;
+	if (allow_large)
+		maxsize = 512;
+	else
+		maxsize = 128;
 	rc = tp->handler();
 	fclose(rdfile);
 	if (size_ret)