include stdarg.h
[NeonServV5.git] / main.h
1 #ifndef _main_h
2 #define _main_h
3
4 #include <stdio.h>
5 #include <stdlib.h>
6 #include <string.h>
7 #include <ctype.h>
8 #include <sys/types.h>
9 #include <sys/socket.h>
10 #include <netinet/in.h>
11 #include <arpa/inet.h>
12 #include <unistd.h>
13 #include <netdb.h>
14 #include <stdarg.h>
15
16 #if __GNUC__
17 #define PRINTF_LIKE(M,N) __attribute__((format (printf, M, N)))
18 #else
19 #define PRINTF_LIKE(M,N)
20 #endif
21
22 #if __GNUC__ >= 2
23 #define UNUSED_ARG(ARG) ARG __attribute__((unused))
24 #elif defined(S_SPLINT_S)
25 #define UNUSED_ARG(ARG) /*@unused@*/ ARG
26 #define const /*@observer@*/ /*@temp@*/
27 #else
28 #define UNUSED_ARG(ARG) ARG
29 #endif
30
31 int stricmp (const char *s1, const char *s2)
32 {
33    if (s1 == NULL) return s2 == NULL ? 0 : -(*s2);
34    if (s2 == NULL) return *s1;
35    char c1, c2;
36    while ((c1 = tolower (*s1)) == (c2 = tolower (*s2)))
37    {
38      if (*s1 == '\0') break;
39      ++s1; ++s2;
40    }
41    return c1 - c2;
42 }
43
44
45 #define NICKLEN         30
46 #define USERLEN         10
47 #define HOSTLEN         63
48 #define REALLEN         50
49 #define TOPICLEN        500
50 #define CHANNELLEN      200
51 #define MAXLEN          512
52
53 //valid nick chars
54 #define VALID_NICK_CHARS "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890{|}~[\\]^_`"
55 //the first char is a little bit different
56 //                              0        1         2         3         4         5          6
57 //                              1234567890123456789012345678901234567890123456789012345678 9012   62
58 #define VALID_NICK_CHARS_FIRST "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~[\\]^_`"
59 #define VALID_NICK_CHARS_FIRST_LEN 62
60
61 #endif