2 * Copyright (c) 1995-2004, Index Data
3 * See the file LICENSE for details.
5 * $Id: initopt.c,v 1.2 2004-01-15 10:16:27 adam Exp $
12 #include <yaz/proto.h>
18 {"search", Z_Options_search},
19 {"present", Z_Options_present},
20 {"delSet", Z_Options_delSet},
21 {"resourceReport", Z_Options_resourceReport},
22 {"triggerResourceCtrl", Z_Options_triggerResourceCtrl},
23 {"resourceCtrl", Z_Options_resourceCtrl},
24 {"accessCtrl", Z_Options_accessCtrl},
25 {"scan", Z_Options_scan},
26 {"sort", Z_Options_sort},
27 {"extendedServices", Z_Options_extendedServices},
28 {"level_1Segmentation", Z_Options_level_1Segmentation},
29 {"level_2Segmentation", Z_Options_level_2Segmentation},
30 {"concurrentOperations", Z_Options_concurrentOperations},
31 {"namedResultSets", Z_Options_namedResultSets},
32 {"encapsulation", Z_Options_encapsulation},
33 {"resultCount", Z_Options_resultCount},
34 {"negotiationModel", Z_Options_negotiationModel},
35 {"duplicationDetection", Z_Options_duplicateDetection},
36 {"queryType104", Z_Options_queryType104},
37 {"pQESCorrection", Z_Options_pQESCorrection},
38 {"stringSchema", Z_Options_stringSchema},
42 int yaz_init_opt_encode(Z_Options *opt, const char *opt_str, int *error_pos)
44 const char *cp = opt_str;
51 if (*cp == ' ' || *cp == ',')
56 for (i = 0; i < (sizeof(this_opt)-1) &&
57 cp[i] && cp[i] != ' ' && cp[i] != ','; i++)
60 for (j = 0; opt_array[j].name; j++)
62 if (yaz_matchstr(this_opt, opt_array[j].name) == 0)
64 ODR_MASK_SET(opt, opt_array[j].opt);
68 if (!opt_array[j].name)
72 *error_pos = cp - opt_str;
81 void yaz_init_opt_decode(Z_Options *opt, void (*pr)(const char *name,
86 for (i = 0; opt_array[i].name; i++)
87 if (ODR_MASK_GET(opt, opt_array[i].opt))
88 (*pr)(opt_array[i].name, clientData);