Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
linux
Commits
70c74e59
Commit
70c74e59
authored
Oct 28, 2010
by
Michal Marek
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'message-callback' into kbuild/kconfig
Conflicts: scripts/kconfig/nconf.c
parents
b3235fe4
42368c37
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
48 deletions
+40
-48
scripts/kconfig/confdata.c
scripts/kconfig/confdata.c
+29
-6
scripts/kconfig/lkc_proto.h
scripts/kconfig/lkc_proto.h
+2
-0
scripts/kconfig/nconf.c
scripts/kconfig/nconf.c
+9
-42
No files found.
scripts/kconfig/confdata.c
View file @
70c74e59
...
@@ -19,6 +19,9 @@
...
@@ -19,6 +19,9 @@
static
void
conf_warning
(
const
char
*
fmt
,
...)
static
void
conf_warning
(
const
char
*
fmt
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
__attribute__
((
format
(
printf
,
1
,
2
)));
static
void
conf_message
(
const
char
*
fmt
,
...)
__attribute__
((
format
(
printf
,
1
,
2
)));
static
const
char
*
conf_filename
;
static
const
char
*
conf_filename
;
static
int
conf_lineno
,
conf_warnings
,
conf_unsaved
;
static
int
conf_lineno
,
conf_warnings
,
conf_unsaved
;
...
@@ -35,6 +38,29 @@ static void conf_warning(const char *fmt, ...)
...
@@ -35,6 +38,29 @@ static void conf_warning(const char *fmt, ...)
conf_warnings
++
;
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
)
const
char
*
conf_get_configname
(
void
)
{
{
char
*
name
=
getenv
(
"KCONFIG_CONFIG"
);
char
*
name
=
getenv
(
"KCONFIG_CONFIG"
);
...
@@ -184,9 +210,8 @@ int conf_read_simple(const char *name, int def)
...
@@ -184,9 +210,8 @@ int conf_read_simple(const char *name, int def)
name
=
conf_expand_value
(
prop
->
expr
->
left
.
sym
->
name
);
name
=
conf_expand_value
(
prop
->
expr
->
left
.
sym
->
name
);
in
=
zconf_fopen
(
name
);
in
=
zconf_fopen
(
name
);
if
(
in
)
{
if
(
in
)
{
printf
(
_
(
"#
\n
"
conf_message
(
_
(
"using defaults found in %s"
),
"# using defaults found in %s
\n
"
name
);
"#
\n
"
),
name
);
goto
load
;
goto
load
;
}
}
}
}
...
@@ -642,9 +667,7 @@ int conf_write(const char *name)
...
@@ -642,9 +667,7 @@ int conf_write(const char *name)
return
1
;
return
1
;
}
}
printf
(
_
(
"#
\n
"
conf_message
(
_
(
"configuration written to %s"
),
newname
);
"# configuration written to %s
\n
"
"#
\n
"
),
newname
);
sym_set_change_count
(
0
);
sym_set_change_count
(
0
);
...
...
scripts/kconfig/lkc_proto.h
View file @
70c74e59
#include <stdarg.h>
/* confdata.c */
/* confdata.c */
P
(
conf_parse
,
void
,(
const
char
*
name
));
P
(
conf_parse
,
void
,(
const
char
*
name
));
...
@@ -8,6 +9,7 @@ P(conf_write,int,(const char *name));
...
@@ -8,6 +9,7 @@ P(conf_write,int,(const char *name));
P
(
conf_write_autoconf
,
int
,(
void
));
P
(
conf_write_autoconf
,
int
,(
void
));
P
(
conf_get_changed
,
bool
,(
void
));
P
(
conf_get_changed
,
bool
,(
void
));
P
(
conf_set_changed_callback
,
void
,(
void
(
*
fn
)(
void
)));
P
(
conf_set_changed_callback
,
void
,(
void
(
*
fn
)(
void
)));
P
(
conf_set_message_callback
,
void
,(
void
(
*
fn
)(
const
char
*
fmt
,
va_list
ap
)));
/* menu.c */
/* menu.c */
P
(
rootmenu
,
struct
menu
,);
P
(
rootmenu
,
struct
menu
,);
...
...
scripts/kconfig/nconf.c
View file @
70c74e59
...
@@ -645,25 +645,6 @@ static const char *set_config_filename(const char *config_filename)
...
@@ -645,25 +645,6 @@ static const char *set_config_filename(const char *config_filename)
return
menu_backtitle
;
return
menu_backtitle
;
}
}
/* command = 0 is supress, 1 is restore */
static
void
supress_stdout
(
int
command
)
{
static
FILE
*
org_stdout
;
static
FILE
*
org_stderr
;
if
(
command
==
0
)
{
org_stdout
=
stdout
;
org_stderr
=
stderr
;
stdout
=
fopen
(
"/dev/null"
,
"a"
);
stderr
=
fopen
(
"/dev/null"
,
"a"
);
}
else
{
fclose
(
stdout
);
fclose
(
stderr
);
stdout
=
org_stdout
;
stderr
=
org_stderr
;
}
}
/* return = 0 means we are successful.
/* return = 0 means we are successful.
* -1 means go on doing what you were doing
* -1 means go on doing what you were doing
*/
*/
...
@@ -688,9 +669,7 @@ static int do_exit(void)
...
@@ -688,9 +669,7 @@ static int do_exit(void)
/* if we got here, the user really wants to exit */
/* if we got here, the user really wants to exit */
switch
(
res
)
{
switch
(
res
)
{
case
0
:
case
0
:
supress_stdout
(
0
);
res
=
conf_write
(
filename
);
res
=
conf_write
(
filename
);
supress_stdout
(
1
);
if
(
res
)
if
(
res
)
btn_dialog
(
btn_dialog
(
main_window
,
main_window
,
...
@@ -698,19 +677,6 @@ static int do_exit(void)
...
@@ -698,19 +677,6 @@ static int do_exit(void)
"Your configuration changes were NOT saved."
),
"Your configuration changes were NOT saved."
),
1
,
1
,
"<OK>"
);
"<OK>"
);
else
{
char
buf
[
1024
];
snprintf
(
buf
,
1024
,
_
(
"Configuration written to %s
\n
"
"End of the configuration.
\n
"
"Execute 'make' to start the build or try"
" 'make help'."
),
filename
);
btn_dialog
(
main_window
,
buf
,
1
,
"<OK>"
);
}
break
;
break
;
default:
default:
btn_dialog
(
btn_dialog
(
...
@@ -1246,6 +1212,14 @@ static void conf(struct menu *menu)
...
@@ -1246,6 +1212,14 @@ static void conf(struct menu *menu)
}
}
}
}
static
void
conf_message_callback
(
const
char
*
fmt
,
va_list
ap
)
{
char
buf
[
1024
];
vsnprintf
(
buf
,
sizeof
(
buf
),
fmt
,
ap
);
btn_dialog
(
main_window
,
buf
,
1
,
"<OK>"
);
}
static
void
show_help
(
struct
menu
*
menu
)
static
void
show_help
(
struct
menu
*
menu
)
{
{
struct
gstr
help
=
str_new
();
struct
gstr
help
=
str_new
();
...
@@ -1470,16 +1444,8 @@ static void conf_save(void)
...
@@ -1470,16 +1444,8 @@ static void conf_save(void)
case
0
:
case
0
:
if
(
!
dialog_input_result
[
0
])
if
(
!
dialog_input_result
[
0
])
return
;
return
;
supress_stdout
(
0
);
res
=
conf_write
(
dialog_input_result
);
res
=
conf_write
(
dialog_input_result
);
supress_stdout
(
1
);
if
(
!
res
)
{
if
(
!
res
)
{
char
buf
[
1024
];
sprintf
(
buf
,
"%s %s"
,
_
(
"configuration file saved to: "
),
dialog_input_result
);
btn_dialog
(
main_window
,
buf
,
1
,
"<OK>"
);
set_config_filename
(
dialog_input_result
);
set_config_filename
(
dialog_input_result
);
return
;
return
;
}
}
...
@@ -1572,6 +1538,7 @@ int main(int ac, char **av)
...
@@ -1572,6 +1538,7 @@ int main(int ac, char **av)
_
(
menu_no_f_instructions
));
_
(
menu_no_f_instructions
));
}
}
conf_set_message_callback
(
conf_message_callback
);
/* do the work */
/* do the work */
while
(
!
global_exit
)
{
while
(
!
global_exit
)
{
conf
(
&
rootmenu
);
conf
(
&
rootmenu
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment