Pristine Ack-5.5
[Ack-5.5.git] / lang / m2 / m2mm / lib.c
1 /*
2  * (c) copyright 1987 by the Vrije Universiteit, Amsterdam, The Netherlands.
3  * See the copyright notice in the ACK home directory, in the file "Copyright".
4  *
5  * Author: Ceriel J.H. Jacobs
6  */
7
8 /* L I B R A R Y */
9
10 /* $Id: lib.c,v 1.6 1994/06/24 12:45:12 ceriel Exp $ */
11
12 #include <em_path.h>
13 #include <alloc.h>
14 #include "main.h"
15
16 #ifdef OTHER_HOME
17 #undef EM_DIR
18 #define EM_DIR OTHER_HOME
19 #endif
20 static char lib_dir[128] = EM_DIR;
21
22 static struct liblist {
23         int libno;
24         struct liblist *libnext;
25 } *lblist;
26
27 int
28 is_library_dir(d)
29         char *d;
30 {
31         /*      Check if directory d is a directory containing
32                 "system" definition modules. Return 1 if it is, 0 otherwise.
33         */
34
35         register struct liblist *p = lblist;
36
37         while (p) {
38                 if (! strcmp(DEFPATH[p->libno], d)) return 1;
39                 p = p->libnext;
40         }
41         return 0;
42 }
43
44 #ifndef DEF_DIR
45 #define DEF_DIR "lib/m2"
46 #endif
47
48 init_lib()
49 {
50         extern char *strcat();
51
52         strcat(lib_dir, "/");
53         strcat(lib_dir, DEF_DIR);
54         AddLibDir(lib_dir);
55 }
56
57 set_libdir(n)
58 {
59         register struct liblist *p = 
60                 (struct liblist *) Malloc(sizeof(struct liblist));
61
62         p->libnext = lblist;
63         p->libno = n;
64         lblist = p;
65 }