mirror of
https://github.com/GnoConsortium/gno.git
synced 2024-12-21 07:30:05 +00:00
basename.c:
If the argument provided to dirname(3) doesn't have a directory component, return "." instead of "".
This commit is contained in:
parent
50a2dce1b5
commit
e8879227c8
@ -1,7 +1,7 @@
|
|||||||
/*
|
/*
|
||||||
* These routines were written by Devin Reade for GNO v2.0.4.
|
* These routines were written by Devin Reade for GNO v2.0.4.
|
||||||
*
|
*
|
||||||
* $Id: basename.c,v 1.3 1997/09/21 06:04:59 gdr Exp $
|
* $Id: basename.c,v 1.4 1998/04/10 21:33:20 gdr-ftp Exp $
|
||||||
*
|
*
|
||||||
* This file is formatted for tabs every 8 columns.
|
* This file is formatted for tabs every 8 columns.
|
||||||
*/
|
*/
|
||||||
@ -71,7 +71,8 @@ dirname (const char *path)
|
|||||||
delim = strchr(dir,':') ? ':' : '/';
|
delim = strchr(dir,':') ? ':' : '/';
|
||||||
p = strrchr(dir,delim);
|
p = strrchr(dir,delim);
|
||||||
if (p == NULL) {
|
if (p == NULL) {
|
||||||
*dir = '\0';
|
*dir = '.';
|
||||||
|
*(dir+1) = '\0';
|
||||||
} else {
|
} else {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user