mirror of
git://git.sv.gnu.org/coreutils.git
synced 2026-04-20 02:36:16 +02:00
No longer include long-options.h.
Include version-etc.h instead. (PROGRAM_NAME): Define. [long_options]: Add entries for --help and --version. Remove parse_long_options call. (main) [getopt switch]: Add a case for each of --help and --version.
This commit is contained in:
20
src/ls.c
20
src/ls.c
@@ -73,14 +73,18 @@
|
||||
#include "error.h"
|
||||
#include "human.h"
|
||||
#include "filemode.h"
|
||||
#include "long-options.h"
|
||||
#include "ls.h"
|
||||
#include "obstack.h"
|
||||
#include "path-concat.h"
|
||||
#include "quotearg.h"
|
||||
#include "strverscmp.h"
|
||||
#include "version-etc.h"
|
||||
#include "xstrtol.h"
|
||||
|
||||
#define PROGRAM_NAME (ls_mode == LS_LS ? "ls" \
|
||||
: (ls_mode == LS_MULTI_COL \
|
||||
? "dir" : "vdir"))
|
||||
|
||||
#define obstack_chunk_alloc malloc
|
||||
#define obstack_chunk_free free
|
||||
|
||||
@@ -569,6 +573,8 @@ static struct option const long_options[] =
|
||||
{"time", required_argument, 0, 11},
|
||||
{"color", optional_argument, 0, 13},
|
||||
{"block-size", required_argument, 0, 17},
|
||||
{GETOPT_HELP_OPTION_DECL},
|
||||
{GETOPT_VERSION_OPTION_DECL},
|
||||
{NULL, 0, NULL, 0}
|
||||
};
|
||||
|
||||
@@ -718,13 +724,6 @@ main (int argc, char **argv)
|
||||
bindtextdomain (PACKAGE, LOCALEDIR);
|
||||
textdomain (PACKAGE);
|
||||
|
||||
#define PROGRAM_NAME (ls_mode == LS_LS ? "ls" \
|
||||
: (ls_mode == LS_MULTI_COL \
|
||||
? "dir" : "vdir"))
|
||||
|
||||
parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION,
|
||||
"Richard Stallman and David MacKenzie", usage);
|
||||
|
||||
exit_status = 0;
|
||||
dir_defaulted = 1;
|
||||
print_dir_name = 1;
|
||||
@@ -1175,6 +1174,11 @@ decode_switches (int argc, char **argv)
|
||||
human_block_size (optarg, 1, &output_block_size);
|
||||
break;
|
||||
|
||||
case_GETOPT_HELP_CHAR;
|
||||
|
||||
case_GETOPT_VERSION_CHAR (PROGRAM_NAME,
|
||||
"Richard Stallman and David MacKenzie");
|
||||
|
||||
default:
|
||||
usage (EXIT_FAILURE);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user