.TH QDBM 3 "2003-10-13" "Man Page" "Programmer's Manual" .SH NAME Cabin \- the utility API of QDBM .SH SYNOPSIS .PP .B #include .br .B #include .PP .B extern void (*cbfatalfunc)(const char *message); .br .B void *cbmalloc(size_t size); .br .B void *cbrealloc(void *ptr, size_t size); .br .B char *cbmemdup(const char *ptr, int size); .br .B void cbisort(void *base, int nmemb, int size, int(*compar)(const void *, const void *)); .br .B void cbssort(void *base, int nmemb, int size, int(*compar)(const void *, const void *)); .br .B void cbhsort(void *base, int nmemb, int size, int(*compar)(const void *, const void *)); .br .B void cbqsort(void *base, int nmemb, int size, int(*compar)(const void *, const void *)); .br .B CBDATUM *cbdatumopen(const char *ptr, int size); .br .B CBDATUM *cbdatumdup(const CBDATUM *datum); .br .B void cbdatumclose(CBDATUM *datum); .br .B void cbdatumcat(CBDATUM *datum, const char *ptr, int size); .br .B const char *cbdatumptr(const CBDATUM *datum); .br .B int cbdatumsize(const CBDATUM *datum); .br .B void cbdatumsetsize(CBDATUM *datum, int size); .br .B CBLIST *cblistopen(void); .br .B CBLIST *cblistdup(const CBLIST *list); .br .B void cblistclose(CBLIST *list); .br .B int cblistnum(const CBLIST *list); .br .B const char *cblistval(const CBLIST *list, int index, int *sp); .br .B void cblistpush(CBLIST *list, const char *ptr, int size); .br .B char *cblistpop(CBLIST *list, int *sp); .br .B void cblistunshift(CBLIST *list, const char *ptr, int size); .br .B char *cblistshift(CBLIST *list, int *sp); .br .B void cblistinsert(CBLIST *list, int index, const char *ptr, int size); .br .B char *cblistremove(CBLIST *list, int index, int *sp); .br .B void cblistsort(CBLIST *list); .br .B int cblistlsearch(const CBLIST *list, const char *ptr, int size); .br .B int cblistbsearch(const CBLIST *list, const char *ptr, int size); .br .B char *cblistdump(const CBLIST *list, int *sp); .br .B CBLIST *cblistload(const char *ptr, int size); .br .B CBMAP *cbmapopen(void); .br .B CBMAP *cbmapdup(CBMAP *map); .br .B void cbmapclose(CBMAP *map); .br .B int cbmapput(CBMAP *map, const char *kbuf, int ksiz, const char *vbuf, int vsiz, int over); .br .B int cbmapout(CBMAP *map, const char *kbuf, int ksiz); .br .B const char *cbmapget(const CBMAP *map, const char *kbuf, int ksiz, int *sp); .br .B int cbmapmove(CBMAP *map, const char *kbuf, int ksiz, int head); .br .B void cbmapiterinit(CBMAP *map); .br .B const char *cbmapiternext(CBMAP *map, int *sp); .br .B int cbmaprnum(const CBMAP *map); .br .B char *cbmapdump(const CBMAP *map, int *sp); .br .B CBMAP *cbmapload(const char *ptr, int size); .br .B char *cbsprintf(const char *format, ...); .br .B char *cbreplace(const char *str, CBMAP *pairs); .br .B CBLIST *cbsplit(const char *ptr, int size, const char *delim); .br .B char *cbreadfile(const char *name, int *sp); .br .B CBLIST *cbreadlines(const char *name); .br .B CBLIST *cbdirlist(const char *name); .br .B int cbfilestat(const char *name, int *isdirp, int *sizep, int *mtimep); .br .B char *cburlencode(const char *ptr, int size); .br .B char *cburldecode(const char *str, int *sp); .br .B char *cbbaseencode(const char *ptr, int size); .br .B char *cbbasedecode(const char *str, int *sp); .br .B char *cbquoteencode(const char *ptr, int size); .br .B char *cbquotedecode(const char *str, int *sp); .br .B char *cbdeflate(const char *ptr, int size, int *sp); .br .B char *cbinflate(const char *ptr, int size, int *sp); .SH DESCRIPTION .PP Cabin is the utility API which provides memory allocating functions, sorting functions, extensible datum, array list, hash map, and so on for handling records easily on memory. .PP In order to use Cabin, you should include `cabin.h' and `stdlib.h' in the source files. Usually, the following description will be near the beginning of a source file. .PP .RS .B #include .br .B #include .RE .PP A pointer to `CBDATUM' is used as a handle of an extensible datum. A datum handle is opened with the function `cbdatumopen' and closed with `cbdatumclose'. A pointer to `CBLIST' is used as a handle of an array list. A list handle is opened with the function `cblistopen' and closed with `cblistclose'. A pointer to `CBMAP' is used as a handle of a hash map. A map handle is opened with the function `cbmapopen' and closed with `cbmapclose'. You should not refer directly to any member of each handles. .PP The external variable `cbfatalfunc' is the pointer to call back function for handling a fatal error. .TP .B extern void (*cbfatalfunc)(const char *message); The argument specifies the error message. The initial value of this variable is `NULL'. If the value is `NULL', the default function is called when a fatal error occurs. A fatal error occures when memory allocation is failed. .PP The function `cbmalloc' is used in order to allocate a region on memory. .TP .B void *cbmalloc(size_t size); `size' specifies the size of the region. The return value is the pointer to the allocated region. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cbrealloc' is used in order to re\-allocate a region on memory. .TP .B void *cbrealloc(void *ptr, size_t size); `ptr' specifies the pointer to a region. `size' specifies the size of the region. The return value is the pointer to the re\-allocated region. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `memdup' is used in order to duplicate a region on memory. .TP .B char *cbmemdup(const char *ptr, int size); `ptr' specifies the pointer to a region. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. The return value is the pointer to the allocated region of the duplicate. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cbisort' is used in order to sort an array using insert sort. .TP .B void cbisort(void *base, int nmemb, int size, int(*compar)(const void *, const void *)); `base' spacifies the pointer to an array. `nmemb' specifies the number of elements of the array. `size' specifies the size of each element. `compar' specifies the pointer to comparing function. The two arguments specify the pointers of elements. The comparing function should returns positive if the former is big, negative if the latter is big, 0 if both are equal. Insert sort is useful only if most elements have been sorted already. .PP The function `cbssort' is used in order to sort an array using shell sort. .TP .B void cbssort(void *base, int nmemb, int size, int(*compar)(const void *, const void *)); `base' spacifies the pointer to an array. `nmemb' specifies the number of elements of the array. `size' specifies the size of each element. `compar' specifies the pointer to comparing function. The two arguments specify the pointers of elements. The comparing function should returns positive if the former is big, negative if the latter is big, 0 if both are equal. If most elements have been sorted, shell sort may be faster than heap sort or quick sort. .PP The function `cbhsort' is used in order to sort an array using heap sort. .TP .B void cbhsort(void *base, int nmemb, int size, int(*compar)(const void *, const void *)); `base' spacifies the pointer to an array. `nmemb' specifies the number of elements of the array. `size' specifies the size of each element. `compar' specifies the pointer to comparing function. The two arguments specify the pointers of elements. The comparing function should returns positive if the former is big, negative if the latter is big, 0 if both are equal. Although heap sort is robust against bias of input, quick sort is faster in most cases. .PP The function `cbqsort' is used in order to sort an array using quick sort. .TP .B void cbqsort(void *base, int nmemb, int size, int(*compar)(const void *, const void *)); `base' spacifies the pointer to an array. `nmemb' specifies the number of elements of the array. `size' specifies the size of each element. `compar' specifies the pointer to comparing function. The two arguments specify the pointers of elements. The comparing function should returns positive if the former is big, negative if the latter is big, 0 if both are equal. Being sensitive to bias of input, quick sort is the fastest sorting algorithm. .PP The function `cbdatumopen' is used in order to get a datum handle. .TP .B CBDATUM *cbdatumopen(const char *ptr, int size); `ptr' specifies the pointer to the region of the initial content. If it is `NULL', an empty datum is created. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. The return value is a datum handle. .PP The function `cbdatumdup' is used in order to copy a datum. .TP .B CBDATUM *cbdatumdup(const CBDATUM *datum); `datum' specifies a datum handle. The return value is a new datum handle. .PP The function `cbdatumclose' is used in order to free a datum handle. .TP .B void cbdatumclose(CBDATUM *datum); `datum' specifies a datum handle. Because the region of a closed handle is released, it becomes impossible to use the handle. .PP The function `cbdatumcat' is used in order to concatenate a datum and a region. .TP .B void cbdatumcat(CBDATUM *datum, const char *ptr, int size); `datum' specifies a datum handle. `ptr' specifies the pointer to the region to be appended. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. .PP The function `cbdatumptr' is used in order to get the pointer of the region of a datum. .TP .B const char *cbdatumptr(const CBDATUM *datum); `datum' specifies a datum handle. The return value is the pointer of the region of a datum. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. .PP The function `cbdatumsize' is used in order to get the size of the region of a datum. .TP .B int cbdatumsize(const CBDATUM *datum); `datum' specifies a datum handle. The return value is the size of the region of a datum. .PP The function `cbdatumsetsize' is used in order to change the size of the region of a datum. .TP .B void cbdatumsetsize(CBDATUM *datum, int size); `datum' specifies a datum handle. `size' specifies the new size of the region. If the new size is bigger than the one of old, the surplus region is filled with zero codes. .PP The function `cblistopen' is used in order to get a list handle. .TP .B CBLIST *cblistopen(void); The return value is a list handle. .PP The function `cblistdup' is used in order to copy a list. .TP .B CBLIST *cblistdup(const CBLIST *list); `list' specifies a list handle. The return value is a new list handle. .PP The function `cblistclose' is used in order to close a list handle. .TP .B void cblistclose(CBLIST *list); `list' specifies a list handle. Because the region of a closed handle is released, it becomes impossible to use the handle. .PP The function `cblistnum' is used in order to get the number of elements of a list. .TP .B int cblistnum(const CBLIST *list); `list' specifies a list handle. The return value is the number of elements of the list. .PP The function `cblistval' is used in order to get the pointer to the region of an element. .TP .B const char *cblistval(const CBLIST *list, int index, int *sp); `list' specifies a list handle. `index' specifies the index of an element. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. The return value is the pointer to the region of the element. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. If `index' is equal to or more than the number of elements, the return value is `NULL'. .PP The function `cblistpush' is used in order to add an element at the end of a list. .TP .B void cblistpush(CBLIST *list, const char *ptr, int size); `list' specifies a list handle. `ptr' specifies the pointer to the region of an element. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. .PP The function `cblistpop' is used in order to remove an element of the end of a list. .TP .B char *cblistpop(CBLIST *list, int *sp); `list' specifies a list handle. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. The return value is the pointer to the region of the value. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. If the list is empty, the return value is `NULL'. .PP The function `cblistunshift' is used in order to add an element at the top of a list. .TP .B void cblistunshift(CBLIST *list, const char *ptr, int size); `list' specifies a list handle. `ptr' specifies the pointer to the region of an element. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. .PP The function `cblistshift' is used in order to remove an element of the top of a list. .TP .B char *cblistshift(CBLIST *list, int *sp); `list' specifies a list handle. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. The return value is the pointer to the region of the value. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. If the list is empty, the return value is `NULL'. .PP The function `cblistinsert' is used in orderto add an element at the specified location of a list. .TP .B void cblistinsert(CBLIST *list, int index, const char *ptr, int size); `list' specifies a list handle. `index' specifies the index of an element. `ptr' specifies the pointer to the region of the element. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. .PP The function `cblistremove' is used in order to remove an element at the specified location of a list. .TP .B char *cblistremove(CBLIST *list, int index, int *sp); `list' specifies a list handle. `index' specifies the index of an element. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. The return value is the pointer to the region of the value. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. If `index' is equal to or more than the number of elements, no element is removed and the return value is `NULL'. .PP The function `cblistsort' is used in order to sort elements of a list in lexical order. .TP .B void cblistsort(CBLIST *list); `list' specifies a list handle. Quick sort is used for sorting. .PP The function `cblistlsearch' is used in order to search a list for an element using liner search. .TP .B int cblistlsearch(const CBLIST *list, const char *ptr, int size); `list' specifies a list handle. `ptr' specifies the pointer to the region of a key. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. The return value is the index of a corresponding element or \-1 if there is no corresponding element. If two or more elements corresponds, the former returns. .PP The function `cblistbsearch' is used in order to search a list for an element using binary search. .TP .B int cblistbsearch(const CBLIST *list, const char *ptr, int size); `list' specifies a list handle. It should be sorted in lexical order. `ptr' specifies the pointer to the region of a key. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. The return value is the index of a corresponding element or \-1 if there is no corresponding element. If two or more elements corresponds, which returnes is not defined. .PP The function `cblistdump' is used in order to serialize a list into a byte array. .TP .B char *cblistdump(const CBLIST *list, int *sp); `list' specifies a list handle. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. The return value is the pointer to the region of the result serial region. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cblistload' is used in order to redintegrate a serialized list. .TP .B CBLIST *cblistload(const char *ptr, int size); `ptr' specifies the pointer to a byte array. `size' specifies the size of the region. The return value is a new list handle. .PP The function `cbmapopen' is used in order to get a map handle. .TP .B CBMAP *cbmapopen(void); The return value is a map handle. .PP The function `cbmapdup' is used in order to copy a map. .TP .B CBMAP *cbmapdup(CBMAP *map); `map' specifies a map handle. The return value is a new map handle. The iterator of the source map is initialized. .PP The function `cbmapclose' is used in order to close a map handle. .TP .B void cbmapclose(CBMAP *map); `map' specifies a map handle. Because the region of a closed handle is released, it becomes impossible to use the handle. .PP The function `cbmapput' is used in order to store a record. .TP .B int cbmapput(CBMAP *map, const char *kbuf, int ksiz, const char *vbuf, int vsiz, int over); `map' specifies a map handle. `kbuf' specifies the pointer to the region of a key. `ksiz' specifies the size of the region of the key. If it is negative, the size is assigned with `strlen(kbuf)'. `vbuf' specifies the pointer to the region of a value. `vsiz' specifies the size of the region of the value. If it is negative, the size is assigned with `strlen(vbuf)'. `over' specifies whether the value of the duplicated record is overwritten or not. If `over' is false and the key is duplicated, the return value is false, else, it is true. .PP The function `cbmapout' is used in order to delete a record. .TP .B int cbmapout(CBMAP *map, const char *kbuf, int ksiz); `map' specifies a map handle. `kbuf' specifies the pointer to the region of a key. `ksiz' specifies the size of the region of the key. If it is negative, the size is assigned with `strlen(kbuf)'. If successful, the return value is true. False is returned when no record corresponds to the specified key. .PP The function `cbmapget' is used in order to retrieve a record. .TP .B const char *cbmapget(const CBMAP *map, const char *kbuf, int ksiz, int *sp); `map' specifies a map handle. `kbuf' specifies the pointer to the region of a key. `ksiz' specifies the size of the region of the key. If it is negative, the size is assigned with `strlen(kbuf)'. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. If successful, the return value is the pointer to the region of the value of the corresponding record. `NULL' is returned when no record corresponds. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. .PP The function `cbmapmove' is used in order to move a record to the edge. .TP .B int cbmapmove(CBMAP *map, const char *kbuf, int ksiz, int head); `map' specifies a map handle. `kbuf' specifies the pointer to the region of a key. `ksiz' specifies the size of the region of the key. If it is negative, the size is assigned with `strlen(kbuf)'. `head' specifies the destination which is head if it is true or tail if else. If successful, the return value is true. False is returned when no record corresponds to the specified key. .PP The function `cbmapiterinit' is used in order to initialize the iterator of a map handle. .TP .B void cbmapiterinit(CBMAP *map); `map' specifies a map handle. The iterator is used in order to access the key of every record stored in a map. .PP The function `cbmapiternext' is used in order to get the next key of the iterator. .TP .B const char *cbmapiternext(CBMAP *map, int *sp); `map' specifies a map handle. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. If successful, the return value is the pointer to the region of the next key, else, it is `NULL'. `NULL' is returned when no record is to be get out of the iterator. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. The order of iteration is assured to be the same of the one of storing. .PP The function `cbmaprnum' is used in order to get the number of the records stored in a map. .TP .B int cbmaprnum(const CBMAP *map); `map' specifies a map handle. The return value is the number of the records stored in the map. .PP The function `cbmapdump' is used in order to serialize a map into a byte array. .TP .B char *cbmapdump(const CBMAP *map, int *sp); `map' specifies a map handle. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. The return value is the pointer to the region of the result serial region. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cbmapload' is used in order to redintegrate a serialized map. .TP .B CBMAP *cbmapload(const char *ptr, int size); `ptr' specifies the pointer to a byte array. `size' specifies the size of the region. The return value is a new map handle. .PP The function `cbsprintf' is used in order to allocate a formatted string on memory. .TP .B char *cbsprintf(const char *format, ...); `format' specifies a printf\-like format string. The conversion character `%' can be used with such flag characters as `d', `o', `u', `x', `X', `e', `E', `f', `g', `G', `c', `s', and `%'. Specifiers of the field length and the precision can be put between the conversion characters and the flag characters. The specifiers consist of decimal characters, `.', `+', `\-', and the space character. The other arguments are used according to the format string. The return value is the pointer to the allocated region of the result string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cbreplace' is used in order to replace some patterns in a string. .TP .B char *cbreplace(const char *str, CBMAP *pairs); `str' specifies the pointer to a source string. `pairs' specifies the handle of a map composed of pairs of replacement. The key of each pair specifies a pattern before replacement and its value specifies the pattern after replacement. The return value is the pointer to the allocated region of the result string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cbsplit' is used in order to make a list by splitting a serial datum. .TP .B CBLIST *cbsplit(const char *ptr, int size, const char *delim); `ptr' specifies the pointer to the region of the source content. If it is `NULL', an empty datum is created. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. `dalim' specifies a string containing delimiting characters. If it is `NULL', zero code is used as a delimiter. The return value is a list handle. Because the handle of the return value is opened with the function `cblistopen', it should be closed with the function `cblistclose'. .PP The function `cbreadfile' is used in order to read whole data of a file. .TP .B char *cbreadfile(const char *name, int *sp); `name' specifies the name of a file. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. The return value is the pointer to the allocated region of the read data. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cbreadlines' is used in order to read every line of a file. .TP .B CBLIST *cbreadlines(const char *name); `name' specifies the name of a file. The return value is a list handle of the lines if successful, else it is NULL. Line separators are cut out. .PP The function `cbdirlist' is used in order to read names of files in a directory. .TP .B CBLIST *cbdirlist(const char *name); `name' specifies the name of a directory. The return value is a list handle of names if successful, else it is NULL. .PP The function `cbfileinfo' is used in order to get the status of a file or a directory. .TP .B int cbfilestat(const char *name, int *isdirp, int *sizep, int *mtimep); `name' specifies the name of a file or a directory. `dirp' specifies the pointer to a variable to which whether the file is a directory is assigned. If it is `NULL', it is not used. `sizep' specifies the pointer to a variable to which the size of the file is assigned. If it is `NULL', it is not used. `mtimep' specifies the pointer to a variable to which the last modified time of the file is assigned. If it is `NULL', it is not used. If successful, the return value is true, else, false. False is returned when the file does not exist or the permission is denied. .PP The function `cburlencode' is used in order to encode a serial object with URL encoding. .TP .B char *cburlencode(const char *ptr, int size); `ptr' specifies the pointer to a region. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. The return value is the pointer to the result string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cburldecode' is used in order to decode a string encoded with URL encoding. .TP .B char *cburldecode(const char *str, int *sp); `str' specifies the pointer to a source string. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. The return value is the pointer to the region of the result. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cbbaseencode' is used in order to encode a serial object with Base64 encoding. .TP .B char *cbbaseencode(const char *ptr, int size); `ptr' specifies the pointer to a region. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. The return value is the pointer to the result string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cbbasedecode' is used in order to decode a string encoded with Base64 encoding. .TP .B char *cbbasedecode(const char *str, int *sp); `str' specifies the pointer to a source string. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. The return value is the pointer to the region of the result. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cbquoteencode' is used in order to encode a serial object with quoted\-printable encoding. .TP .B char *cbquoteencode(const char *ptr, int size); `ptr' specifies the pointer to a region. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. The return value is the pointer to the result string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cbquotedecode' is used in order to decode a string encoded with quoted\-printable encoding. .TP .B char *cbquotedecode(const char *str, int *sp); `str' specifies the pointer to a source string. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. The return value is the pointer to the region of the result. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. .PP The function `cbdeflate' is used in order to compress a serial object with ZLIB. .TP .B char *cbdeflate(const char *ptr, int size, int *sp); `ptr' specifies the pointer to a region. `size' specifies the size of the region. If it is negative, the size is assigned with `strlen(ptr)'. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If successful, the return value is the pointer to the result object, else, it is `NULL'. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. This function is available only if QDBM is built with enabling ZLIB. .PP The function `cbinflate' is used in order to decompress a serial object compressed with ZLIB. .TP .B char *cbinflate(const char *ptr, int size, int *sp); Decompress a serial object compressed with ZLIB. `ptr' specifies the pointer to a region. `size' specifies the size of the region. `sp' specifies the pointer to a variable to which the size of the region of the return value is assigned. If it is `NULL', it is not used. If successful, the return value is the pointer to the result object, else, it is `NULL'. Because an additional zero code is appended at the end of the region of the return value, the return value can be treated as a character string. Because the region of the return value is allocated with the `malloc' call, it should be released with the `free' call if it is no longer in use. This function is available only if QDBM is built with enabling ZLIB. .PP Each functions of Cabin is not reentrant, and not thread\-safe. .SH SEE ALSO .PP .BR qdbm (3), .BR depot (3), .BR curia (3), .BR relic (3), .BR hovel (3), .BR villa (3), .BR odeum (3), .BR ndbm (3), .BR gdbm (3)