diff options
author | Michal Marek <mmarek@suse.cz> | 2010-10-27 18:54:25 -0400 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-10-27 18:54:25 -0400 |
commit | 70c74e59db7450d5c9164abeb3b6752f8045288b (patch) | |
tree | 1a9b3c6e3c0adee80c7ddc8e86dcf746574fb37b /scripts/kconfig/confdata.c | |
parent | b3235fe420edf7faf5e8e67b978b12d5524fb161 (diff) | |
parent | 42368c37fbd51f7b478d041ae55c5df000897158 (diff) |
Merge branch 'message-callback' into kbuild/kconfig
Conflicts:
scripts/kconfig/nconf.c
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 96110ea41cf3..9df80114b47b 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 | } |
@@ -642,9 +667,7 @@ next: | |||
642 | return 1; | 667 | return 1; |
643 | } | 668 | } |
644 | 669 | ||
645 | printf(_("#\n" | 670 | conf_message(_("configuration written to %s"), newname); |
646 | "# configuration written to %s\n" | ||
647 | "#\n"), newname); | ||
648 | 671 | ||
649 | sym_set_change_count(0); | 672 | sym_set_change_count(0); |
650 | 673 | ||