Archived
1
0
Fork 0

path.c: added dirname_s function.

This commit is contained in:
Henrik Hautakoski 2011-02-11 19:17:38 +01:00
parent 79f18e6671
commit 546e7c50f1
4 changed files with 41 additions and 5 deletions

View file

@ -97,22 +97,24 @@ void test_dirname() {
int i;
char data[11][2][64] = {
char data[13][2][64] = {
{ "", "." },
{ "/", "/" },
{ "///", "/" },
{ ".", "."},
{ "..", "." },
{ "../", "." },
{ "../../rel", "../.." },
{ "./rel", "." },
{ "x", "." },
{ "justsomestring", "." },
{ "/usr/src/", "/usr" },
{ "/usr/src///", "/usr" },
{ "/usr/src/linux-2.6.30-r5/drivers", "/usr/src/linux-2.6.30-r5" }
};
for(i=0; i < 11; i++)
assert_string(dirname(data[i][0]), data[i][1]);
for(i=0; i < 12; i++)
assert_string(dirname_s(data[i][0], 0), data[i][1]);
}
int main(int argc, char *argv[]) {