Disable fast-redirects for .hagalil.com/
[privoxy.git] / miscutil.h
1 #ifndef MISCUTIL_H_INCLUDED
2 #define MISCUTIL_H_INCLUDED
3 /*********************************************************************
4  *
5  * File        :  $Source: /cvsroot/ijbswa/current/miscutil.h,v $
6  *
7  * Purpose     :  zalloc, hash_string, strcmpic, strncmpic, and
8  *                MinGW32 strdup functions.  These are each too small
9  *                to deserve their own file but don't really fit in
10  *                any other file.
11  *
12  * Copyright   :  Written by and Copyright (C) 2001-2011 the
13  *                Privoxy team. https://www.privoxy.org/
14  *
15  *                Based on the Internet Junkbuster originally written
16  *                by and Copyright (C) 1997 Anonymous Coders and
17  *                Junkbusters Corporation.  http://www.junkbusters.com
18  *
19  *                This program is free software; you can redistribute it
20  *                and/or modify it under the terms of the GNU General
21  *                Public License as published by the Free Software
22  *                Foundation; either version 2 of the License, or (at
23  *                your option) any later version.
24  *
25  *                This program is distributed in the hope that it will
26  *                be useful, but WITHOUT ANY WARRANTY; without even the
27  *                implied warranty of MERCHANTABILITY or FITNESS FOR A
28  *                PARTICULAR PURPOSE.  See the GNU General Public
29  *                License for more details.
30  *
31  *                The GNU General Public License should be included with
32  *                this file.  If not, you can view it at
33  *                http://www.gnu.org/copyleft/gpl.html
34  *                or write to the Free Software Foundation, Inc., 59
35  *                Temple Place - Suite 330, Boston, MA  02111-1307, USA.
36  *
37  *********************************************************************/
38
39
40 #include "project.h"
41
42 #if defined(__cplusplus)
43 extern "C" {
44 #endif
45
46 extern const char *basedir;
47 extern void *zalloc(size_t size);
48 extern void *zalloc_or_die(size_t size);
49 extern char *strdup_or_die(const char *str);
50 extern void *malloc_or_die(size_t buffer_size);
51
52 #if defined(unix)
53 extern void write_pid_file(const char *pid_file);
54 #endif /* unix */
55
56 extern unsigned int hash_string(const char* s);
57
58 extern int strcmpic(const char *s1, const char *s2);
59 extern int strncmpic(const char *s1, const char *s2, size_t n);
60
61 extern jb_err string_append(char **target_string, const char *text_to_append);
62 extern jb_err string_join  (char **target_string,       char *text_to_append);
63 extern char *string_toupper(const char *string);
64 extern char *string_tolower(const char *string);
65 extern void string_move(char *dst, char *src);
66
67 extern char *chomp(char *string);
68 extern char *bindup(const char *string, size_t len);
69
70 extern char *make_path(const char * dir, const char * file);
71
72 long int pick_from_range(long int range);
73
74 #if !defined(HAVE_TIMEGM) && defined(HAVE_TZSET) && defined(HAVE_PUTENV)
75 time_t timegm(struct tm *tm);
76 #endif /* !defined(HAVE_TIMEGM) && defined(HAVE_TZSET) && defined(HAVE_PUTENV) */
77
78 /* Here's looking at you, Ulrich. */
79 #if !defined(HAVE_STRLCPY)
80 size_t privoxy_strlcpy(char *destination, const char *source, size_t size);
81 #define strlcpy privoxy_strlcpy
82 #define USE_PRIVOXY_STRLCPY 1
83 #define HAVE_STRLCPY 1
84 #endif /* ndef HAVE_STRLCPY*/
85
86 #ifndef HAVE_STRLCAT
87 size_t privoxy_strlcat(char *destination, const char *source, size_t size);
88 #define strlcat privoxy_strlcat
89 #endif /* ndef HAVE_STRLCAT */
90
91 extern int privoxy_millisleep(unsigned milliseconds);
92 extern struct tm *privoxy_gmtime_r(const time_t *time_spec, struct tm *result);
93
94 #if defined(__cplusplus)
95 }
96 #endif
97
98 #endif /* ndef MISCUTIL_H_INCLUDED */
99
100 /*
101   Local Variables:
102   tab-width: 3
103   end:
104 */