BOOTSTRAP (kutils) functions


LIBRARY ROUTINE

kdirname - find directory component of a given pathname

LIBRARY CALL

char *kdirname(
   const char *pathname,
   char *return_path)

INPUT

OUTPUT

RETURN VALUE

directory component of pathname, NULL on error

DESCRIPTION

This routine searches an input pathname for the final occurance of a '/', and returns the string existing before the '/'. If a '/' is not found, it looks for a '~', as in ~username. If neither a '/' or a '~' are found, it will assume the pathname does not have a directory component, and returns the 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 input 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.