BOOTSTRAP (kutils) functions


LIBRARY ROUTINE

kstring_copy - copy a string

LIBRARY CALL

char *kstring_copy(
   const char *istr,
   char       *ostr)

INPUT

OUTPUT

RETURN VALUE

If 'ostr' is non-NULL, it is returned. Otherwise the allocated string is returned. If 'istr' is NULL, or an error occurs, NULL is returned.

DESCRIPTION

This routine copies a string into another string. If the output parameter is not NULL, the concatenated string is put into that string. Otherwise, the resulting string is allocated via a call to kmalloc(). In either case, the resulting string is returned.

Note that if 'ostr' is non-NULL, the calling routine must ensure that 'ostr' points to a memory buffer large enough to hold the copied 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 create 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.