source: branches/branch-1-0/src/helpers/_test_vcard.c

Last change on this file was 209, checked in by umoeller, 23 years ago

Dialog formatter rewrite.

  • Property svn:eol-style set to CRLF
  • Property svn:keywords set to Author Date Id Revision
File size: 3.0 KB
Line 
1#define OS2EMX_PLAIN_CHAR
2 // this is needed for "os2emx.h"; if this is defined,
3 // emx will define PSZ as _signed_ char, otherwise
4 // as unsigned char
5
6#define INCL_DOSNLS
7#define INCL_DOSERRORS
8#define INCL_WINCOUNTRY
9#include <os2.h>
10
11#include <stdlib.h>
12#include <stdio.h>
13#include <string.h>
14
15#include "setup.h" // code generation and debugging options
16
17#include "helpers\dosh.h"
18#include "helpers\linklist.h"
19#include "helpers\nls.h"
20#include "helpers\standards.h"
21#include "helpers\stringh.h"
22#include "helpers\xstring.h"
23
24#define INCLUDE_VCARD_ALL
25#include "helpers\vcard.h"
26
27#pragma hdrstop
28
29
30VOID DumpList(ULONG ulLevel,
31 PLINKLIST pll)
32{
33 PLISTNODE pNode;
34 ULONG ul;
35
36 for (pNode = lstQueryFirstNode(pll);
37 pNode;
38 pNode = pNode->pNext)
39 {
40 PVCFPROPERTY pProp = (PVCFPROPERTY)pNode->pItemData;
41
42 {
43 CHAR szIndent[100];
44 ULONG x;
45 if (ulLevel)
46 memset(szIndent, ' ', ulLevel * 3);
47 szIndent[ulLevel * 3] = '\0';
48
49 printf("%sproperty \"%s\"\n",
50 szIndent,
51 pProp->strProperty.psz);
52
53 if (pProp->pllSubList)
54 DumpList(ulLevel + 1,
55 pProp->pllSubList);
56 else
57 {
58 ULONG ul2, c;
59 PXSTRING paStrings;
60
61 c = pProp->cParameters;
62 paStrings = pProp->pastrParameters;
63
64 for (ul2 = 0;
65 ul2 < c;
66 ul2++)
67 {
68 printf("%s param %d: \"%s\"\n",
69 szIndent,
70 ul2,
71 paStrings[ul2].psz);
72
73 }
74
75 c = pProp->cValues;
76 paStrings = pProp->pastrValues;
77
78 for (ul2 = 0;
79 ul2 < c;
80 ul2++)
81 {
82 printf("%s value %d: \"%s\"\n",
83 szIndent,
84 ul2,
85 paStrings[ul2].psz);
86
87 }
88 }
89 }
90 }
91}
92
93int main (int argc, char *argv[])
94{
95 if (argc <= 1)
96 {
97 printf("vcard "__DATE__"\n");
98 printf("Usage: vcard <filename>\n");
99 }
100 else
101 {
102 PVCARD pv;
103 APIRET arc;
104 ULONG ul;
105 if (!(arc = vcfRead(argv[1], &pv)))
106 {
107 DumpList(0, pv->pll);
108
109 printf("Formatted name: %s\n",
110 pv->pcszFormattedName);
111
112 for (ul = 0;
113 ul < 5;
114 ul++)
115 printf("Name field %d: %s\n",
116 ul,
117 pv->apcszName[ul]);
118
119 vcfFree(&pv);
120 }
121 else
122 printf("vcard: error %d\n", arc);
123
124 }
125
126 return 0;
127}
128
129
Note: See TracBrowser for help on using the repository browser.