/*
* Copyright (C) 2004-2007 Internet Systems Consortium, Inc. ("ISC")
* Copyright (C) 2000, 2001, 2003 Internet Software Consortium.
*
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND ISC DISCLAIMS ALL WARRANTIES WITH
* REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS. IN NO EVENT SHALL ISC BE LIABLE FOR ANY SPECIAL, DIRECT,
* INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
* LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE
* OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
* PERFORMANCE OF THIS SOFTWARE.
*/
/* $Id: string.h,v 1.23 2007/09/13 04:48:16 each Exp $ */
#ifndef ISC_STRING_H
#include <isc/formatcheck.h>
#include <isc/platform.h>
#include <string.h>
#ifdef ISC_PLATFORM_HAVESTRINGSH
#include <strings.h>
#endif
/*%<
* Convert the string pointed to by 'source' to isc_uint64_t.
*
* On successful conversion 'endp' points to the first character
* after conversion is complete.
*
* 'base': 0 or 2..36
*
* If base is 0 the base is computed from the string type.
*
* On error 'endp' points to 'source'.
*/
/*
* Copy the string pointed to by 'source' to 'target' which is a
* pointer to a string of at least 'size' bytes.
*
* Requires:
* 'target' is a pointer to a char[] of at least 'size' bytes.
* 'size' an integer > 0.
* 'source' == NULL or points to a NUL terminated string.
*
* Ensures:
* If result == ISC_R_SUCCESS
* 'target' will be a NUL terminated string of no more
* than 'size' bytes (including NUL).
*
* If result == ISC_R_NOSPACE
* 'target' is undefined.
*
* Returns:
* ISC_R_SUCCESS -- 'source' was successfully copied to 'target'.
* ISC_R_NOSPACE -- 'source' could not be copied since 'target'
* is too small.
*/
void
/*
* Copy the string pointed to by 'source' to 'target' which is a
* pointer to a string of at least 'size' bytes.
*
* Requires:
* 'target' is a pointer to a char[] of at least 'size' bytes.
* 'size' an integer > 0.
* 'source' == NULL or points to a NUL terminated string.
*
* Ensures:
* 'target' will be a NUL terminated string of no more
* than 'size' bytes (including NUL).
*/
/*
* Append the string pointed to by 'source' to 'target' which is a
* pointer to a NUL terminated string of at least 'size' bytes.
*
* Requires:
* 'target' is a pointer to a NUL terminated char[] of at
* least 'size' bytes.
* 'size' an integer > 0.
* 'source' == NULL or points to a NUL terminated string.
*
* Ensures:
* If result == ISC_R_SUCCESS
* 'target' will be a NUL terminated string of no more
* than 'size' bytes (including NUL).
*
* If result == ISC_R_NOSPACE
* 'target' is undefined.
*
* Returns:
* ISC_R_SUCCESS -- 'source' was successfully appended to 'target'.
* ISC_R_NOSPACE -- 'source' could not be appended since 'target'
* is too small.
*/
void
/*
* Append the string pointed to by 'source' to 'target' which is a
* pointer to a NUL terminated string of at least 'size' bytes.
*
* Requires:
* 'target' is a pointer to a NUL terminated char[] of at
* least 'size' bytes.
* 'size' an integer > 0.
* 'source' == NULL or points to a NUL terminated string.
*
* Ensures:
* 'target' will be a NUL terminated string of no more
* than 'size' bytes (including NUL).
*/
/*
* Print 'format' to 'target' which is a pointer to a string of at least
* 'size' bytes.
*
* Requires:
* 'target' is a pointer to a char[] of at least 'size' bytes.
* 'size' an integer > 0.
* 'format' == NULL or points to a NUL terminated string.
*
* Ensures:
* If result == ISC_R_SUCCESS
* 'target' will be a NUL terminated string of no more
* than 'size' bytes (including NUL).
*
* If result == ISC_R_NOSPACE
* 'target' is undefined.
*
* Returns:
* ISC_R_SUCCESS -- 'format' was successfully printed to 'target'.
* ISC_R_NOSPACE -- 'format' could not be printed to 'target' since it
* is too small.
*/
void
/*
* Print 'format' to 'target' which is a pointer to a string of at least
* 'size' bytes.
*
* Requires:
* 'target' is a pointer to a char[] of at least 'size' bytes.
* 'size' an integer > 0.
* 'format' == NULL or points to a NUL terminated string.
*
* Ensures:
* 'target' will be a NUL terminated string of no more
* than 'size' bytes (including NUL).
*/
char *
/*
* Copy the region pointed to by r to a NUL terminated string
* allocated from the memory context pointed to by mctx.
*
* The result should be deallocated using isc_mem_free()
*
* Requires:
* 'mctx' is a point to a valid memory context.
* 'source' is a pointer to a valid region.
*
* Returns:
* a pointer to a NUL terminated string or
* NULL if memory for the copy could not be allocated
*
*/
char *
#ifdef ISC_PLATFORM_NEEDSTRSEP
#endif
#ifdef ISC_PLATFORM_NEEDMEMMOVE
#endif
#ifdef ISC_PLATFORM_NEEDSTRLCPY
#endif
#ifdef ISC_PLATFORM_NEEDSTRLCAT
#endif
#endif /* ISC_STRING_H */