Thread: [IRC-Dev CVS] Module ircdh: Change commited ircdh/include ircd_chattr.h,NONE,1.1 ircd_string.h,NONE,
Brought to you by:
zolty
From: Zolty <zo...@us...> - 2002-08-21 17:59:43
|
Update of /cvsroot/irc-dev/ircdh/include In directory usw-pr-cvs1:/tmp/cvs-serv10291/ircdh/include Modified Files: IPcheck.h support.h Added Files: ircd_chattr.h ircd_string.h Removed Files: common.h Log Message: 2002-08-21 Toni Garcia <zo...@ir...> * ircd/common.c/.h: Ha sido eliminado. * ircd/table_gen: La tabla de caracteres que estaba en common.c ha sido colocado en este nuevo fichero. * ircd/ircd_string.c/h: Las funciones que estaban en common.c y en support.c han sido movidos al nuevo fichero. Y se sustituyen en el codigo los "strtoken" por el nuevo "ircd_strtok". * Movidos los archivos viejos de "ChangeLog" de Hispano y Undernet al directorio doc/history. A partir de ahora se documentan los cambios en este fichero "ChangeLog". --- NEW FILE: ircd_chattr.h --- /* * IRC - Internet Relay Chat, include/ircd_chattr.h * Copyright (C) 1998 Andrea Cocito * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: ircd_chattr.h,v 1.1 2002/08/21 17:59:40 zolty Exp $ */ /* * All the code in common.h/common.c is taken from the NTL * (Nemesi's Tools Library), adapted for ircu's character set * and thereafter released under GNU GPL, from there comes the * NTL_ prefix of all macro and object names. * Removed isXdigit() to leave space to other char sets in the * bitmap, should give the same results as isxdigit() on any * implementation and isn't used in IRC anyway. */ #ifndef INCLUDED_ircd_chattr_h #define INCLUDED_ircd_chattr_h #ifndef INCLUDED_limits_h #include <limits.h> #define INCLUDED_limits_h #endif #ifndef INCLUDED_sys_types_h #include <sys/types.h> #define INCLUDED_sys_types_h #endif /* * Character attribute macros */ #define NTL_ALNUM 0x0001 /* (NTL_ALPHA | NTL_DIGIT) */ #define NTL_ALPHA 0x0002 /* (NTL_LOWER | NTL_UPPER) */ #define NTL_CNTRL 0x0004 /* \000 - \037 == 0x00 - 0x1F */ #define NTL_DIGIT 0x0008 /* 0123456789 */ #define NTL_GRAPH 0x0010 /* (NTL_ALNUM | NTL_PUNCT) */ #define NTL_LOWER 0x0020 /* abcdefghijklmnopqrstuvwxyz{|}~ */ #define NTL_PRINT 0x0040 /* (NTL_GRAPH | ' ') */ #define NTL_PUNCT 0x0080 /* !"#$%&'()*+,-./:;<=>?@_` */ #define NTL_SPACE 0x0100 /* \011\012\013\014\015\040 */ #define NTL_UPPER 0x0200 /* ABCDEFGHIJKLMNOPQRSTUVWXYZ[\]^ */ #define NTL_IRCCH 0x0400 /* Channel's names charset */ #define NTL_IRCCL 0x0800 /* Force toLower() in ch-name */ #define NTL_IRCNK 0x1000 /* Nick names charset, aka isvalid() */ #define NTL_IRCUI 0x2000 /* UserIDs charset, IRCHN plus tilde */ #define NTL_IRCHN 0x4000 /* Hostnames charset (weak, RFC 1033) */ #define NTL_IRCIP 0x8000 /* Numeric IPs charset (DIGIT and .) */ #define NTL_EOL 0x10000 /* \r\n */ #define NTL_KTIME 0x20000 /* Valid character for a k:line time */ #define NTL_CHPFX 0x40000 /* channel prefix char # & + */ /* * Tables used for translation and classification macros */ extern const char ToLowerTab_8859_1[]; extern const char ToUpperTab_8859_1[]; extern const unsigned int IRCD_CharAttrTab[]; /* * Translation macros for channel name case translation * NOTE: Channel names are supposed to be lower case insensitive for * ISO 8859-1 character sets. */ #define ToLower(c) (ToLowerTab_8859_1[(c) - CHAR_MIN]) #define ToUpper(c) (ToUpperTab_8859_1[(c) - CHAR_MIN]) /* * Character classification macros * NOTE: The IsUpper and IsLower macros do not apply to the complete * ISO 8859-1 character set, unlike the ToUpper and ToLower macros above. * IsUpper and IsLower only apply for comparisons of the US ASCII subset. */ #define IsAlnum(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_ALNUM) #define IsAlpha(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_ALPHA) #define IsDigit(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_DIGIT) #define IsLower(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_LOWER) #define IsSpace(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_SPACE) #define IsUpper(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_UPPER) #define IsCntrl(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_CNTRL) #define IsChannelChar(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_IRCCH) #define IsChannelLower(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_IRCCL) #define IsChannelPrefix(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_CHPFX) #define IsNickChar(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_IRCNK) #define IsUserChar(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_IRCUI) #define IsHostChar(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_IRCHN) #define IsIPChar(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_IRCIP) #define IsEol(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_EOL) #define IsKTimeChar(c) (IRCD_CharAttrTab[(c) - CHAR_MIN] & NTL_KTIME) #endif /* INCLUDED_ircd_chattr_h */ --- NEW FILE: ircd_string.h --- /* * IRC - Internet Relay Chat, ircd/ircd_string.h * Copyright (C) 1999 Thomas Helvey * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 1, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * * $Id: ircd_string.h,v 1.1 2002/08/21 17:59:40 zolty Exp $ */ #ifndef INCLUDED_ircd_string_h #define INCLUDED_ircd_string_h #ifndef INCLUDED_config_h #include "config.h" #endif #ifndef INCLUDED_ircd_chattr_h #include "ircd_chattr.h" #endif #include <netinet/in.h> /* * Macros */ #define EmptyString(x) (!(x) || !(*x)) extern char *ircd_strncpy(char *dest, const char *src, size_t len); extern int ircd_strcmp(const char *a, const char *b); extern int ircd_strncmp(const char *a, const char *b, size_t n); extern int unique_name_vector(char *names, char token, char **vector, int size); extern int token_vector(char *names, char token, char **vector, int size); /* provisional */ extern char *inetntoa(struct in_addr in); extern const char *ircd_ntoa(const char *addr); extern const char *ircd_ntoa_r(char *buf, const char *addr); extern char *host_from_uh(char *buf, const char *userhost, size_t len); extern char *ircd_strtok(char **save, char *str, char *fs); #if 0 extern char *sprintf_irc(char *str, const char *format, ...); #endif extern char *canonize(char *buf); /* #define DupString(x, y) (strcpy((x = (char*) MyMalloc(strlen(y) + 1)), y)) */ #define DupString(x, y) (strcpy((x = (char*) RunMalloc(strlen(y) + 1)), y)) /* String classification pseudo-functions, when others are needed add them, strIsXxxxx(s) is true when IsXxxxx(c) is true for every char in s */ #define strIsAlnum(s) (strChattr(s) & NTL_ALNUM) #define strIsAlpha(s) (strChattr(s) & NTL_ALPHA) #define strIsDigit(s) (strChattr(s) & NTL_DIGIT) #define strIsLower(s) (strChattr(s) & NTL_LOWER) #define strIsSpace(s) (strChattr(s) & NTL_SPACE) #define strIsUpper(s) (strChattr(s) & NTL_UPPER) #define strIsIrcCh(s) (strChattr(s) & NTL_IRCCH) #define strIsIrcCl(s) (strChattr(s) & NTL_IRCCL) #define strIsIrcNk(s) (strChattr(s) & NTL_IRCNK) #define strIsIrcUi(s) (strChattr(s) & NTL_IRCUI) #define strIsIrcHn(s) (strChattr(s) & NTL_IRCHN) #define strIsIrcIp(s) (strChattr(s) & NTL_IRCIP) /* * Critical small functions to inline even in separate compilation * when FORCEINLINE is defined (provided you have a compiler that supports * `inline'). */ #define NTL_HDR_strChattr unsigned int strChattr(const char *s) #define NTL_SRC_strChattr const char *rs = s; \ unsigned int x = ~0; \ while(*rs) \ x &= IRCD_CharAttrTab[*rs++ - CHAR_MIN]; \ return x; /* * XXX - bleah should return 1 if different 0 if the same */ #define NTL_HDR_strCasediff int strCasediff(const char *a, const char *b) #define NTL_SRC_strCasediff const char *ra = a; \ const char *rb = b; \ while(ToLower(*ra) == ToLower(*rb++)) \ if(!*ra++) \ return 0; \ return 1; #ifndef FORCEINLINE extern NTL_HDR_strChattr; extern NTL_HDR_strCasediff; #else /* FORCEINLINE */ #ifdef __cplusplus inline NTL_HDR_strChattr { NTL_SRC_strChattr } inline NTL_HDR_strCasediff { NTL_SRC_strCasediff } #else static __inline__ NTL_HDR_strChattr { NTL_SRC_strChattr } static __inline__ NTL_HDR_strCasediff { NTL_SRC_strCasediff } #endif #endif /* FORCEINLINE */ /* * Proto types of other externally visible functions */ extern int strnChattr(const char *s, const size_t n); #endif /* INCLUDED_ircd_string_h */ Index: IPcheck.h =================================================================== RCS file: /cvsroot/irc-dev/ircdh/include/IPcheck.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- IPcheck.h 18 Aug 2002 22:59:22 -0000 1.3 +++ IPcheck.h 21 Aug 2002 17:59:40 -0000 1.4 @@ -15,7 +15,8 @@ #include <netinet/in.h> /* in_addr */ #define INCLUDED_netinet_in_h #endif - +/* Provisional */ +#include "h.h" /* * Prototypes Index: support.h =================================================================== RCS file: /cvsroot/irc-dev/ircdh/include/support.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- support.h 18 Aug 2002 22:59:22 -0000 1.3 +++ support.h 21 Aug 2002 17:59:40 -0000 1.4 @@ -1,12 +1,12 @@ /* * support.h * - * $Id: + * $Id$ */ #ifndef INCLUDED_support_h #define INCLUDED_support_h #ifndef INCLUDED_config_h -//#include "config.h" +#include "config.h" #define INCLUDED_config_h #endif #if 0 @@ -20,22 +20,9 @@ * Prototypes */ -#include <netinet/in.h> - -/*============================================================================= - * Proto types - */ - -#ifndef HAVE_STRTOKEN -extern char *strtoken(char **save, char *str, char *fs); -#endif -#ifndef HAVE_STRERROR -extern char *strerror(int err_no); -#endif extern void dumpcore(const char *pattern, ...) __attribute__ ((format(printf, 1, 2))); -extern char *inetntoa(struct in_addr in); extern int check_if_ipmask(const char *mask); extern void write_log(const char *filename, const char *pattern, ...); -#endif /* SUPPORT_H */ +#endif /* INCLUDED_support_h */ --- common.h DELETED --- |