BOOTSTRAP (kutils) functions


LIBRARY ROUTINE

kbasename - return the filename component of a pathname

LIBRARY CALL

char *kbasename(
   const char *pathname,
   char *return_base)

INPUT

OUTPUT

RETURN VALUE

filename component of pathname, NULL on error

DESCRIPTION

This routine searches an input pathname for the final occurance of a '/', and returns the string existing after it. If a '/' is not found, it looks for a '~', as in ~username. If neither a '/' or a '~' is found and the input string is not empty, then it will return the original string.

ADDITIONAL INFORMATION

none

EXAMPLES

none

SIDE EFFECTS

This routine kmalloc's the return string, and will remove whitespace (as defined by isspace() from the end of the string)

RESTRICTIONS

none

MODIFICATION

none

FILES

$BOOTSTRAP/objects/library/kutils/src/dir.c

SEE ALSO

kutils(3)

COPYRIGHT

Copyright (C) 1993 - 1997, Khoral Research, Inc. ("KRI") All rights reserved.