diff options
author | Michal Marek <mmarek@suse.cz> | 2010-08-17 04:21:19 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-08-17 04:21:19 -0400 |
commit | 42368c37fbd51f7b478d041ae55c5df000897158 (patch) | |
tree | 6e7ba38ab4fc8c07408c0c9276372c4e904c7607 /scripts/kconfig/confdata.c | |
parent | 94bedeca77bf79a81952ed4c3abb8c1cce4c85dd (diff) |
kconfig: Allow frontends to display messages themselves
Signed-off-by: Michal Marek <mmarek@suse.cz>
Diffstat (limited to 'scripts/kconfig/confdata.c')
-rw-r--r-- | scripts/kconfig/confdata.c | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index dc11d51bd8b3..c07060ab7820 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c | |||
@@ -19,6 +19,9 @@ | |||
19 | static void conf_warning(const char *fmt, ...) | 19 | static void conf_warning(const char *fmt, ...) |
20 | __attribute__ ((format (printf, 1, 2))); | 20 | __attribute__ ((format (printf, 1, 2))); |
21 | 21 | ||
22 | static void conf_message(const char *fmt, ...) | ||
23 | __attribute__ ((format (printf, 1, 2))); | ||
24 | |||
22 | static const char *conf_filename; | 25 | static const char *conf_filename; |
23 | static int conf_lineno, conf_warnings, conf_unsaved; | 26 | static int conf_lineno, conf_warnings, conf_unsaved; |
24 | 27 | ||
@@ -35,6 +38,29 @@ static void conf_warning(const char *fmt, ...) | |||
35 | conf_warnings++; | 38 | conf_warnings++; |
36 | } | 39 | } |
37 | 40 | ||
41 | static void conf_default_message_callback(const char *fmt, va_list ap) | ||
42 | { | ||
43 | printf("#\n# "); | ||
44 | vprintf(fmt, ap); | ||
45 | printf("\n#\n"); | ||
46 | } | ||
47 | |||
48 | static void (*conf_message_callback) (const char *fmt, va_list ap) = | ||
49 | conf_default_message_callback; | ||
50 | void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap)) | ||
51 | { | ||
52 | conf_message_callback = fn; | ||
53 | } | ||
54 | |||
55 | static void conf_message(const char *fmt, ...) | ||
56 | { | ||
57 | va_list ap; | ||
58 | |||
59 | va_start(ap, fmt); | ||
60 | if (conf_message_callback) | ||
61 | conf_message_callback(fmt, ap); | ||
62 | } | ||
63 | |||
38 | const char *conf_get_configname(void) | 64 | const char *conf_get_configname(void) |
39 | { | 65 | { |
40 | char *name = getenv("KCONFIG_CONFIG"); | 66 | char *name = getenv("KCONFIG_CONFIG"); |
@@ -184,9 +210,8 @@ int conf_read_simple(const char *name, int def) | |||
184 | name = conf_expand_value(prop->expr->left.sym->name); | 210 | name = conf_expand_value(prop->expr->left.sym->name); |
185 | in = zconf_fopen(name); | 211 | in = zconf_fopen(name); |
186 | if (in) { | 212 | if (in) { |
187 | printf(_("#\n" | 213 | conf_message(_("using defaults found in %s"), |
188 | "# using defaults found in %s\n" | 214 | name); |
189 | "#\n"), name); | ||
190 | goto load; | 215 | goto load; |
191 | } | 216 | } |
192 | } | 217 | } |
@@ -651,9 +676,7 @@ next: | |||
651 | return 1; | 676 | return 1; |
652 | } | 677 | } |
653 | 678 | ||
654 | printf(_("#\n" | 679 | conf_message(_("configuration written to %s"), newname); |
655 | "# configuration written to %s\n" | ||
656 | "#\n"), newname); | ||
657 | 680 | ||
658 | sym_set_change_count(0); | 681 | sym_set_change_count(0); |
659 | 682 | ||