File: dirnametest.cc

package info (click to toggle)
wvstreams 4.6.1-19
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,420 kB
  • sloc: cpp: 64,196; ansic: 4,154; sh: 4,025; makefile: 546; perl: 402
file content (24 lines) | stat: -rw-r--r-- 414 bytes parent folder | download | duplicates (11)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include "strutils.h"


void test(WvStringParm s)
{
    printf("'%s': '%s' -- '%s'\n",
	   s.cstr(), getdirname(s).cstr(), getfilename(s).cstr());
}


int main()
{
    WvString a("/tmp"), b("frog"), c("frog/bog/blog"), d("%s/", c),
              e("%s//", d), f("%s/zot", e), g(""), h("/big/fat/file");
    
    test(a);
    test(b);
    test(c);
    test(d);
    test(e);
    test(f);
    test(g);
    test(h);
}