miscutil.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. #include "project.h"
  39. #if defined(__cplusplus)
  40. extern "C" {
  41. #endif
  42. extern const char *basedir;
  43. extern void *zalloc(size_t size);
  44. extern void *zalloc_or_die(size_t size);
  45. extern char *strdup_or_die(const char *str);
  46. extern void *malloc_or_die(size_t buffer_size);
  47. #if defined(unix)
  48. extern void write_pid_file(const char *pid_file);
  49. #endif /* unix */
  50. extern unsigned int hash_string(const char* s);
  51. extern int strcmpic(const char *s1, const char *s2);
  52. extern int strncmpic(const char *s1, const char *s2, size_t n);
  53. extern jb_err string_append(char **target_string, const char *text_to_append);
  54. extern jb_err string_join (char **target_string, char *text_to_append);
  55. extern char *string_toupper(const char *string);
  56. extern char *string_tolower(const char *string);
  57. extern void string_move(char *dst, char *src);
  58. extern char *chomp(char *string);
  59. extern char *bindup(const char *string, size_t len);
  60. extern char *make_path(const char * dir, const char * file);
  61. long int pick_from_range(long int range);
  62. #if !defined(HAVE_TIMEGM) && defined(HAVE_TZSET) && defined(HAVE_PUTENV)
  63. time_t timegm(struct tm *tm);
  64. #endif /* !defined(HAVE_TIMEGM) && defined(HAVE_TZSET) && defined(HAVE_PUTENV) */
  65. /* Here's looking at you, Ulrich. */
  66. #if !defined(HAVE_STRLCPY)
  67. size_t privoxy_strlcpy(char *destination, const char *source, size_t size);
  68. #define strlcpy privoxy_strlcpy
  69. #define USE_PRIVOXY_STRLCPY 1
  70. #define HAVE_STRLCPY 1
  71. #endif /* ndef HAVE_STRLCPY*/
  72. #ifndef HAVE_STRLCAT
  73. size_t privoxy_strlcat(char *destination, const char *source, size_t size);
  74. #define strlcat privoxy_strlcat
  75. #endif /* ndef HAVE_STRLCAT */
  76. extern int privoxy_millisleep(unsigned milliseconds);
  77. extern struct tm *privoxy_gmtime_r(const time_t *time_spec, struct tm *result);
  78. #if defined(__cplusplus)
  79. }
  80. #endif
  81. #endif /* ndef MISCUTIL_H_INCLUDED */
  82. /*
  83. Local Variables:
  84. tab-width: 3
  85. end:
  86. */