From 1ee87baa9bc6f43ec3034843c54673dc785e3da9 Mon Sep 17 00:00:00 2001 From: Andrea Asperti Date: Wed, 1 Oct 2003 13:08:08 +0000 Subject: [PATCH] * the main function MUST return 0 to communicate everything was OK --- .../create_V7_mowgli/METADATA/meta_lex.l | 16 ++++++++++++---- .../create_V7_mowgli/METADATA/meta_lex_ind.l | 10 +++++++++- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/helm/metadata/create_V7_mowgli/METADATA/meta_lex.l b/helm/metadata/create_V7_mowgli/METADATA/meta_lex.l index 2f8c4b039..18ea05cc9 100644 --- a/helm/metadata/create_V7_mowgli/METADATA/meta_lex.l +++ b/helm/metadata/create_V7_mowgli/METADATA/meta_lex.l @@ -283,6 +283,12 @@ main(int argc, char *argv[]) PGconn *conn; PGresult *res; + if (argc != 4) + { + fprintf(stderr, "Usage: meta \n"); + exit(1); + } + /* * begin, by setting the parameters for a backend connection if the * parameters are null, then the system will try to use reasonable @@ -291,7 +297,7 @@ main(int argc, char *argv[]) */ /* make a connection to the database */ - conn = PQconnectdb("user=helm dbname=mowgli"); + conn = PQconnectdb("user=helm dbname=mowgli_test"); /* * check to see that the backend connection was successfully made @@ -310,16 +316,16 @@ main(int argc, char *argv[]) init_symbol_table(); // We process the body - if (!stat("tmp/body.xml",&buf)) + if (!stat(argv[2],&buf)) { - yyin = fopen("tmp/body.xml", "r"); + yyin = fopen(argv[2], "r"); position = INBODY; yylex(); fclose(yyin); } // We process the type - yyin = fopen("tmp/type.xml", "r"); + yyin = fopen(argv[3], "r"); position = INTYPE; first_child = HERE; no_open_source = 0; @@ -328,6 +334,8 @@ main(int argc, char *argv[]) yylex(); fclose(yyin); print_all(argv[1],conn); + + return 0; } diff --git a/helm/metadata/create_V7_mowgli/METADATA/meta_lex_ind.l b/helm/metadata/create_V7_mowgli/METADATA/meta_lex_ind.l index ef0abac72..31e1416f0 100644 --- a/helm/metadata/create_V7_mowgli/METADATA/meta_lex_ind.l +++ b/helm/metadata/create_V7_mowgli/METADATA/meta_lex_ind.l @@ -316,6 +316,12 @@ main(int argc, char *argv[]) PGresult *res; + if (argc != 3) + { + fprintf(stderr, "Usage: meta_ind \n"); + exit(1); + } + /* * begin, by setting the parameters for a backend connection if the * parameters are null, then the system will try to use reasonable @@ -342,8 +348,10 @@ main(int argc, char *argv[]) source_uri = malloc((sizeof('a')*2000)); source_uri_prefix=argv[1]; /* fprintf(stderr,"qua"); */ - yyin = fopen("tmp/inductive_type.xml", "r"); + yyin = fopen(argv[2], "r"); yylex(); + + return 0; } search(uri,first_child,position,depth) -- 2.39.2