BOOTSTRAP (kutils) functions
LIBRARY ROUTINE
kstring_ncat - concatenate two partial strings
LIBRARY CALL
char *kstring_ncat(
const char *istr1,
const char *istr2,
ssize_t num1,
ssize_t num2,
char *ostr)
INPUT
- istr1 - The first string to concatenate.
- istr2 - The second string to concatenate.
- num1 - The number of characters from 'istr1' to put in the
final string.
- num2 - The number of characters from 'istr2' to put in the
final string.
OUTPUT
- ostr - The string that holds the concatenated string.
If it's NULL, it allocates the necessary memory.
RETURN VALUE
The concatenated string 'ostr' if the variable is non-NULL,
or the allocated string if 'ostr' is NULL. If 'istr1'
and 'istr2' are NULL, or if 'num1' and 'num2' are both less
then or equal to zero, or an error occurs, then NULL is
returned.
DESCRIPTION
This routine concatenates two partial strings together,
into a third. If the output parameter, 'ostr', is not
NULL, the concatenated string is put into that
string. Otherwise, the resulting string is allocated
In either case, the resulting NULL-terminated string is
returned. The second partial string is added to the end
of the partial string first. Also, this routine puts a '\\0'
on the resulting string.
Note that if 'ostr' is non-NULL, the calling routine
must ensure that 'ostr' points to a memory buffer
large enough to hold the concatenated string and terminating
null character. If the buffer is not large enough,
memory will be overwritten resulting in unpredicable
program failure.
ADDITIONAL INFORMATION
none
EXAMPLES
none
SIDE EFFECTS
This routine uses kmalloc() to allocate a string
that holds the result, if 'ostr' is NULL.
RESTRICTIONS
none
MODIFICATION
none
FILES
$BOOTSTRAP/objects/library/kutils/src/strings.c
SEE ALSO
kutils(3)
COPYRIGHT
Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.