/[svn]/ircd-hybrid-7.3/include/irc_string.h
ViewVC logotype

Annotation of /ircd-hybrid-7.3/include/irc_string.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1045 - (hide annotations)
Tue Jan 26 12:58:42 2010 UTC (10 years, 6 months ago) by michael
File MIME type: text/x-csrc
File size: 5374 byte(s)
- contrib/spy_links_notice.c: do not show additional arguments supplied to the
  LINKS command in spy notices. new behaviour is to simply show the command sent
  by the client, which exactly behaves like all other contributed spy modules.
- remove clean_string()

1 adx 30 /*
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 knight 31 * $Id$
23 adx 30 */
24    
25     #ifndef INCLUDED_irc_string_h
26     #define INCLUDED_irc_string_h
27    
28 michael 912 #include "config.h"
29 adx 30
30 michael 1009 extern int ircd_pcre_exec(const void *, const char *);
31     extern void *ircd_pcre_compile(const char *, const char **);
32 adx 30
33     /*
34     * match - compare name with mask, mask may contain * and ? as wildcards
35     * match - returns 1 on successful match, 0 otherwise
36     *
37     * match_esc - compare with support for escaping chars
38     * match_chan - like match_esc with first character auto-escaped
39     */
40     extern int match(const char *, const char *);
41     extern int match_esc(const char *, const char *);
42     extern int match_chan(const char *, const char *);
43    
44     /*
45     * collapse - collapse a string in place, converts multiple adjacent *'s
46     * into a single *.
47     * collapse - modifies the contents of pattern
48     *
49     * collapse_esc() - collapse with support for escaping chars
50     */
51     extern char *collapse(char *);
52     extern char *collapse_esc(char *);
53    
54     /*
55     * NOTE: The following functions are NOT the same as strcasecmp
56     * and strncasecmp! These functions use the Finnish (RFC1459)
57     * character set. Do not replace!
58     *
59     * irccmp - case insensitive comparison of s1 and s2
60     */
61     extern int irccmp(const char *, const char *);
62    
63     /*
64     * ircncmp - counted case insensitive comparison of s1 and s2
65     */
66     extern int ircncmp(const char *, const char *, size_t);
67    
68     /*
69     * inetntoa - optimized inet_ntoa
70     */
71     extern const char *inetntoa(const char *);
72    
73     /* XXX
74     * inetntop()
75     * portable interface for inet_ntop(), kludge; please use inet_ntop if possible
76     * since inet_misc has a more conformant one
77     */
78     extern const char *inetntop(int, const void *, char *, unsigned int);
79    
80     #ifndef HAVE_STRLCPY
81     extern size_t strlcpy(char *, const char *, size_t);
82     #endif
83    
84     #ifndef HAVE_STRLCAT
85     extern size_t strlcat(char *, const char *, size_t);
86     #endif
87    
88 michael 978 extern const char *libio_basename(const char *);
89 adx 30
90     /*
91     * strip_tabs - convert tabs to spaces
92     * - jdc
93     */
94     extern void strip_tabs(char *, const char *, size_t);
95    
96     const char *myctime(time_t);
97    
98     #define EmptyString(x) (!(x) || (*(x) == '\0'))
99    
100     #ifndef HAVE_STRTOK_R
101     extern char *strtoken(char **, char *, const char *);
102     #endif
103    
104     /*
105     * character macros
106     */
107     extern const unsigned char ToLowerTab[];
108     #define ToLower(c) (ToLowerTab[(unsigned char)(c)])
109    
110     extern const unsigned char ToUpperTab[];
111     #define ToUpper(c) (ToUpperTab[(unsigned char)(c)])
112    
113     extern const unsigned int CharAttrs[];
114    
115 michael 632 #define PRINT_C 0x00001
116     #define CNTRL_C 0x00002
117     #define ALPHA_C 0x00004
118     #define PUNCT_C 0x00008
119     #define DIGIT_C 0x00010
120     #define SPACE_C 0x00020
121     #define NICK_C 0x00040
122     #define CHAN_C 0x00080
123     #define KWILD_C 0x00100
124     #define CHANPFX_C 0x00200
125     #define USER_C 0x00400
126     #define HOST_C 0x00800
127     #define NONEOS_C 0x01000
128     #define SERV_C 0x02000
129     #define EOL_C 0x04000
130     #define MWILD_C 0x08000
131 db 633 #define VCHAN_C 0x10000
132 adx 30
133 db 633 #define IsVisibleChanChar(c) (CharAttrs[(unsigned char)(c)] & VCHAN_C)
134 adx 30 #define IsHostChar(c) (CharAttrs[(unsigned char)(c)] & HOST_C)
135     #define IsUserChar(c) (CharAttrs[(unsigned char)(c)] & USER_C)
136     #define IsChanPrefix(c) (CharAttrs[(unsigned char)(c)] & CHANPFX_C)
137     #define IsChanChar(c) (CharAttrs[(unsigned char)(c)] & CHAN_C)
138     #define IsKWildChar(c) (CharAttrs[(unsigned char)(c)] & KWILD_C)
139     #define IsMWildChar(c) (CharAttrs[(unsigned char)(c)] & MWILD_C)
140     #define IsNickChar(c) (CharAttrs[(unsigned char)(c)] & NICK_C)
141     #define IsServChar(c) (CharAttrs[(unsigned char)(c)] & (NICK_C | SERV_C))
142     #define IsCntrl(c) (CharAttrs[(unsigned char)(c)] & CNTRL_C)
143     #define IsAlpha(c) (CharAttrs[(unsigned char)(c)] & ALPHA_C)
144     #define IsSpace(c) (CharAttrs[(unsigned char)(c)] & SPACE_C)
145     #define IsLower(c) (IsAlpha((c)) && ((unsigned char)(c) > 0x5f))
146     #define IsUpper(c) (IsAlpha((c)) && ((unsigned char)(c) < 0x60))
147     #define IsDigit(c) (CharAttrs[(unsigned char)(c)] & DIGIT_C)
148     #define IsXDigit(c) (IsDigit(c) || ('a' <= (c) && (c) <= 'f') || \
149     ('A' <= (c) && (c) <= 'F'))
150     #define IsAlNum(c) (CharAttrs[(unsigned char)(c)] & (DIGIT_C | ALPHA_C))
151     #define IsPrint(c) (CharAttrs[(unsigned char)(c)] & PRINT_C)
152     #define IsAscii(c) ((unsigned char)(c) < 0x80)
153     #define IsGraph(c) (IsPrint((c)) && ((unsigned char)(c) != 0x32))
154     #define IsPunct(c) (!(CharAttrs[(unsigned char)(c)] & \
155     (CNTRL_C | ALPHA_C | DIGIT_C)))
156    
157     #define IsNonEOS(c) (CharAttrs[(unsigned char)(c)] & NONEOS_C)
158     #define IsEol(c) (CharAttrs[(unsigned char)(c)] & EOL_C)
159    
160     #endif /* INCLUDED_irc_string_h */

Properties

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

svnadmin@ircd-hybrid.org
ViewVC Help
Powered by ViewVC 1.1.28