MCPcopy Create free account
hub / github.com/NetHack/NetHack / optfn_term_cols

Function optfn_term_cols

src/options.c:4238–4277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

4236}
4237
4238staticfn int
4239optfn_term_cols(
4240 int optidx, int req, boolean negated,
4241 char *opts, char *op)
4242{
4243 int retval = optn_ok;
4244 long ltmp;
4245
4246 if (req == do_init) {
4247 return optn_ok;
4248 }
4249 if (req == do_set) {
4250 /* WINCAP2
4251 * term_cols:amount */
4252
4253 if ((op = string_for_opt(opts, negated)) != empty_optstr) {
4254 ltmp = atol(op);
4255 /* just checks atol() sanity, not logical window size sanity
4256 */
4257 if (ltmp <= 0L || ltmp >= (long) LARGEST_INT) {
4258 config_error_add("Invalid %s: %ld", allopt[optidx].name,
4259 ltmp);
4260 retval = optn_err;
4261 } else {
4262 iflags.wc2_term_cols = (int) ltmp;
4263 }
4264 }
4265 return retval;
4266 }
4267 if (req == get_val || req == get_cnf_val) {
4268 if (iflags.wc2_term_cols)
4269 Sprintf(opts, "%d", iflags.wc2_term_cols);
4270 else if (req == get_cnf_val)
4271 opts[0] = '\0';
4272 else
4273 Strcpy(opts, defopt);
4274 return optn_ok;
4275 }
4276 return optn_ok;
4277}
4278
4279staticfn int
4280optfn_term_rows(

Callers

nothing calls this directly

Calls 2

string_for_optFunction · 0.85
config_error_addFunction · 0.85

Tested by

no test coverage detected