00001 #ifndef MISCUTIL_H_INCLUDED 00002 #define MISCUTIL_H_INCLUDED 00003 #define MISCUTIL_H_VERSION "$Id: miscutil.h,v 2.0 2002/06/04 14:34:21 jongfoster Exp $" 00004 /* ****************************************************************** 00005 * $Source: /cvsroot/ijbswa/current/src/miscutil.h,v $ 00006 * ****************************************************************** 00007 * 00008 * Written by and Copyright (C) 2001 the SourceForge 00009 * Privoxy team. http://www.privoxy.org/ 00010 * 00011 * Based on the Internet Junkbuster originally written 00012 * by and Copyright (C) 1997 Anonymous Coders and 00013 * Junkbusters Corporation. http://www.junkbusters.com 00014 * 00015 * This program is free software; you can redistribute it 00016 * and/or modify it under the terms of the GNU General 00017 * Public License as published by the Free Software 00018 * Foundation; either version 2 of the License, or (at 00019 * your option) any later version. 00020 * 00021 * This program is distributed in the hope that it will 00022 * be useful, but WITHOUT ANY WARRANTY; without even the 00023 * implied warranty of MERCHANTABILITY or FITNESS FOR A 00024 * PARTICULAR PURPOSE. See the GNU General Public 00025 * License for more details. 00026 * 00027 * The GNU General Public License should be included with 00028 * this file. If not, you can view it at 00029 * http://www.gnu.org/copyleft/gpl.html 00030 * or write to the Free Software Foundation, Inc., 59 00031 * Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00032 * 00033 * *****************************************************************/ 00034 /** 00035 * @file 00036 * 00037 * zalloc, hash_string, safe_strerror, strcmpic, 00038 * strncmpic, and MinGW32 strdup functions. These are 00039 * each too small to deserve their own file but don't 00040 * really fit in any other file. 00041 * 00042 * 00043 * $Log: miscutil.h,v $ 00044 * Revision 2.0 2002/06/04 14:34:21 jongfoster 00045 * Moving source files to src/ 00046 * 00047 * Revision 1.21 2002/04/26 12:55:38 oes 00048 * New function string_toupper 00049 * 00050 * Revision 1.20 2002/03/26 22:29:55 swa 00051 * we have a new homepage! 00052 * 00053 * Revision 1.19 2002/03/24 13:25:43 swa 00054 * name change related issues 00055 * 00056 * Revision 1.18 2002/03/07 03:46:17 oes 00057 * Fixed compiler warnings 00058 * 00059 * Revision 1.17 2002/03/04 18:28:32 oes 00060 * Deleted deletePidFile, played syleguide police 00061 * 00062 * Revision 1.16 2002/01/21 00:53:36 jongfoster 00063 * Adding string_join() 00064 * 00065 * Revision 1.15 2001/12/30 14:07:32 steudten 00066 * - Add signal handling (unix) 00067 * - Add SIGHUP handler (unix) 00068 * - Add creation of pidfile (unix) 00069 * - Add action 'top' in rc file (RH) 00070 * - Add entry 'SIGNALS' to manpage 00071 * - Add exit message to logfile (unix) 00072 * 00073 * Revision 1.14 2001/11/05 21:43:48 steudten 00074 * Add global var 'basedir' for unix os. 00075 * 00076 * Revision 1.13 2001/10/29 03:48:10 david__schmidt 00077 * OS/2 native needed a snprintf() routine. Added one to miscutil, brackedted 00078 * by and __OS2__ ifdef. 00079 * 00080 * Revision 1.12 2001/10/23 21:27:50 jongfoster 00081 * Standardising error codes in string_append 00082 * make_path() no longer adds '\\' if the dir already ends in '\\' (this 00083 * is just copying a UNIX-specific fix to the Windows-specific part) 00084 * 00085 * Revision 1.11 2001/10/14 22:02:57 jongfoster 00086 * New function string_append() which is like strsav(), but running 00087 * out of memory isn't automatically FATAL. 00088 * 00089 * Revision 1.10 2001/09/20 13:34:09 steudten 00090 * 00091 * change long to int for prototype hash_string() 00092 * 00093 * Revision 1.9 2001/07/29 18:43:08 jongfoster 00094 * Changing #ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to 00095 * ANSI C rules. 00096 * 00097 * Revision 1.8 2001/06/29 13:32:14 oes 00098 * Removed logentry from cancelled commit 00099 * 00100 * Revision 1.7 2001/06/05 22:32:01 jongfoster 00101 * New function make_path() to splice directory and file names together. 00102 * 00103 * Revision 1.6 2001/06/03 19:12:30 oes 00104 * introduced bindup() 00105 * 00106 * Revision 1.5 2001/06/01 10:31:51 oes 00107 * Added character class matching to trivimatch; renamed to simplematch 00108 * 00109 * Revision 1.4 2001/05/31 17:32:31 oes 00110 * 00111 * - Enhanced domain part globbing with infix and prefix asterisk 00112 * matching and optional unanchored operation 00113 * 00114 * Revision 1.3 2001/05/29 23:10:09 oes 00115 * 00116 * 00117 * - Introduced chomp() 00118 * - Moved strsav() from showargs to miscutil 00119 * 00120 * Revision 1.2 2001/05/29 09:50:24 jongfoster 00121 * Unified blocklist/imagelist/permissionslist. 00122 * File format is still under discussion, but the internal changes 00123 * are (mostly) done. 00124 * 00125 * Also modified interceptor behaviour: 00126 * - We now intercept all URLs beginning with one of the following 00127 * prefixes (and *only* these prefixes): 00128 * * http://i.j.b/ 00129 * * http://ijbswa.sf.net/config/ 00130 * * http://ijbswa.sourceforge.net/config/ 00131 * - New interceptors "home page" - go to http://i.j.b/ to see it. 00132 * - Internal changes so that intercepted and fast redirect pages 00133 * are not replaced with an image. 00134 * - Interceptors now have the option to send a binary page direct 00135 * to the client. (i.e. ijb-send-banner uses this) 00136 * - Implemented show-url-info interceptor. (Which is why I needed 00137 * the above interceptors changes - a typical URL is 00138 * "http://i.j.b/show-url-info?url=www.somesite.com/banner.gif". 00139 * The previous mechanism would not have intercepted that, and 00140 * if it had been intercepted then it then it would have replaced 00141 * it with an image.) 00142 * 00143 * Revision 1.1.1.1 2001/05/15 13:59:00 oes 00144 * Initial import of version 2.9.3 source tree 00145 * 00146 * 00147 */ 00148 /* *****************************************************************/ 00149 00150 00151 #include "project.h" 00152 00153 #if defined(__cplusplus) 00154 extern "C" { 00155 #endif 00156 00157 extern const char *basedir; 00158 extern void *zalloc(size_t size); 00159 00160 #if defined(unix) 00161 extern void write_pid_file(void); 00162 #endif /* unix */ 00163 00164 extern unsigned int hash_string(const char* s); 00165 00166 extern char *safe_strerror(int err); 00167 00168 extern int strcmpic(const char *s1, const char *s2); 00169 extern int strncmpic(const char *s1, const char *s2, size_t n); 00170 00171 extern char *strsav(char *old, const char *text_to_append); 00172 extern jb_err string_append(char **target_string, const char *text_to_append); 00173 extern jb_err string_join (char **target_string, char *text_to_append); 00174 00175 extern char *string_toupper(const char *string); 00176 extern char *chomp(char *string); 00177 extern int simplematch(char *pattern, char *text); 00178 00179 extern char *bindup(const char *string, size_t len); 00180 00181 extern char *make_path(const char * dir, const char * file); 00182 00183 #ifdef __MINGW32__ 00184 extern char *strdup(const char *s); 00185 #endif /* def __MINGW32__ */ 00186 00187 #ifdef __OS2__ 00188 extern int snprintf(char *, size_t, const char *, /*args*/ ...); 00189 #endif /* def __OS2__ */ 00190 00191 /* Revision control strings from this header and associated .c file */ 00192 00193 /** Version information about miscutil.c. */ 00194 extern const char miscutil_rcs[]; 00195 00196 /** Version information about miscutil.h. */ 00197 extern const char miscutil_h_rcs[]; 00198 00199 #if defined(__cplusplus) 00200 } 00201 #endif 00202 00203 #endif /* ndef MISCUTIL_H_INCLUDED */ 00204 00205 /* 00206 Local Variables: 00207 tab-width: 3 00208 end: 00209 */
1.2.15