diff options
Diffstat (limited to 'scripts/kconfig/symbol.c')
-rw-r--r-- | scripts/kconfig/symbol.c | 47 |
1 files changed, 45 insertions, 2 deletions
diff --git a/scripts/kconfig/symbol.c b/scripts/kconfig/symbol.c index a796c95fe8a..071f00c3046 100644 --- a/scripts/kconfig/symbol.c +++ b/scripts/kconfig/symbol.c | |||
@@ -9,7 +9,6 @@ | |||
9 | #include <regex.h> | 9 | #include <regex.h> |
10 | #include <sys/utsname.h> | 10 | #include <sys/utsname.h> |
11 | 11 | ||
12 | #define LKC_DIRECT_LINK | ||
13 | #include "lkc.h" | 12 | #include "lkc.h" |
14 | 13 | ||
15 | struct symbol symbol_yes = { | 14 | struct symbol symbol_yes = { |
@@ -751,7 +750,8 @@ const char *sym_get_string_value(struct symbol *sym) | |||
751 | case no: | 750 | case no: |
752 | return "n"; | 751 | return "n"; |
753 | case mod: | 752 | case mod: |
754 | return "m"; | 753 | sym_calc_value(modules_sym); |
754 | return (modules_sym->curr.tri == no) ? "n" : "m"; | ||
755 | case yes: | 755 | case yes: |
756 | return "y"; | 756 | return "y"; |
757 | } | 757 | } |
@@ -893,6 +893,49 @@ const char *sym_expand_string_value(const char *in) | |||
893 | return res; | 893 | return res; |
894 | } | 894 | } |
895 | 895 | ||
896 | const char *sym_escape_string_value(const char *in) | ||
897 | { | ||
898 | const char *p; | ||
899 | size_t reslen; | ||
900 | char *res; | ||
901 | size_t l; | ||
902 | |||
903 | reslen = strlen(in) + strlen("\"\"") + 1; | ||
904 | |||
905 | p = in; | ||
906 | for (;;) { | ||
907 | l = strcspn(p, "\"\\"); | ||
908 | p += l; | ||
909 | |||
910 | if (p[0] == '\0') | ||
911 | break; | ||
912 | |||
913 | reslen++; | ||
914 | p++; | ||
915 | } | ||
916 | |||
917 | res = malloc(reslen); | ||
918 | res[0] = '\0'; | ||
919 | |||
920 | strcat(res, "\""); | ||
921 | |||
922 | p = in; | ||
923 | for (;;) { | ||
924 | l = strcspn(p, "\"\\"); | ||
925 | strncat(res, p, l); | ||
926 | p += l; | ||
927 | |||
928 | if (p[0] == '\0') | ||
929 | break; | ||
930 | |||
931 | strcat(res, "\\"); | ||
932 | strncat(res, p++, 1); | ||
933 | } | ||
934 | |||
935 | strcat(res, "\""); | ||
936 | return res; | ||
937 | } | ||
938 | |||
896 | struct symbol **sym_re_search(const char *pattern) | 939 | struct symbol **sym_re_search(const char *pattern) |
897 | { | 940 | { |
898 | struct symbol *sym, **sym_arr = NULL; | 941 | struct symbol *sym, **sym_arr = NULL; |