summaryrefslogtreecommitdiff
path: root/support/dktools/test-dk4path8.c
blob: 2770be8f70c7ed7f17abea79966a73c084d0ce2f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*
	WARNING: This file was generated by dkct.
	Changes you make here will be lost if dkct is run again!
	You should modify the original source and run dkct on it.
	Original source: test-dk4path8.ctr
*/

/**	@file test-dk4path8.c The test-dk4path8 module.
*/


#line 1 "test-dk4path8.ctr"

#include <stdio.h>

#include "dk4path8.h"
#include "string.h"

static const char * const	p1[] = {
"/usr/local",
"my/file"
};

static const char * const	p2[] = {
"../erwin.txt",
"../../bla.blubb",
"../../../test.was.passiert",
"ganz-langer-test-was-nun-wohl-passiert"
};

int main(void)
{
  char buf[256];
  dk4_er_t	er;
  const size_t szp1 = sizeof(p1)/sizeof(DK4_PCHAR);
  const size_t szp2 = sizeof(p2)/sizeof(DK4_PCHAR);
  size_t i;
  size_t j;

  for (i = 0; i < szp1; i++) {
    for (j = 0; j < szp2; j++) {
      strcpy(buf, p1[i]);
      dk4error_init(&er);
      if (dk4path8_append(buf, sizeof(buf), p2[j], &er)) {
        printf("%u %u = \"%s\"\n", (unsigned)i, (unsigned)j, buf);
      } else {
        printf("%u %u ERROR %d\n", (unsigned)i, (unsigned)j, er.ec);
      }
    }
  }
  return 0;
}