Lines Matching defs:params
55 getoptstr_init(struct gos_params *params)
57 params->gos_pos = 1;
63 * With params->gos_opts set to a string of options and params->gos_strp set to
66 * params->gos_opts string. If the option is followed by a ':' in gos_opts,
67 * then params->gos_optargp will point to the beginning of the argument in
68 * the string, and params->gos_optarglen will contain its length.
70 * case, params->gos_strp is advanced to the next argument.
74 * params->gos_last_opt, and in the former case, params->gos_errp will
77 * ':' is the first character of params->gos_opts.
80 getoptstr(struct gos_params *params)
86 * const because we should update params. Just make sure you don't
87 * use this after you update params->gos_strp.
89 const char * const strp = params->gos_strp;
92 if (params->gos_opts == NULL || strp == NULL)
95 if (params->gos_pos == 1) {
107 params->gos_strp = &strp[2];
108 SKIP_SPC(params->gos_strp);
113 params->gos_last_opt = c = strp[params->gos_pos];
114 if (c == ':' || (cp = strchr(params->gos_opts, c)) == NULL) {
116 params->gos_errp = &strp[params->gos_pos];
117 ++params->gos_pos;
118 if (ISNTWORDCH(strp[params->gos_pos])) {
119 params->gos_strp = &strp[params->gos_pos];
120 SKIP_SPC(params->gos_strp);
121 params->gos_pos = 1;
129 params->gos_strp = &strp[params->gos_pos + 1];
131 if (ISNTWORDCH(*params->gos_strp)) {
133 SKIP_SPC(params->gos_strp);
135 if (*params->gos_strp == '\0') {
137 params->gos_pos = 1;
138 params->gos_optargp = NULL;
139 return (params->gos_opts[0] == ':' ? ':' : '?');
143 params->gos_optargp = params->gos_strp;
146 SKIP_WORD(params->gos_strp);
147 params->gos_optarglen = params->gos_strp - params->gos_optargp;
148 SKIP_SPC(params->gos_strp);
150 params->gos_pos = 1;
152 ++params->gos_pos;
153 if (ISNTWORDCH(strp[params->gos_pos])) {
154 params->gos_strp = &strp[params->gos_pos];
155 SKIP_SPC(params->gos_strp);
156 params->gos_pos = 1;
158 params->gos_optargp = NULL;