[MPlayer-dev-eng] Re: [PATCH] allow multiple help clauses on the command line

kiriuja mplayer-patches at en-directo.net
Thu Aug 11 13:28:01 CEST 2005


On Thu 11 Aug 2005 05:54, Alban Bedel wrote:
> I don't like that patch very much. In particular the opt_exit global thing
> in m_config.c is quiet ugly. imho you shouldn't remove the M_OPT_EXIT
> return code, instead modify the commande line parsers (parser-m?cmp.c) so
> that they don't exit on M_OPT_EXIT but pass it up properly the caller.

That was how the previous versions of the patch worked (see post from
July 18). The problem with that is the return value that parsers get
from m_option_* tells them how many command line arguments the option
consumed, and for help commands it is either zero or one at present,
but potentially it can be any number. So in those previous versions I
had to introduce another constant, M_OPT_EXIT0, to distinguish the case
where -pphelp did not consume an additional argument. I thought that
was uglier than having a global variable for opt_exit.

> So *not* with a global, modify the arguments to the command line parser
> if you need to.

Could you elaborate please? It seems to me we'd have to return two values
(a count of arguments consumed and an error/success status) from each one
of the parse_* and get_* functions in m_option.c. I realize that global
variables are not the ideal way of passing information, but in this case
changing all the parsing functions referenced by all the the m_option_type
structs seems like an inferior solution to me.

--
kiriuja




More information about the MPlayer-dev-eng mailing list