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

Function handle_config_section

src/cfgfiles.c:551–582  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

549}
550
551staticfn boolean
552handle_config_section(char *buf)
553{
554 char *sect = is_config_section(buf);
555
556 if (sect) {
557 if (gc.config_section_current)
558 free(gc.config_section_current), gc.config_section_current = 0;
559 /* is_config_section() removed brackets from 'sect' */
560 if (!gc.config_section_chosen) {
561 config_error_add("Section \"[%s]\" without CHOOSE", sect);
562 return TRUE;
563 }
564 if (*sect) { /* got a section name */
565 gc.config_section_current = dupstr(sect);
566 debugpline1("set config section: '%s'",
567 gc.config_section_current);
568 } else { /* empty section name => end of sections */
569 free_config_sections();
570 debugpline0("unset config section");
571 }
572 return TRUE;
573 }
574
575 if (gc.config_section_current) {
576 if (!gc.config_section_chosen)
577 return TRUE;
578 if (strcmp(gc.config_section_current, gc.config_section_chosen))
579 return TRUE;
580 }
581 return FALSE;
582}
583
584#define match_varname(INP, NAM, LEN) match_optname(INP, NAM, LEN, TRUE)
585

Callers 1

parse_conf_bufFunction · 0.85

Calls 4

is_config_sectionFunction · 0.85
config_error_addFunction · 0.85
dupstrFunction · 0.85
free_config_sectionsFunction · 0.85

Tested by

no test coverage detected