2 Copyright © 2004, The AROS Development Team. All rights reserved.
5 POSIX.1-2008 function dirname().
11 #include <aros/debug.h>
13 /*****************************************************************************
24 Returns the string up to the latest '/'.
27 filename - Path which should be split
30 Directory part of the path.
43 ******************************************************************************/
48 if (!filename
|| *filename
== '\0')
50 D(bug("dirname()=.\n"));
54 uname
= (char *)__path_a2u(filename
);
58 if (pos
[0] == '/' && pos
[1] == '\0')
60 D(bug("dirname(/)=/\n"));
64 D(bug("dirname(%s)=", filename
));
66 pos
= uname
+ strlen(uname
);
67 while (pos
[-1] == '/')
84 D(bug("%s\n", uname
));