Go to the source code of this file.
Defines | |
| #define | MISCUTIL_H_VERSION "$Id: miscutil.h,v 2.0 2002/06/04 14:34:21 jongfoster Exp $" |
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 * | 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) |
| char * | chomp (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 * | basedir |
| const char | miscutil_rcs [] |
| const char | miscutil_h_rcs [] |
These are each too small to deserve their own file but don't really fit in any other file.
Revision 1.21 2002/04/26 12:55:38 oes New function string_toupper
Revision 1.20 2002/03/26 22:29:55 swa we have a new homepage!
Revision 1.19 2002/03/24 13:25:43 swa name change related issues
Revision 1.18 2002/03/07 03:46:17 oes Fixed compiler warnings
Revision 1.17 2002/03/04 18:28:32 oes Deleted deletePidFile, played syleguide police
Revision 1.16 2002/01/21 00:53:36 jongfoster Adding string_join()
Revision 1.15 2001/12/30 14:07:32 steudten
Revision 1.13 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.12 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.11 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.10 2001/09/20 13:34:09 steudten
change long to int for prototype hash_string()
Revision 1.9 2001/07/29 18:43:08 jongfoster Changing ifdef _FILENAME_H to FILENAME_H_INCLUDED, to conform to ANSI C rules.
Revision 1.8 2001/06/29 13:32:14 oes Removed logentry from cancelled commit
Revision 1.7 2001/06/05 22:32:01 jongfoster New function make_path() to splice directory and file names together.
Revision 1.6 2001/06/03 19:12:30 oes introduced bindup()
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.
|
1.2.15