1 /* This file is part of the YAZ toolkit.
2 * Copyright (C) 1995-2008 Index Data
3 * See the file LICENSE for details.
8 * \brief Implements Z39.50 Init Options Utility
15 #include <yaz/proto.h>
21 {"search", Z_Options_search},
22 {"present", Z_Options_present},
23 {"delSet", Z_Options_delSet},
24 {"resourceReport", Z_Options_resourceReport},
25 {"triggerResourceCtrl", Z_Options_triggerResourceCtrl},
26 {"resourceCtrl", Z_Options_resourceCtrl},
27 {"accessCtrl", Z_Options_accessCtrl},
28 {"scan", Z_Options_scan},
29 {"sort", Z_Options_sort},
30 {"extendedServices", Z_Options_extendedServices},
31 {"level_1Segmentation", Z_Options_level_1Segmentation},
32 {"level_2Segmentation", Z_Options_level_2Segmentation},
33 {"concurrentOperations", Z_Options_concurrentOperations},
34 {"namedResultSets", Z_Options_namedResultSets},
35 {"encapsulation", Z_Options_encapsulation},
36 {"resultCount", Z_Options_resultCount},
37 {"negotiationModel", Z_Options_negotiationModel},
38 {"duplicationDetection", Z_Options_duplicateDetection},
39 {"queryType104", Z_Options_queryType104},
40 {"pQESCorrection", Z_Options_pQESCorrection},
41 {"stringSchema", Z_Options_stringSchema},
45 int yaz_init_opt_encode(Z_Options *opt, const char *opt_str, int *error_pos)
47 const char *cp = opt_str;
54 if (*cp == ' ' || *cp == ',')
59 for (i = 0; i < (sizeof(this_opt)-1) &&
60 cp[i] && cp[i] != ' ' && cp[i] != ','; i++)
63 for (j = 0; opt_array[j].name; j++)
65 if (yaz_matchstr(this_opt, opt_array[j].name) == 0)
67 ODR_MASK_SET(opt, opt_array[j].opt);
71 if (!opt_array[j].name)
75 *error_pos = cp - opt_str;
84 void yaz_init_opt_decode(Z_Options *opt, void (*pr)(const char *name,
89 for (i = 0; opt_array[i].name; i++)
90 if (ODR_MASK_GET(opt, opt_array[i].opt))
91 (*pr)(opt_array[i].name, clientData);
96 * indent-tabs-mode: nil
98 * vim: shiftwidth=4 tabstop=8 expandtab