ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/libio/string/irc_string.h
Revision: 153
Committed: Mon Oct 17 21:20:34 2005 UTC (20 years, 9 months ago) by adx
Content type: text/x-chdr
File size: 5789 byte(s)
Log Message:
- compile libio as a dll on win32
- next step is compiling the whole ircd as a dll to export its symbols
- after that, we'll be able to support loadable *.dll modules.

NOTE: m_operspy.c doesn't compile now (error at localClient->iline)

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced Internet Relay Chat Daemon(ircd).
3 * irc_string.h: A header for the ircd string functions.
4 *
5 * Copyright (C) 2002 by the past and present ircd coders, and others.
6 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 * USA
21 *
22 * $Id$
23 */
24
25 LIBIO_EXTERN int ircd_pcre_exec(const pcre *, const char *);
26 LIBIO_EXTERN pcre *ircd_pcre_compile(const char *, const char **);
27 LIBIO_EXTERN char *xstrldup(const char *, size_t);
28
29 /*
30 * match - compare name with mask, mask may contain * and ? as wildcards
31 * match - returns 1 on successful match, 0 otherwise
32 *
33 * match_esc - compare with support for escaping chars
34 * match_chan - like match_esc with first character auto-escaped
35 * match_cidr - compares u!h@addr with u!h@addr/cidr
36 */
37 LIBIO_EXTERN int match(const char *, const char *);
38 LIBIO_EXTERN int match_esc(const char *, const char *);
39 LIBIO_EXTERN int match_chan(const char *, const char *);
40 LIBIO_EXTERN int match_cidr(const char *, const char *);
41
42 /*
43 * collapse - collapse a string in place, converts multiple adjacent *'s
44 * into a single *.
45 * collapse - modifies the contents of pattern
46 *
47 * collapse_esc() - collapse with support for escaping chars
48 */
49 LIBIO_EXTERN char *collapse(char *);
50 LIBIO_EXTERN char *collapse_esc(char *);
51
52 /*
53 * NOTE: The following functions are NOT the same as strcasecmp
54 * and strncasecmp! These functions use the Finnish (RFC1459)
55 * character set. Do not replace!
56 *
57 * irccmp - case insensitive comparison of s1 and s2
58 */
59 LIBIO_EXTERN int irccmp(const char *, const char *);
60
61 /*
62 * ircncmp - counted case insensitive comparison of s1 and s2
63 */
64 LIBIO_EXTERN int ircncmp(const char *, const char *, size_t);
65
66 /*
67 * inetntoa - optimized inet_ntoa
68 */
69 LIBIO_EXTERN const char *inetntoa(const char *);
70
71 /* XXX
72 * inetntop()
73 * portable interface for inet_ntop(), kludge; please use inet_ntop if possible
74 * since inet_misc has a more conformant one
75 */
76 LIBIO_EXTERN const char *inetntop(int, const void *, char *, unsigned int);
77
78 #ifndef HAVE_STRLCPY
79 LIBIO_EXTERN size_t strlcpy(char *, const char *, size_t);
80 #endif
81
82 #ifndef HAVE_STRLCAT
83 LIBIO_EXTERN size_t strlcat(char *, const char *, size_t);
84 #endif
85
86 #ifndef HAVE_SNPRINTF
87 LIBIO_EXTERN int snprintf(char *, size_t, const char *,...);
88 #endif
89
90 #ifndef HAVE_VSNPRINTF
91 LIBIO_EXTERN int vsnprintf(char *, size_t, const char *, va_list);
92 #endif
93
94 #ifndef HAVE_BASENAME
95 LIBIO_EXTERN char *basename(char *);
96 #endif
97
98 /*
99 * clean_string - cleanup control and high ascii characters
100 * -Dianora
101 */
102 LIBIO_EXTERN char *clean_string(char *, const unsigned char *, size_t);
103
104 LIBIO_EXTERN char *stripws(char *);
105
106 /*
107 * strip_tabs - convert tabs to spaces
108 * - jdc
109 */
110 LIBIO_EXTERN void strip_tabs(char *, const char *, size_t);
111
112 const char *myctime(time_t);
113
114 #define EmptyString(x) (!(x) || (*(x) == '\0'))
115
116 #ifndef HAVE_STRTOK_R
117 LIBIO_EXTERN char *strtoken(char **, char *, const char *);
118 #endif
119
120 /*
121 * character macros
122 */
123 LIBIO_EXTERN const unsigned char ToLowerTab[];
124 #define ToLower(c) (ToLowerTab[(unsigned char)(c)])
125
126 LIBIO_EXTERN const unsigned char ToUpperTab[];
127 #define ToUpper(c) (ToUpperTab[(unsigned char)(c)])
128
129 LIBIO_EXTERN const unsigned int CharAttrs[];
130
131 #define PRINT_C 0x001
132 #define CNTRL_C 0x002
133 #define ALPHA_C 0x004
134 #define PUNCT_C 0x008
135 #define DIGIT_C 0x010
136 #define SPACE_C 0x020
137 #define NICK_C 0x040
138 #define CHAN_C 0x080
139 #define KWILD_C 0x100
140 #define CHANPFX_C 0x200
141 #define USER_C 0x400
142 #define HOST_C 0x800
143 #define NONEOS_C 0x1000
144 #define SERV_C 0x2000
145 #define EOL_C 0x4000
146 #define MWILD_C 0x8000
147
148 #define IsHostChar(c) (CharAttrs[(unsigned char)(c)] & HOST_C)
149 #define IsUserChar(c) (CharAttrs[(unsigned char)(c)] & USER_C)
150 #define IsChanPrefix(c) (CharAttrs[(unsigned char)(c)] & CHANPFX_C)
151 #define IsChanChar(c) (CharAttrs[(unsigned char)(c)] & CHAN_C)
152 #define IsKWildChar(c) (CharAttrs[(unsigned char)(c)] & KWILD_C)
153 #define IsMWildChar(c) (CharAttrs[(unsigned char)(c)] & MWILD_C)
154 #define IsNickChar(c) (CharAttrs[(unsigned char)(c)] & NICK_C)
155 #define IsServChar(c) (CharAttrs[(unsigned char)(c)] & (NICK_C | SERV_C))
156 #define IsCntrl(c) (CharAttrs[(unsigned char)(c)] & CNTRL_C)
157 #define IsAlpha(c) (CharAttrs[(unsigned char)(c)] & ALPHA_C)
158 #define IsSpace(c) (CharAttrs[(unsigned char)(c)] & SPACE_C)
159 #define IsLower(c) (IsAlpha((c)) && ((unsigned char)(c) > 0x5f))
160 #define IsUpper(c) (IsAlpha((c)) && ((unsigned char)(c) < 0x60))
161 #define IsDigit(c) (CharAttrs[(unsigned char)(c)] & DIGIT_C)
162 #define IsXDigit(c) (IsDigit(c) || ('a' <= (c) && (c) <= 'f') || \
163 ('A' <= (c) && (c) <= 'F'))
164 #define IsAlNum(c) (CharAttrs[(unsigned char)(c)] & (DIGIT_C | ALPHA_C))
165 #define IsPrint(c) (CharAttrs[(unsigned char)(c)] & PRINT_C)
166 #define IsAscii(c) ((unsigned char)(c) < 0x80)
167 #define IsGraph(c) (IsPrint((c)) && ((unsigned char)(c) != 0x32))
168 #define IsPunct(c) (!(CharAttrs[(unsigned char)(c)] & \
169 (CNTRL_C | ALPHA_C | DIGIT_C)))
170
171 #define IsNonEOS(c) (CharAttrs[(unsigned char)(c)] & NONEOS_C)
172 #define IsEol(c) (CharAttrs[(unsigned char)(c)] & EOL_C)

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision