Use the names given in Erlang to the stdio file descriptors (stdout; stderr)

This commit is contained in:
Juan Jose Comellas 2012-01-31 16:28:19 -03:00
parent dfca05584d
commit c8fc803ea8
2 changed files with 9 additions and 9 deletions

View File

@ -121,7 +121,7 @@ For example, given the above-mentioned option specifications, the call to
getopt:usage(OptSpecList, "ex1"). getopt:usage(OptSpecList, "ex1").
Will show (on *stderr*): Will show (on *standard_error*):
Usage: ex1 [-h <host>] [-p <port>] [--dbname <dbname>] [-x] [-v] <file> Usage: ex1 [-h <host>] [-p <port>] [--dbname <dbname>] [-x] [-v] <file>
@ -136,7 +136,7 @@ This call to ``getopt:usage/3`` will add a string after the usage command line:
getopt:usage(OptSpecList, "ex1", "[var=value ...] [command ...]"). getopt:usage(OptSpecList, "ex1", "[var=value ...] [command ...]").
Will show (on *stderr*): Will show (on *standard_error*):
Usage: ex1 [-h <host>] [-p <port>] [--dbname <dbname>] [-x] [-v <verbose>] <file> [var=value ...] [command ...] Usage: ex1 [-h <host>] [-p <port>] [--dbname <dbname>] [-x] [-v <verbose>] <file> [var=value ...] [command ...]
@ -154,7 +154,7 @@ help text:
[{"var=value", "Variables that will affect the execution (e.g. debug=1)"}, [{"var=value", "Variables that will affect the execution (e.g. debug=1)"},
{"command", "Commands that will be executed (e.g. count)"}]). {"command", "Commands that will be executed (e.g. count)"}]).
Will show (on *stdout*): Will show (on *standard_error*):
Usage: ex1 [-h <host>] [-p <port>] [--dbname <dbname>] [-x] [-v <verbose>] <file> [var=value ...] [command ...] Usage: ex1 [-h <host>] [-p <port>] [--dbname <dbname>] [-x] [-v <verbose>] <file> [var=value ...] [command ...]

View File

@ -466,34 +466,34 @@ is_non_neg_float_arg([]) ->
true. true.
%% @doc Show a message on stderr indicating the command line options and %% @doc Show a message on standard_error indicating the command line options and
%% arguments that are supported by the program. %% arguments that are supported by the program.
-spec usage([option_spec()], string()) -> ok. -spec usage([option_spec()], string()) -> ok.
usage(OptSpecList, ProgramName) -> usage(OptSpecList, ProgramName) ->
usage(OptSpecList, ProgramName, standard_error). usage(OptSpecList, ProgramName, standard_error).
%% @doc Show a message on stderr or stdout indicating the command line options and %% @doc Show a message on standard_error or standard_io indicating the command line options and
%% arguments that are supported by the program. %% arguments that are supported by the program.
-spec usage([option_spec()], string(), output_stream() | string()) -> ok. -spec usage([option_spec()], string(), output_stream() | string()) -> ok.
usage(OptSpecList, ProgramName, OutputStream) when is_atom(OutputStream) -> usage(OptSpecList, ProgramName, OutputStream) when is_atom(OutputStream) ->
io:format(OutputStream, "Usage: ~s~s~n~n~s~n", io:format(OutputStream, "Usage: ~s~s~n~n~s~n",
[ProgramName, usage_cmd_line(OptSpecList), usage_options(OptSpecList)]); [ProgramName, usage_cmd_line(OptSpecList), usage_options(OptSpecList)]);
%% @doc Show a message on stderr indicating the command line options and %% @doc Show a message on standard_error indicating the command line options and
%% arguments that are supported by the program. The CmdLineTail argument %% arguments that are supported by the program. The CmdLineTail argument
%% is a string that is added to the end of the usage command line. %% is a string that is added to the end of the usage command line.
usage(OptSpecList, ProgramName, CmdLineTail) -> usage(OptSpecList, ProgramName, CmdLineTail) ->
usage(OptSpecList, ProgramName, CmdLineTail, standard_error). usage(OptSpecList, ProgramName, CmdLineTail, standard_error).
%% @doc Show a message on stderr or stdout indicating the command line options and %% @doc Show a message on standard_error or standard_io indicating the command line options and
%% arguments that are supported by the program. The CmdLineTail argument %% arguments that are supported by the program. The CmdLineTail argument
%% is a string that is added to the end of the usage command line. %% is a string that is added to the end of the usage command line.
-spec usage([option_spec()], string(), string(), output_stream() | [{string(), string()}]) -> ok. -spec usage([option_spec()], string(), string(), output_stream() | [{string(), string()}]) -> ok.
usage(OptSpecList, ProgramName, CmdLineTail, OutputStream) when is_atom(OutputStream) -> usage(OptSpecList, ProgramName, CmdLineTail, OutputStream) when is_atom(OutputStream) ->
io:format(OutputStream, "Usage: ~s~s ~s~n~n~s~n", io:format(OutputStream, "Usage: ~s~s ~s~n~n~s~n",
[ProgramName, usage_cmd_line(OptSpecList), CmdLineTail, usage_options(OptSpecList)]); [ProgramName, usage_cmd_line(OptSpecList), CmdLineTail, usage_options(OptSpecList)]);
%% @doc Show a message on stderr indicating the command line options and %% @doc Show a message on standard_error indicating the command line options and
%% arguments that are supported by the program. The CmdLineTail and OptionsTail %% arguments that are supported by the program. The CmdLineTail and OptionsTail
%% arguments are a string that is added to the end of the usage command line %% arguments are a string that is added to the end of the usage command line
%% and a list of tuples that are added to the end of the options' help lines. %% and a list of tuples that are added to the end of the options' help lines.
@ -501,7 +501,7 @@ usage(OptSpecList, ProgramName, CmdLineTail, OptionsTail) ->
usage(OptSpecList, ProgramName, CmdLineTail, OptionsTail, standard_error). usage(OptSpecList, ProgramName, CmdLineTail, OptionsTail, standard_error).
%% @doc Show a message on stderr or stdout indicating the command line options and %% @doc Show a message on standard_error or standard_io indicating the command line options and
%% arguments that are supported by the program. The CmdLineTail and OptionsTail %% arguments that are supported by the program. The CmdLineTail and OptionsTail
%% arguments are a string that is added to the end of the usage command line %% arguments are a string that is added to the end of the usage command line
%% and a list of tuples that are added to the end of the options' help lines. %% and a list of tuples that are added to the end of the options' help lines.