changeset 7:dc1554b7dfb8

themwi-check-own compiles in the new model
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 13 Dec 2023 03:33:51 +0000
parents 1e548c7a24a1
children db3c657efafa
files .hgignore utils/Makefile utils/themwi-check-own.c
diffstat 3 files changed, 12 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/.hgignore	Wed Dec 13 03:14:35 2023 +0000
+++ b/.hgignore	Wed Dec 13 03:33:51 2023 +0000
@@ -2,5 +2,6 @@
 
 \.[oa]$
 
+^utils/themwi-check-own$
 ^utils/themwi-dump-numdb$
 ^utils/themwi-update-numdb$
--- a/utils/Makefile	Wed Dec 13 03:14:35 2023 +0000
+++ b/utils/Makefile	Wed Dec 13 03:33:51 2023 +0000
@@ -1,11 +1,14 @@
 CC=	gcc
 CFLAGS=	-O2 -I../build-inc
-PROGS=	themwi-dump-numdb themwi-update-numdb
+PROGS=	themwi-check-own themwi-dump-numdb themwi-update-numdb
 LIBNUMDB=../libnumdb/libnumdb.a
 LIBUTIL=../libnumutil/libnumutil.a
 
 all:	${PROGS}
 
+themwi-check-own:	themwi-check-own.o ${LIBNUMDB} ${LIBUTIL}
+	${CC} -o $@ $@.o ${LIBNUMDB} ${LIBUTIL}
+
 themwi-dump-numdb:	themwi-dump-numdb.c
 	${CC} ${CFLAGS} -o $@ $@.c
 
--- a/utils/themwi-check-own.c	Wed Dec 13 03:14:35 2023 +0000
+++ b/utils/themwi-check-own.c	Wed Dec 13 03:33:51 2023 +0000
@@ -7,14 +7,15 @@
 #include <stdint.h>
 #include <stdlib.h>
 #include <syslog.h>
-#include "../include/number_db_v2.h"
-#include "../libnumdb2/lookup_func.h"
 
-main(argc, argv)
-	char **argv;
+#include <themwi/nanp/number_db_v2.h>
+#include <themwi/nanp/number_lookup.h>
+#include <themwi/nanp/number_utils.h>
+
+int main(int argc, char **argv)
 {
 	char nanp[11];
-	struct owned_number_rec *rec;
+	const struct owned_number_rec *rec;
 
 	if (argc != 2) {
 usage:		fprintf(stderr, "usage: %s 10-digit-number\n", argv[0]);
@@ -27,7 +28,7 @@
 		fprintf(stderr, "error: number violates NANP rules\n");
 		exit(1);
 	}
-	openlog("themwi-check-own", 0, LOG_LOCAL5);
+	openlog("themwi-check-own", LOG_PERROR, LOG_USER);
 	if (read_number_db() < 0) {
 		fprintf(stderr, "error reading number database\n");
 		exit(1);