Functions | |
void * | zalloc (size_t size) |
unsigned int | hash_string (const char *s) |
char * | safe_strerror (int err) |
int | strcmpic (const char *s1, const char *s2) |
int | strncmpic (const char *s1, const char *s2, size_t n) |
char * | chomp (char *string) |
char * | strsav (char *old, const char *text_to_append) |
jb_err | string_append (char **target_string, const char *text_to_append) |
jb_err | string_join (char **target_string, char *text_to_append) |
char * | string_toupper (const char *string) |
int | simplematch (char *pattern, char *text) |
char * | bindup (const char *string, size_t len) |
char * | make_path (const char *dir, const char *file) |
Variables | |
const char | miscutil_rcs [] = "$Id: miscutil.c,v 2.1 2002/06/04 17:22:37 jongfoster Exp $" |
const char | miscutil_h_rcs [] = MISCUTIL_H_VERSION |
These are each too small to deserve their own file but don't really fit in any other file.
Revision 2.0 2002/06/04 14:34:21 jongfoster Moving source files to src/
Revision 1.37 2002/04/26 18:29:43 jongfoster Fixing this Visual C++ warning: miscutil.c(710) : warning C4090: '=' : different 'const' qualifiers
Revision 1.36 2002/04/26 12:55:38 oes New function string_toupper
Revision 1.35 2002/03/26 22:29:55 swa we have a new homepage!
Revision 1.34 2002/03/24 13:25:43 swa name change related issues
Revision 1.33 2002/03/07 03:46:53 oes Fixed compiler warnings etc
Revision 1.32 2002/03/06 23:02:57 jongfoster Removing tabs
Revision 1.31 2002/03/05 04:52:42 oes Deleted non-errlog debugging code
Revision 1.30 2002/03/04 18:27:42 oes
Revision 1.28 2002/03/03 09:18:03 joergs Made jumbjuster work on AmigaOS again.
Revision 1.27 2002/01/21 00:52:32 jongfoster Adding string_join()
Revision 1.26 2001/12/30 14:07:32 steudten
Revision 1.24 2001/11/05 21:41:43 steudten Add changes to be a real daemon just for unix os. (change cwd to /, detach from controlling tty, set process group and session leader to the own process. Add DBG() Macro. Add some fatal-error log message for failed malloc(). Add '-d' if compiled with 'configure --with-debug' to enable debug output.
Revision 1.23 2001/10/29 03:48:10 david__schmidt OS/2 native needed a snprintf() routine. Added one to miscutil, brackedted by and __OS2__ ifdef.
Revision 1.22 2001/10/26 17:39:38 oes Moved ijb_isspace and ijb_tolower to project.h
Revision 1.21 2001/10/23 21:27:50 jongfoster Standardising error codes in string_append make_path() no longer adds '\' if the dir already ends in '\' (this is just copying a UNIX-specific fix to the Windows-specific part)
Revision 1.20 2001/10/22 15:33:56 david__schmidt Special-cased OS/2 out of the Netscape-abort-on-404-in-js problem in filters.c. Added a FIXME in front of the offending code. I'll gladly put in a better/more robust fix for all parties if one is presented... It seems that just returning 200 instead of 404 would pretty much fix it for everyone, but I don't know all the history of the problem.
Revision 1.19 2001/10/14 22:02:57 jongfoster New function string_append() which is like strsav(), but running out of memory isn't automatically FATAL.
Revision 1.18 2001/09/20 13:33:43 steudten
change long to int as return value in hash_string(). Remember the wraparound for int = long = sizeof(4) - thats maybe not what we want.
Revision 1.17 2001/09/13 20:51:29 jongfoster Fixing potential problems with characters >=128 in simplematch() This was also a compiler warning.
Revision 1.16 2001/09/10 10:56:59 oes Silenced compiler warnings
Revision 1.15 2001/07/13 14:02:24 oes Removed vim-settings
Revision 1.14 2001/06/29 21:45:41 oes Indentation, CRLF->LF, Tab-> Space
Revision 1.13 2001/06/29 13:32:14 oes Removed logentry from cancelled commit
Revision 1.12 2001/06/09 10:55:28 jongfoster Changing BUFSIZ ==> BUFFER_SIZE
Revision 1.11 2001/06/07 23:09:19 jongfoster Cosmetic indentation changes.
Revision 1.10 2001/06/07 14:51:38 joergs make_path() no longer adds '/' if the dir already ends in '/'.
Revision 1.9 2001/06/07 14:43:17 swa slight mistake in make_path, unix path style is /.
Revision 1.8 2001/06/05 22:32:01 jongfoster New function make_path() to splice directory and file names together.
Revision 1.7 2001/06/03 19:12:30 oes introduced bindup()
Revision 1.6 2001/06/01 18:14:49 jongfoster Changing the calls to strerr() to check HAVE_STRERR (which is defined in config.h if appropriate) rather than the NO_STRERR macro.
Revision 1.5 2001/06/01 10:31:51 oes Added character class matching to trivimatch; renamed to simplematch
Revision 1.4 2001/05/31 17:32:31 oes
Revision 1.2 2001/05/29 09:50:24 jongfoster Unified blocklist/imagelist/permissionslist. File format is still under discussion, but the internal changes are (mostly) done.
Also modified interceptor behaviour:
|
Duplicate the first n characters of a string that may contain '\0' characters.
|
|
In-situ-eliminate all leading and trailing whitespace from a string.
|
|
Take a string and compute a (hopefuly) unique numeric integer value. This has several uses, but being able to "switch" a string the one of my favorites.
|
|
Variant of the library routine strerror() which will work on systems without the library routine, and which should never return NULL.
|
|
String matching, with a (greedy) '*' wildcard that stands for zero or more arbitrary characters and character classes in [], which take both enumerations and ranges.
|
|
Case insensitive string comparison.
|
|
Reallocate target_string and append text to it. This makes it easier to append to malloc'd strings. This is similar to the (removed) strsav(), but running out of memory isn't catastrophic. Programming style: The following style provides sufficient error checking for this routine, with minimal clutter in the source code. It is recommended if you have many calls to this function: char * s = strdup(...); // don't check for error string_append(&s, ...); // don't check for error string_append(&s, ...); // don't check for error string_append(&s, ...); // don't check for error if (NULL == s) { ... handle error ... } OR, equivalently: char * s = strdup(...); // don't check for error string_append(&s, ...); // don't check for error string_append(&s, ...); // don't check for error if (string_append(&s, ...)) {... handle error ...}
|
|
Join two strings together. Frees BOTH the original strings. If either or both input strings are NULL, fails as if it had run out of memory. For comparison, string_append requires that the second string is non-NULL, and doesn't free it. Rationale Too often, we want to do string_append(s, html_encode(s2)). That assert()s if s2 is NULL or if html_encode() runs out of memory. It also leaks memory. Proper checking is cumbersome. The solution: string_join(s, html_encode(s2)) is safe, and will free the memory allocated by html_encode().
|
|
Produce a copy of string with all convertible characters converted to uppercase.
|
|
Case insensitive string comparison (upto n characters).
|
|
Reallocate "old" and append text to it. This makes it easier to append to malloc'd strings. Running out of memory is a FATAL error.
|
|
Malloc some memory and set it to '\0'. The way calloc() ought to be -acjc
|
|
Version information about miscutil.h.
|
|
Version information about miscutil.c.
|