2 * CDE - Common Desktop Environment
4 * Copyright (c) 1993-2012, The Open Group. All rights reserved.
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)
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
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
23 /* $XConsortium: c_api_book_test.C /main/5 1996/08/21 15:52:51 drk $ */
25 #include "oliasdb/DtMmdb.h"
29 void showBook(DtMmdbInfoRequest* req)
37 if ( req == 0 ) return ;
39 str = DtMmdbBookGetShortTitle(req, &l);
41 fprintf(stderr, " bookInfo: shortTitle=%s\n", str);
43 str = DtMmdbBookGetLongTitle(req, &l);
45 fprintf(stderr, " bookInfo: longTitle=%s\n", str);
47 id = DtMmdbBookGetTocObjectId(req);
49 fprintf(stderr, " bookInfo: TOC section id=%s\n", DtMmdbHandleToString(id));
52 x = DtMmdbBookGetSeqNum(req);
53 fprintf(stderr, " bookInfo: seqnum =%d\n", x);
55 str =DtMmdbBookGetSeqLIcense(req, &l);
57 fprintf(stderr, " bookInfo: license term=%s\n", str);
59 ids = DtMmdbBookGetTabList(req, &l);
61 for ( x=0; x<(int)l; x++ )
62 fprintf(stderr, " bookInfo: tab section id=%s\n", DtMmdbHandleToString(ids[x]));
64 DtMmdbFreeHandleList(ids);
67 /* TOC section's oid ask key */
69 int test_book1(int argc, char** argv)
73 DtMmdbInfoRequest* req = 0;
78 i = DtMmdbOpenInfoLib(argv[2], argv[3], DtMmdbFalse);
79 j = DtMmdbGetBookCaseByName(i, argv[3]);
81 req = newDtMmdbInfoRequestWithPrimaryOid(j, argv[4]);
84 DtMmdbFreeInfoRequest(req);
85 DtMmdbCloseInfoLib(i);
90 fprintf(stderr, "invalid arguments\n");
93 fprintf(stderr, "infolib desc=%d\n", i);
97 /* book's oid as key */
99 int test_book2(int argc, char** argv)
103 DtMmdbInfoRequest* req = 0;
108 i = DtMmdbOpenInfoLib(argv[2], argv[3], DtMmdbFalse);
109 j = DtMmdbGetBookCaseByName(i, argv[3]);
111 req = newDtMmdbInfoRequestWithSecondaryOid(j, argv[4]);
114 DtMmdbFreeInfoRequest(req);
115 DtMmdbCloseInfoLib(i);
120 fprintf(stderr, "invalid arguments\n");
123 fprintf(stderr, "infolib desc=%d\n", i);
127 /* book's seq number as key */
129 int test_book3(int argc, char** argv)
133 DtMmdbInfoRequest* req = 0;
138 i = DtMmdbOpenInfoLib(argv[2], argv[3], DtMmdbFalse);
139 j = DtMmdbGetBookCaseByName(i, argv[3]);
141 req = newDtMmdbInfoRequestWithSeqnum(j, argv[4]);
144 DtMmdbFreeInfoRequest(req);
145 DtMmdbCloseInfoLib(i);
150 fprintf(stderr, "invalid arguments\n");
153 fprintf(stderr, "infolib desc=%d\n", i);