File: dirnametest.cc

package info (click to toggle)
wvstreams 4.0.2-4
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 6,420 kB
  • ctags: 6,518
  • sloc: cpp: 52,544; sh: 5,770; ansic: 810; makefile: 461; tcl: 114; perl: 18
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);
}