2 * Copyright (C) 1995-2005, Index Data ApS
3 * See the file LICENSE for details.
5 * $Id: initopt.c,v 1.6 2005-06-25 15:46:04 adam Exp $
10 * \brief Implements Z39.50 Init Options Utility
17 #include <yaz/proto.h>
23 {"search", Z_Options_search},
24 {"present", Z_Options_present},
25 {"delSet", Z_Options_delSet},
26 {"resourceReport", Z_Options_resourceReport},
27 {"triggerResourceCtrl", Z_Options_triggerResourceCtrl},
28 {"resourceCtrl", Z_Options_resourceCtrl},
29 {"accessCtrl", Z_Options_accessCtrl},
30 {"scan", Z_Options_scan},
31 {"sort", Z_Options_sort},
32 {"extendedServices", Z_Options_extendedServices},
33 {"level_1Segmentation", Z_Options_level_1Segmentation},
34 {"level_2Segmentation", Z_Options_level_2Segmentation},
35 {"concurrentOperations", Z_Options_concurrentOperations},
36 {"namedResultSets", Z_Options_namedResultSets},
37 {"encapsulation", Z_Options_encapsulation},
38 {"resultCount", Z_Options_resultCount},
39 {"negotiationModel", Z_Options_negotiationModel},
40 {"duplicationDetection", Z_Options_duplicateDetection},
41 {"queryType104", Z_Options_queryType104},
42 {"pQESCorrection", Z_Options_pQESCorrection},
43 {"stringSchema", Z_Options_stringSchema},
47 int yaz_init_opt_encode(Z_Options *opt, const char *opt_str, int *error_pos)
49 const char *cp = opt_str;
56 if (*cp == ' ' || *cp == ',')
61 for (i = 0; i < (sizeof(this_opt)-1) &&
62 cp[i] && cp[i] != ' ' && cp[i] != ','; i++)
65 for (j = 0; opt_array[j].name; j++)
67 if (yaz_matchstr(this_opt, opt_array[j].name) == 0)
69 ODR_MASK_SET(opt, opt_array[j].opt);
73 if (!opt_array[j].name)
77 *error_pos = cp - opt_str;
86 void yaz_init_opt_decode(Z_Options *opt, void (*pr)(const char *name,
91 for (i = 0; opt_array[i].name; i++)
92 if (ODR_MASK_GET(opt, opt_array[i].opt))
93 (*pr)(opt_array[i].name, clientData);
98 * indent-tabs-mode: nil
100 * vim: shiftwidth=4 tabstop=8 expandtab