[vlc-devel] [PATCH] config: cmdline: Use msg_* instead of fprintf
Rafaël Carré
funman at videolan.org
Tue Aug 2 19:13:16 CEST 2016
On 08/02/2016 07:05 PM, Hugo Beauzée-Luyssen wrote:
> On 08/02/2016 06:59 PM, Hugo Beauzée-Luyssen wrote:
>> ---
>> src/config/cmdline.c | 14 +++++++-------
>> 1 file changed, 7 insertions(+), 7 deletions(-)
>>
>> diff --git a/src/config/cmdline.c b/src/config/cmdline.c
>> index 12e92ba..12045e9 100644
>> --- a/src/config/cmdline.c
>> +++ b/src/config/cmdline.c
>> @@ -225,8 +225,8 @@ int config_LoadCmdLine( vlc_object_t *p_this, int i_argc,
>> /* Check if the option is deprecated */
>> if( p_conf->b_removed )
>> {
>> - fprintf(stderr,
>> - "Warning: option --%s no longer exists.\n",
>> + msg_Warn(p_this,
>> + "Warning: option --%s no longer exists.",
>> psz_name);
>> continue;
>> }
>> @@ -290,17 +290,17 @@ int config_LoadCmdLine( vlc_object_t *p_this, int i_argc,
>> /* Internal error: unknown option */
>> if( !b_ignore_errors )
>> {
>> - fputs( "vlc: unknown option"
>> - " or missing mandatory argument ", stderr );
>> if( state.opt )
>> {
>> - fprintf( stderr, "`-%c'\n", state.opt );
>> + msg_Err( p_this, "vlc: unknown option"
>> + " or missing mandatory argument `-%c'", state.opt );
>> }
>> else
>> {
>> - fprintf( stderr, "`%s'\n", ppsz_argv[state.ind-1] );
>> + msg_Err( p_this, "vlc: unknown option"
>> + " or missing mandatory argument `-%s'", ppsz_argv[state.ind-1] );
>> }
>> - fputs( "Try `vlc --help' for more information.\n", stderr );
>> + msg_Err( p_this, "Try `vlc --help' for more information." );
>> goto out;
>> }
>> }
>>
> Hi,
>
> Sorry for the lack of comment... basically the idea is this change
> allows one to see the log on some platform that would swallow
> stdout/stderr, making debugging easier.
> It seems weird that this wasn't done before, yet I can't see a reason
> for it, hence the patch.
I think it's because msg_foo depends on options set by the function you
are patching.
> Regards,
More information about the vlc-devel
mailing list