OpenIndiana and Solaris port
[oweals/cde.git] / cde / programs / dtinfo / DtMmdb / oliasdb / c_api.C
1 /*
2  * CDE - Common Desktop Environment
3  *
4  * Copyright (c) 1993-2012, The Open Group. All rights reserved.
5  *
6  * These libraries and programs are free software; you can
7  * redistribute them and/or modify them under the terms of the GNU
8  * Lesser General Public License as published by the Free Software
9  * Foundation; either version 2 of the License, or (at your option)
10  * any later version.
11  *
12  * These libraries and programs are distributed in the hope that
13  * they will be useful, but WITHOUT ANY WARRANTY; without even the
14  * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
15  * PURPOSE. See the GNU Lesser General Public License for more
16  * details.
17  *
18  * You should have received a copy of the GNU Lesser General Public
19  * License along with these librararies and programs; if not, write
20  * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
21  * Floor, Boston, MA 02110-1301 USA
22  */
23 /* $XConsortium: c_api.C /main/4 1996/08/21 15:52:45 drk $ */
24
25 #include "oliasdb/DtMmdb.h"
26 #include <stdio.h>
27
28 #if ( ARCH == hpux)
29 extern "C"
30 char __pure_virtual_called()
31 {
32    return 0;
33 }
34 #endif
35
36
37 #ifdef DEBUG
38
39 extern "C"
40 void usage(int argc, char** argv)
41 {
42    fprintf(stderr, "Usage:\n");
43    fprintf(stderr, "   %s 0 libpath [bookcaseName]\n", argv[0]);
44    fprintf(stderr, "   %s 1 libpath bookcaseName locator (show bookcase)\n", argv[0]);
45    fprintf(stderr, "   %s 2 libpath bookcaseName locator (show section)\n", argv[0]);
46    fprintf(stderr, "   %s 3 libpath bookcaseName mmdboid (show section)\n", argv[0]);
47    fprintf(stderr, "   %s 4 libpath bookcaseName mmdboid (show TOC)\n", argv[0]);
48    fprintf(stderr, "   %s 5 libpath bookcaseName loc (show LOC)\n", argv[0]);
49    fprintf(stderr, "   %s 6 libpath bookcaseName mmdboid (show LOC)\n", argv[0]);
50    fprintf(stderr, "   %s 7 libpath bookcaseName loc (show graphic)\n", argv[0]);
51    fprintf(stderr, "   %s 8 libpath bookcaseName mmdboid (show graphic)\n", argv[0]);
52    fprintf(stderr, "   %s 9 libpath bookcaseName loc (show stylesheet)\n", argv[0]);
53    fprintf(stderr, "   %s 10 libpath bookcaseName mmdboid (show stylesheet)\n", argv[0]);
54    fprintf(stderr, "   %s 11 libpath bookcaseName mmdboid (show dlp)\n", argv[0]);
55    fprintf(stderr, "   %s 12 libpath bookcaseName TOC_section_mmdboid (show book)\n", argv[0]);
56    fprintf(stderr, "   %s 13 libpath bookcaseName book_mmdboid (show book)\n", argv[0]);
57    fprintf(stderr, "   %s 14 libpath bookcaseName book_seq_num (show book)\n", argv[0]);
58 }
59
60 extern "C" int test0(int argc, char** argv);
61 extern "C" int test1(int argc, char** argv);
62 extern "C" int test2(int argc, char** argv);
63 extern "C" int test3(int argc, char** argv);
64 extern "C" int test4(int argc, char** argv);
65 extern "C" int test_loc1(int argc, char** argv);
66 extern "C" int test_loc2(int argc, char** argv);
67 extern "C" int test_graphic1(int argc, char** argv);
68 extern "C" int test_graphic2(int argc, char** argv);
69 extern "C" int test_ss1(int argc, char** argv);
70 extern "C" int test_ss2(int argc, char** argv);
71 extern "C" int test_dlp(int argc, char** argv);
72 extern "C" int test_book1(int argc, char** argv);
73 extern "C" int test_book2(int argc, char** argv);
74 extern "C" int test_book3(int argc, char** argv);
75 #endif
76
77 extern "C"
78 main( int argc, char** argv )
79 {
80    DtMmdbInit();
81
82
83 #ifdef DEBUG
84    if ( argc == 1 || 0==isdigit(argv[1][0]) ) {
85       usage(argc, argv);
86    } else
87       switch ( atoi(argv[1]) ) {
88         case 0:
89           test0(argc, argv);
90           break;
91         case 1:
92           test1(argc, argv);
93           break;
94         case 2:
95           test2(argc, argv);
96           break;
97         case 3:
98           test3(argc, argv);
99           break;
100         case 4:
101           test4(argc, argv);
102           break;
103         case 5:
104           test_loc1(argc, argv);
105           break;
106         case 6:
107           test_loc2(argc, argv);
108           break;
109         case 7:
110           test_graphic1(argc, argv);
111           break;
112         case 8:
113           test_graphic2(argc, argv);
114           break;
115         case 9:
116           test_ss1(argc, argv);
117           break;
118         case 10:
119           test_ss2(argc, argv);
120           break;
121         case 11:
122           test_dlp(argc, argv);
123           break;
124         case 12:
125           test_book1(argc, argv);
126           break;
127         case 13:
128           test_book2(argc, argv);
129           break;
130         case 14:
131           test_book3(argc, argv);
132           break;
133         default:
134           usage(argc, argv);
135       }
136 #endif
137
138    DtMmdbQuit();
139
140    exit(0);
141 }
142