Mercurial > hg > octave-kai > gnulib-hg
view lib/basename.c @ 1192:fcb9d43860d6
(make_path): Try to change ownership only if we've just created the
directory. Fix latent bug (s/&&/||/ in two places -- also, note that
it could not be exercised via install or mkdir) whereby chown would
not be invoked when only one of owner/group is not -1.
author | Jim Meyering <jim@meyering.net> |
---|---|
date | Fri, 02 Jan 1998 23:15:39 +0000 |
parents | 498dc8724967 |
children | 29ccc7d6e9e9 |
line wrap: on
line source
/* basename.c -- return the last element in a path */ #if HAVE_CONFIG_H # include <config.h> #endif #ifndef FILESYSTEM_PREFIX_LEN # define FILESYSTEM_PREFIX_LEN(f) 0 #endif #ifndef ISSLASH # define ISSLASH(c) ((c) == '/') #endif /* In general, we can't use the builtin `basename' function if available, since it has different meanings in different environments. In some environments the builtin `basename' modifies its argument. */ char * base_name (name) char const *name; { char const *base = name += FILESYSTEM_PREFIX_LEN (name); for (; *name; name++) if (ISSLASH (*name)) base = name + 1; return (char *) base; }