]> arthur.barton.de Git - netatalk.git/blob - include/atalk/util.h
big merge for db frontend and unicode.
[netatalk.git] / include / atalk / util.h
1 /*
2  * $Id: util.h,v 1.7.10.1 2003-09-09 16:42:20 didg Exp $
3  */
4
5 #ifndef _ATALK_UTIL_H
6 #define _ATALK_UTIL_H 1
7
8 #include <sys/cdefs.h>
9 #include <sys/types.h>
10 #ifdef HAVE_UNISTD_H
11 #include <unistd.h>
12 #endif /* HAVE_UNISTD_H */
13 #include <netatalk/at.h>
14
15 extern const int _diacasemap[], _dialowermap[];
16
17 extern char **getifacelist(void);
18 extern void freeifacelist(char **);
19
20 #define diatolower(x)     _dialowermap[(unsigned char) (x)]
21 #define diatoupper(x)     _diacasemap[(unsigned char) (x)]
22 extern int atalk_aton     __P((char *, struct at_addr *));
23 extern void bprint        __P((char *, int));
24 extern int strdiacasecmp  __P((const char *, const char *));
25 extern int strndiacasecmp __P((const char *, const char *, size_t));
26 extern pid_t server_lock  __P((char * /*program*/, char * /*file*/, 
27                                int /*debug*/));
28 extern void fault_setup   __P((void (*fn)(void *)));
29 #define server_unlock(x)  (unlink(x))
30
31 #ifndef HAVE_DLFCN_H
32 extern void *mod_open    __P((const char *));
33 extern void *mod_symbol  __P((void *, const char *));
34 extern void mod_close    __P((void *));
35 #define mod_error()      ""
36 #else /* ! HAVE_DLFCN_H */
37 #include <dlfcn.h>
38
39 #ifndef RTLD_NOW
40 #define RTLD_NOW 1
41 #endif /* ! RTLD_NOW */
42
43 /* NetBSD doesn't like RTLD_NOW for dlopen (it fails). Use RTLD_LAZY. */
44 #ifdef __NetBSD__
45 #define mod_open(a)      dlopen(a, RTLD_LAZY)
46 #else /* ! __NetBSD__ */
47 #define mod_open(a)      dlopen(a, RTLD_NOW)
48 #endif /* __NetBSD__ */
49
50 #ifndef DLSYM_PREPEND_UNDERSCORE
51 #define mod_symbol(a, b) dlsym(a, b)
52 #else /* ! DLSYM_PREPEND_UNDERSCORE */
53 extern void *mod_symbol  __P((void *, const char *));
54 #endif /* ! DLSYM_PREPEND_UNDERSCORE */
55 #define mod_error()      dlerror()
56 #define mod_close(a)     dlclose(a)
57 #endif /* ! HAVE_DLFCN_H */
58
59 #endif