Module alexpath moved from res.c to alexpath.c. Minor changes in res-test.c
[idzebra-moved-to-github.git] / util / res-test.c
1 /*
2  * Copyright (C) 1994, Index Data I/S 
3  * All rights reserved.
4  * Sebastian Hammer, Adam Dickmeiss
5  *
6  * $Log: res-test.c,v $
7  * Revision 1.2  1994-08-18 10:02:01  adam
8  * Module alexpath moved from res.c to alexpath.c. Minor changes in res-test.c
9  *
10  * Revision 1.1  1994/08/18  09:43:51  adam
11  * Development of resource manager. Only missing is res_write.
12  *
13  */
14
15 #include <stdio.h>
16 #include <util.h>
17
18 static void res_print (const char *name, const char *value)
19 {
20     log (LOG_LOG, "%s=%s", name, value);
21 }
22
23 int main(int argc, char **argv)
24 {
25     char *arg;
26     char *resfile = NULL;
27     char *prefix = NULL;
28     int ret;
29     char *prog = *argv;
30     Res res;
31
32     log_init (LOG_DEFAULT_LEVEL, prog, NULL);
33     while ((ret = options ("p:v", argv, argc, &arg)) != -2)
34         if (ret == 0)
35             resfile = arg;
36         else if (ret == 'v')
37             log_init (LOG_ALL, prog, NULL);
38         else if (ret == 'p')
39             prefix = arg;
40         else
41         {
42             log (LOG_FATAL, "unknown option");
43             exit (1);
44         }
45     if (!resfile)
46     {
47         log (LOG_FATAL, "Now resource file given.");
48         exit (1);
49     }
50     res = res_open (resfile);
51     res_trav (res, prefix, res_print);
52     res_close (res);
53     return 0;
54 }