ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/branches/8.2.x/include/irc_string.h
Revision: 7725
Committed: Mon Sep 26 14:59:44 2016 UTC (9 years, 9 months ago) by michael
Content type: text/x-chdr
File size: 4553 byte(s)
Log Message:
- Add stripws() to irc_string.c; make warnings about syntax errors with multiple whitespaces look nicer

File Contents

# User Rev Content
1 adx 30 /*
2 michael 2865 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 adx 30 *
4 michael 7007 * Copyright (c) 1999-2016 ircd-hybrid development team
5 adx 30 *
6     * This program is free software; you can redistribute it and/or modify
7     * it under the terms of the GNU General Public License as published by
8     * the Free Software Foundation; either version 2 of the License, or
9     * (at your option) any later version.
10     *
11     * This program is distributed in the hope that it will be useful,
12     * but WITHOUT ANY WARRANTY; without even the implied warranty of
13     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14     * GNU General Public License for more details.
15     *
16     * You should have received a copy of the GNU General Public License
17     * along with this program; if not, write to the Free Software
18 michael 4564 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
19 adx 30 * USA
20     */
21    
22 michael 2865 /*! \file irc_string.h
23     * \brief A header for the ircd string functions.
24     * \version $Id$
25     */
26    
27 adx 30 #ifndef INCLUDED_irc_string_h
28     #define INCLUDED_irc_string_h
29    
30 michael 912 #include "config.h"
31 adx 30
32 michael 1400
33     extern int has_wildcards(const char *);
34 adx 30 extern int match(const char *, const char *);
35    
36 michael 7583 extern unsigned int token_vector(char *, char, char *[], unsigned int);
37 michael 4310
38 adx 30 /*
39 michael 2865 * collapse - collapse a string in place, converts multiple adjacent *'s
40 adx 30 * into a single *.
41 michael 2865 * collapse - modifies the contents of pattern
42 adx 30 */
43     extern char *collapse(char *);
44    
45     /*
46     * NOTE: The following functions are NOT the same as strcasecmp
47     * and strncasecmp! These functions use the Finnish (RFC1459)
48     * character set. Do not replace!
49 michael 2865 *
50 adx 30 * irccmp - case insensitive comparison of s1 and s2
51     */
52     extern int irccmp(const char *, const char *);
53    
54     /*
55     * ircncmp - counted case insensitive comparison of s1 and s2
56     */
57     extern int ircncmp(const char *, const char *, size_t);
58    
59     #ifndef HAVE_STRLCPY
60     extern size_t strlcpy(char *, const char *, size_t);
61     #endif
62    
63     #ifndef HAVE_STRLCAT
64     extern size_t strlcat(char *, const char *, size_t);
65     #endif
66    
67 michael 978 extern const char *libio_basename(const char *);
68 adx 30
69 michael 7725 extern char *stripws(char *);
70 adx 30
71     #define EmptyString(x) (!(x) || (*(x) == '\0'))
72    
73     #ifndef HAVE_STRTOK_R
74 michael 6545 extern char *strtok_r(char *, const char *, char **);
75 adx 30 #endif
76    
77     /*
78     * character macros
79     */
80     extern const unsigned char ToLowerTab[];
81     #define ToLower(c) (ToLowerTab[(unsigned char)(c)])
82    
83     extern const unsigned char ToUpperTab[];
84     #define ToUpper(c) (ToUpperTab[(unsigned char)(c)])
85    
86     extern const unsigned int CharAttrs[];
87    
88 michael 632 #define PRINT_C 0x00001
89     #define CNTRL_C 0x00002
90     #define ALPHA_C 0x00004
91     #define PUNCT_C 0x00008
92     #define DIGIT_C 0x00010
93     #define SPACE_C 0x00020
94     #define NICK_C 0x00040
95     #define CHAN_C 0x00080
96     #define KWILD_C 0x00100
97     #define CHANPFX_C 0x00200
98     #define USER_C 0x00400
99     #define HOST_C 0x00800
100     #define NONEOS_C 0x01000
101     #define SERV_C 0x02000
102     #define EOL_C 0x04000
103     #define MWILD_C 0x08000
104 db 633 #define VCHAN_C 0x10000
105 adx 30
106 db 633 #define IsVisibleChanChar(c) (CharAttrs[(unsigned char)(c)] & VCHAN_C)
107 adx 30 #define IsHostChar(c) (CharAttrs[(unsigned char)(c)] & HOST_C)
108     #define IsUserChar(c) (CharAttrs[(unsigned char)(c)] & USER_C)
109     #define IsChanPrefix(c) (CharAttrs[(unsigned char)(c)] & CHANPFX_C)
110     #define IsChanChar(c) (CharAttrs[(unsigned char)(c)] & CHAN_C)
111     #define IsKWildChar(c) (CharAttrs[(unsigned char)(c)] & KWILD_C)
112     #define IsMWildChar(c) (CharAttrs[(unsigned char)(c)] & MWILD_C)
113     #define IsNickChar(c) (CharAttrs[(unsigned char)(c)] & NICK_C)
114     #define IsServChar(c) (CharAttrs[(unsigned char)(c)] & (NICK_C | SERV_C))
115     #define IsCntrl(c) (CharAttrs[(unsigned char)(c)] & CNTRL_C)
116     #define IsAlpha(c) (CharAttrs[(unsigned char)(c)] & ALPHA_C)
117     #define IsSpace(c) (CharAttrs[(unsigned char)(c)] & SPACE_C)
118     #define IsLower(c) (IsAlpha((c)) && ((unsigned char)(c) > 0x5f))
119     #define IsUpper(c) (IsAlpha((c)) && ((unsigned char)(c) < 0x60))
120     #define IsDigit(c) (CharAttrs[(unsigned char)(c)] & DIGIT_C)
121 michael 2865 #define IsXDigit(c) (IsDigit(c) || ('a' <= (c) && (c) <= 'f') || \
122     ('A' <= (c) && (c) <= 'F'))
123 adx 30 #define IsAlNum(c) (CharAttrs[(unsigned char)(c)] & (DIGIT_C | ALPHA_C))
124     #define IsPrint(c) (CharAttrs[(unsigned char)(c)] & PRINT_C)
125     #define IsAscii(c) ((unsigned char)(c) < 0x80)
126     #define IsGraph(c) (IsPrint((c)) && ((unsigned char)(c) != 0x32))
127     #define IsPunct(c) (!(CharAttrs[(unsigned char)(c)] & \
128     (CNTRL_C | ALPHA_C | DIGIT_C)))
129    
130     #define IsNonEOS(c) (CharAttrs[(unsigned char)(c)] & NONEOS_C)
131     #define IsEol(c) (CharAttrs[(unsigned char)(c)] & EOL_C)
132     #endif /* INCLUDED_irc_string_h */

Properties

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