MCPcopy Create free account
hub / github.com/Singular/Singular / feSetOptValue

Function feSetOptValue

Singular/feOpt.cc:154–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

152
153static const char* feOptAction(feOptIndex opt);
154const char* feSetOptValue(feOptIndex opt, char* optarg)
155{
156 if (opt == FE_OPT_UNDEF) return "option undefined";
157
158 if (feOptSpec[opt].type != feOptUntyped)
159 {
160 if (feOptSpec[opt].type != feOptString)
161 {
162 if (optarg != NULL)
163 {
164 errno = 0;
165 feOptSpec[opt].value = (void*) strtol(optarg, NULL, 10);
166 if (errno) return "invalid integer argument";
167 }
168 else
169 {
170 feOptSpec[opt].value = (void*) 0;
171 }
172 }
173 else
174 {
175 assume(feOptSpec[opt].type == feOptString);
176 if (feOptSpec[opt].set && feOptSpec[opt].value != NULL)
177 omFree(feOptSpec[opt].value);
178 if (optarg != NULL)
179 feOptSpec[opt].value = omStrDup(optarg);
180 else
181 feOptSpec[opt].value = NULL;
182 feOptSpec[opt].set = 1;
183 }
184 }
185 return feOptAction(opt);
186}
187
188const char* feSetOptValue(feOptIndex opt, int optarg)
189{

Callers 5

jjSYSTEMFunction · 0.85
siInitFunction · 0.85
mainFunction · 0.85
ssiOpenFunction · 0.85
setOptionFunction · 0.85

Calls 1

feOptActionFunction · 0.85

Tested by 1

mainFunction · 0.68