From: Adam Dickmeiss Date: Thu, 18 Aug 1994 10:02:00 +0000 (+0000) Subject: Module alexpath moved from res.c to alexpath.c. Minor changes in res-test.c X-Git-Tag: ZEBRA.1.0~901 X-Git-Url: http://git.indexdata.com/?p=idzebra-moved-to-github.git;a=commitdiff_plain;h=04b60639ac0ea45d8e9712014b01703cc3ac69cd Module alexpath moved from res.c to alexpath.c. Minor changes in res-test.c --- diff --git a/util/Makefile b/util/Makefile index 89e5dd8..2c15aee 100644 --- a/util/Makefile +++ b/util/Makefile @@ -1,7 +1,7 @@ # Copyright (C) 1994, Index Data I/S # All rights reserved. # Sebastian Hammer, Adam Dickmeiss -# $Id: Makefile,v 1.6 1994-08-18 09:43:49 adam Exp $ +# $Id: Makefile,v 1.7 1994-08-18 10:02:00 adam Exp $ SHELL=/bin/sh INCLUDE=-I../include @@ -9,7 +9,7 @@ TPROG=opt-test CFLAGS=-g -Wall DEFS=$(INCLUDE) LIB=../lib/util.a -PO = options.o xmalloc.o log.o res.o +PO = options.o xmalloc.o log.o res.o alexpath.o CPP=cc -E all: $(LIB) diff --git a/util/res-test.c b/util/res-test.c index 315defd..7e76454 100644 --- a/util/res-test.c +++ b/util/res-test.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: res-test.c,v $ - * Revision 1.1 1994-08-18 09:43:51 adam + * Revision 1.2 1994-08-18 10:02:01 adam + * Module alexpath moved from res.c to alexpath.c. Minor changes in res-test.c + * + * Revision 1.1 1994/08/18 09:43:51 adam * Development of resource manager. Only missing is res_write. * */ @@ -14,35 +17,38 @@ static void res_print (const char *name, const char *value) { - printf ("%s=%s\n", name, value); + log (LOG_LOG, "%s=%s", name, value); } int main(int argc, char **argv) { char *arg; char *resfile = NULL; + char *prefix = NULL; int ret; - int verboselevel = LOG_DEFAULT_LEVEL; char *prog = *argv; Res res; - - while ((ret = options ("v", argv, argc, &arg)) != -2) - { + log_init (LOG_DEFAULT_LEVEL, prog, NULL); + while ((ret = options ("p:v", argv, argc, &arg)) != -2) if (ret == 0) resfile = arg; else if (ret == 'v') - verboselevel = LOG_ALL; - } - log_init (verboselevel, prog, NULL); - + log_init (LOG_ALL, prog, NULL); + else if (ret == 'p') + prefix = arg; + else + { + log (LOG_FATAL, "unknown option"); + exit (1); + } if (!resfile) { log (LOG_FATAL, "Now resource file given."); exit (1); } res = res_open (resfile); - res_trav (res, "p", res_print); + res_trav (res, prefix, res_print); res_close (res); return 0; } diff --git a/util/res.c b/util/res.c index a5c6c13..5655a61 100644 --- a/util/res.c +++ b/util/res.c @@ -4,7 +4,10 @@ * Sebastian Hammer, Adam Dickmeiss * * $Log: res.c,v $ - * Revision 1.3 1994-08-18 09:43:51 adam + * Revision 1.4 1994-08-18 10:02:01 adam + * Module alexpath moved from res.c to alexpath.c. Minor changes in res-test.c + * + * Revision 1.3 1994/08/18 09:43:51 adam * Development of resource manager. Only missing is res_write. * * Revision 1.2 1994/08/18 08:23:26 adam @@ -19,21 +22,6 @@ #include #include -const char *alex_path (const char *name) -{ - static char path[256]; - char *alex_prefix; - - if (!(alex_prefix = getenv ("ALEXPREFIX"))) - alex_prefix = "./"; - - if (*alex_prefix && alex_prefix[strlen(alex_prefix)-1] == '/') - sprintf (path, "%s%s", alex_prefix, name); - else - sprintf (path, "%s/%s", alex_prefix, name); - return path; -} - static void reread (Res r) { struct res_entry *resp;