aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSergey Poznyakoff <gray@gnu.org.ua>2004-06-13 16:55:11 +0000
committerSergey Poznyakoff <gray@gnu.org.ua>2004-06-13 16:55:11 +0000
commit2563199b706abcbbe55e09869bb333c5bf7cb640 (patch)
tree94c295e2078685e989824c97d65a710b8b284f9e /src
parentf74d5ff0a64737d5ac460791f9d779b5895a158c (diff)
downloadellinika-2563199b706abcbbe55e09869bb333c5bf7cb640.tar.gz
ellinika-2563199b706abcbbe55e09869bb333c5bf7cb640.tar.bz2
Update call to parse(). New command line
options: -I passes include dir to m4, -m sets full path to m4 binary (update_stat): Updated stat table. git-svn-id: file:///home/puszcza/svnroot/ellinika/trunk@120 941c8c0f-9102-463b-b60b-cd22ce0e6858
Diffstat (limited to 'src')
-rw-r--r--src/main.c39
1 files changed, 35 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index c779f7f..4eedbbb 100644
--- a/src/main.c
+++ b/src/main.c
@@ -9,6 +9,8 @@ char *sql_user;
int debug;
int compile_only;
static int error_count;
+static RAD_LIST *include_list;
+static char *m4_bin = "/usr/bin/m4"; /* FIXME: Should be autoconf'ed */
void *
emalloc(size_t size)
@@ -208,14 +210,28 @@ _xref_fixup(void *item, void *data)
return 0;
}
+
+
+void
+update_stat()
+{
+ unsigned long count;
+
+ sql_query_n(&count,
+ "SELECT count(*) from dict");
+ sql_query("DELETE from stat");
+ sql_query("INSERT INTO stat (count,updated) VALUES(%lu,now())",
+ count);
+}
+
int
main(int argc, char **argv)
{
int rc;
-
- while ((rc = getopt(argc, argv, "cd:h:P:p:u:v")) != EOF) {
+
+ while ((rc = getopt(argc, argv, "cd:h:I:m:P:p:u:v")) != EOF) {
switch (rc) {
case 'c':
compile_only = 1;
@@ -243,12 +259,24 @@ main(int argc, char **argv)
case 'v':
debug++;
break;
+
+ case 'I':
+ if (!include_list)
+ include_list = list_create();
+ list_append(include_list, optarg);
+
+ case 'm':
+ m4_bin = optarg;
}
}
- node_list = list_create();
+ make_m4_args (m4_bin, include_list);
- if (parse(argv[optind]) || error_count)
+ node_list = list_create();
+
+ argc -= optind;
+ argv += optind;
+ if (parse(argc, argv) || error_count)
return 1;
if (compile_only)
@@ -266,6 +294,9 @@ main(int argc, char **argv)
list_iterate(antonym_list, _antonym_fixup, NULL);
list_iterate(xref_list, _xref_fixup, NULL);
+
+ update_stat();
+
sql_close();
return 0;
}

Return to:

Send suggestions and report system problems to the System administrator.