# 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
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)
* 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.
*
*/
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;
}
* 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
#include <string.h>
#include <util.h>
-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;