MCPcopy Create free account
hub / github.com/Entware/Entware / __print_symbol

Function __print_symbol

scripts/config/confdata.c:693–719  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

691enum output_n { OUTPUT_N, OUTPUT_N_AS_UNSET, OUTPUT_N_NONE };
692
693static void __print_symbol(FILE *fp, struct symbol *sym, enum output_n output_n,
694 bool escape_string)
695{
696 const char *val;
697 char *escaped = NULL;
698
699 if (sym->type == S_UNKNOWN)
700 return;
701
702 val = sym_get_string_value(sym);
703
704 if ((sym->type == S_BOOLEAN || sym->type == S_TRISTATE) &&
705 output_n != OUTPUT_N && *val == 'n') {
706 if (output_n == OUTPUT_N_AS_UNSET)
707 fprintf(fp, "# %s%s is not set\n", CONFIG_, sym->name);
708 return;
709 }
710
711 if (sym->type == S_STRING && escape_string) {
712 escaped = escape_string_value(val);
713 val = escaped;
714 }
715
716 fprintf(fp, "%s%s=%s\n", CONFIG_, sym->name, val);
717
718 free(escaped);
719}
720
721static void print_symbol_for_dotconfig(FILE *fp, struct symbol *sym)
722{

Callers 3

Calls 2

sym_get_string_valueFunction · 0.85
escape_string_valueFunction · 0.85

Tested by

no test coverage detected