From 5fbbd5cdbe4218474ecdef85ad12814678ca18bd Mon Sep 17 00:00:00 2001 From: Adam Dickmeiss Date: Mon, 3 Jul 1995 08:20:12 +0000 Subject: [PATCH] More help information and better diagnostics. --- kernel/Makefile | 9 ++++----- kernel/default.res | 15 ++++++++++++++- kernel/main.c | 40 +++++++++++++++------------------------- kernel/urp.c | 28 ++++++++++++++++------------ 4 files changed, 49 insertions(+), 43 deletions(-) diff --git a/kernel/Makefile b/kernel/Makefile index 1bb7c82..4e9c646 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -2,7 +2,10 @@ # Europagate, 1995 # # $Log: Makefile,v $ -# Revision 1.25 1995/05/19 13:25:58 adam +# Revision 1.26 1995/07/03 08:20:12 adam +# More help information and better diagnostics. +# +# Revision 1.25 1995/05/19 13:25:58 adam # Bug fixes. Better command line options. # # Revision 1.24 1995/05/03 12:18:46 adam @@ -86,10 +89,6 @@ # SHELL=/bin/sh -#ZPRE=/home/proj/zdist/zdist102b1-1/libz3950 -#ZINC=-I$(ZPRE) -#ZLIB=$(ZPRE)/libz3950.a - ZLIB=../../yaz/lib/libyaz.a INCLUDE=-I../include diff --git a/kernel/default.res b/kernel/default.res index 271f019..4ade197 100644 --- a/kernel/default.res +++ b/kernel/default.res @@ -1,5 +1,5 @@ # Email gateway - general kernel resources -# $Id: default.res,v 1.25 1995/05/23 08:12:59 adam Exp $ +# $Id: default.res,v 1.26 1995/07/03 08:20:13 adam Exp $ # # Important directories, programs, etc. gw.reply.mta: /usr/lib/sendmail @@ -189,6 +189,19 @@ gw.help.show: Command:\n Example:\n \tshow p=2-7 p=9-10 f=1\n Records 2 through 7 and 9-10 are shown in format 1.\n +gw.help.def:\n + \tdef \n + The def command sets/gets various settings. Setting is one of: + \tf - display format to be used in show\n + \tautoshow - number of records to show after a find\n + \tdefaultshow - number of records to retrieve in a show command\n + \tlang - conversation language\n + \n + \treset - resets the settings to their defaults values\n + \tshow - show current settings\n +gw.help.account:\n + \taccount \n + Sets authentication string. Necessary for some targets.\n gw.help.general: You have triggered the "help"-information on the Email gateway. \n\n This preliminary service is a very early alpha release of a Email service diff --git a/kernel/main.c b/kernel/main.c index 5ed778e..5c73fff 100644 --- a/kernel/main.c +++ b/kernel/main.c @@ -45,7 +45,10 @@ * Europagate, 1995 * * $Log: main.c,v $ - * Revision 1.27 1995/05/19 13:25:59 adam + * Revision 1.28 1995/07/03 08:20:15 adam + * More help information and better diagnostics. + * + * Revision 1.27 1995/05/19 13:25:59 adam * Bug fixes. Better command line options. * * Revision 1.26 1995/05/18 12:03:08 adam @@ -505,8 +508,6 @@ static int fml_inf_read (void) void read_kernel_res (void) { - char path_prefix[128]; - char fname[160]; const char *v; char *cp; char resource_name[256]; @@ -537,23 +538,19 @@ void read_kernel_res (void) info.default_res); return; } - strcpy (path_prefix, gw_res_get (info.kernel_res, "gw.path", ".")); - /* fetch target definitions (if defined at all) */ if (*info.target) { sprintf (resource_name, "gw.target.%s", info.target); v = gw_res_get (info.kernel_res, resource_name, NULL); if (v) - { - sprintf (fname, "%s/%s", path_prefix, v); - gw_res_merge (info.kernel_res, fname); - } + gw_res_merge (info.kernel_res, v); } /* fetch user definitions (if user-id is specified) */ if (info.userid >= 0) { - sprintf (fname, "%s/user.%d.r", path_prefix, info.userid); + char fname[250]; + sprintf (fname, "user.%d.r", info.userid); gw_res_merge (info.kernel_res, fname); } /* fetch language definitions (if specified at all) */ @@ -564,18 +561,14 @@ void read_kernel_res (void) v = gw_res_get (info.kernel_res, resource_name, NULL); if (v) { - sprintf (fname, "%s/%s", path_prefix, v); gw_log (GW_LOG_DEBUG, KERNEL_LOG, "Reading language resources %s", - fname); - gw_res_merge (info.kernel_res, fname); + v); + gw_res_merge (info.kernel_res, v); } } /* fetch overriding resources from file (if specified) */ if (info.override_res) - { - sprintf (fname, "%s/%s", path_prefix, info.override_res); - gw_res_merge (info.kernel_res, fname); - } + gw_res_merge (info.kernel_res, info.override_res); /* read bibset definition for ccl */ v = gw_res_get (info.kernel_res, "gw.bibset", NULL); @@ -583,13 +576,12 @@ void read_kernel_res (void) { FILE *bib_inf; - sprintf (fname, "%s/%s", path_prefix, v); - bib_inf = fopen (fname, "r"); + bib_inf = fopen (v, "r"); if (!bib_inf) - gw_log (GW_LOG_WARN, KERNEL_LOG, "cannot open %s", fname); + gw_log (GW_LOG_WARN, KERNEL_LOG, "cannot open %s", v); else { - gw_log (GW_LOG_DEBUG, KERNEL_LOG, "reading bib file %s", fname); + gw_log (GW_LOG_DEBUG, KERNEL_LOG, "reading bib file %s", v); ccl_qual_file (info.bibset, bib_inf); fclose (bib_inf); } @@ -674,11 +666,9 @@ void read_kernel_res (void) if (!info.fml) { v = gw_res_get (info.kernel_res, "gw.fml", "default.fml"); - sprintf (fname, "%s/%s", path_prefix, v); - fml_inf = fopen (fname, "r"); + fml_inf = fopen (v, "r"); if (!fml_inf) - gw_log (GW_LOG_WARN, KERNEL_LOG, - "cannot open fml script %s", fname); + gw_log (GW_LOG_WARN, KERNEL_LOG, "cannot open fml script %s", v); else { info.fml = fml_open (); diff --git a/kernel/urp.c b/kernel/urp.c index 3ca6e5f..92a4b36 100644 --- a/kernel/urp.c +++ b/kernel/urp.c @@ -45,7 +45,10 @@ * Europagate, 1995 * * $Log: urp.c,v $ - * Revision 1.40 1995/05/23 08:13:00 adam + * Revision 1.41 1995/07/03 08:20:18 adam + * More help information and better diagnostics. + * + * Revision 1.40 1995/05/23 08:13:00 adam * Minor changes. * * Revision 1.39 1995/05/22 14:57:30 adam @@ -181,7 +184,6 @@ Todo: info/status (other name?) better persistence diagnostics - resource gw.path - use chdir call instead Optional: automatic information about target-aliases: name, query-support, etc. @@ -377,6 +379,12 @@ static int exec_help (struct ccl_token *list) put_esc_str (gw_res_get (info.kernel_res, "gw.help.show", "show - retrieves and displays " "records\n")); + put_esc_str (sep); + put_esc_str (gw_res_get (info.kernel_res, "gw.help.def", + "def sets/gets definitons\n")); + put_esc_str (sep); + put_esc_str (gw_res_get (info.kernel_res, "gw.help.account", + "account sets authentication string\n")); return 0; } @@ -447,7 +455,7 @@ static int exec_find (struct ccl_token *list, const char *search_str) { fprintf (reply_fd, "%s\n", gw_res_get (info.kernel_res, "gw.err.search.fail", - "Search fail. Connection closed")); + "Search fail.")); return -1; } if (p->errcode != -1) @@ -573,7 +581,6 @@ static void present (const char *set, int offset, int number, { int i; zass_record *pp; - char path[128]; int record_log_fd = -1; const char *record_log_name; @@ -581,12 +588,11 @@ static void present (const char *set, int offset, int number, NULL); if (record_log_name) { - sprintf (path, "%s/%s", gw_res_get (info.kernel_res, - "gw.path", "."), - record_log_name ); - record_log_fd = open (path, O_WRONLY|O_CREAT|O_APPEND, 0666); + record_log_fd = open (record_log_name, + O_WRONLY|O_CREAT|O_APPEND, 0666); if (record_log_fd == -1) - gw_log (GW_LOG_WARN|GW_LOG_ERRNO, "Cannot open %s", path); + gw_log (GW_LOG_WARN|GW_LOG_ERRNO, "Cannot open %s", + record_log_name); } fprintf (reply_fd, gw_res_get (info.kernel_res, "gw.msg.records", @@ -884,9 +890,7 @@ static int exec_def (struct ccl_token *list) if (info.userid < 0) return -1; - sprintf (fname, "%s/user.%d.r", gw_res_get (info.kernel_res, - "gw.path", "."), - info.userid); + sprintf (fname, "user.%d.r", info.userid); if (list->kind == CCL_TOK_EOL) show_def (); -- 1.7.10.4