diff options
author | Michal Marek <mmarek@suse.cz> | 2010-08-17 10:21:19 +0200 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-08-17 10:21:19 +0200 |
commit | 42368c37fbd51f7b478d041ae55c5df000897158 (patch) | |
tree | 6e7ba38ab4fc8c07408c0c9276372c4e904c7607 /scripts/kconfig/confdata.c | |
parent | 94bedeca77bf79a81952ed4c3abb8c1cce4c85dd (diff) | |
download | op-kernel-dev-42368c37fbd51f7b478d041ae55c5df000897158.zip op-kernel-dev-42368c37fbd51f7b478d041ae55c5df000897158.tar.gz |
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 dc11d51..c07060a 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -19,6 +19,9 @@ static void conf_warning(const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); +static void conf_message(const char *fmt, ...) + __attribute__ ((format (printf, 1, 2))); + static const char *conf_filename; static int conf_lineno, conf_warnings, conf_unsaved; @@ -35,6 +38,29 @@ static void conf_warning(const char *fmt, ...) conf_warnings++; } +static void conf_default_message_callback(const char *fmt, va_list ap) +{ + printf("#\n# "); + vprintf(fmt, ap); + printf("\n#\n"); +} + +static void (*conf_message_callback) (const char *fmt, va_list ap) = + conf_default_message_callback; +void conf_set_message_callback(void (*fn) (const char *fmt, va_list ap)) +{ + conf_message_callback = fn; +} + +static void conf_message(const char *fmt, ...) +{ + va_list ap; + + va_start(ap, fmt); + if (conf_message_callback) + conf_message_callback(fmt, ap); +} + const char *conf_get_configname(void) { char *name = getenv("KCONFIG_CONFIG"); @@ -184,9 +210,8 @@ int conf_read_simple(const char *name, int def) name = conf_expand_value(prop->expr->left.sym->name); in = zconf_fopen(name); if (in) { - printf(_("#\n" - "# using defaults found in %s\n" - "#\n"), name); + conf_message(_("using defaults found in %s"), + name); goto load; } } @@ -651,9 +676,7 @@ next: return 1; } - printf(_("#\n" - "# configuration written to %s\n" - "#\n"), newname); + conf_message(_("configuration written to %s"), newname); sym_set_change_count(0); |