getopt optimization and dialyzer fix from Kostis

This commit is contained in:
Tuncer Ayaz 2010-10-01 15:55:17 +02:00
parent 933e4f7620
commit 7200d18671

View file

@ -25,7 +25,7 @@
-define(OPT_ARG, 4). -define(OPT_ARG, 4).
-define(OPT_HELP, 5). -define(OPT_HELP, 5).
-define(IS_OPT_SPEC(Opt), (is_tuple(Opt) andalso (size(Opt) =:= ?OPT_HELP))). -define(IS_OPT_SPEC(Opt), (tuple_size(Opt) =:= ?OPT_HELP)).
%% Atom indicating the data type that an argument can be converted to. %% Atom indicating the data type that an argument can be converted to.
@ -456,10 +456,10 @@ usage_options_reverse([{Name, Short, Long, _ArgSpec, Help} | Tail], Acc) ->
case Short of case Short of
% Only long form. % Only long form.
undefined -> undefined ->
[$-, $-, Long]; [$-, $- | Long];
% Both short and long form. % Both short and long form.
_ -> _ ->
[$-, Short, $,, $\s, $-, $-, Long] [$-, Short, $,, $\s, $-, $- | Long]
end end
end, end,
usage_options_reverse(Tail, add_option_help(Prefix, Help, Acc)); usage_options_reverse(Tail, add_option_help(Prefix, Help, Acc));