* ar.c: Formatting.

(usage): Correct help strings.
	(decode_options): Correct getopt_long short options.  Remove
	duplicate non-handled option message.
	(main): Don't handle -M specially.
This commit is contained in:
Alan Modra 2010-12-08 05:05:30 +00:00
parent 90b79792c0
commit dbcf63876c
2 changed files with 31 additions and 29 deletions

View File

@ -1,3 +1,11 @@
2010-12-08 Alan Modra <amodra@gmail.com>
* ar.c: Formatting.
(usage): Correct help strings.
(decode_options): Correct getopt_long short options. Remove
duplicate non-handled option message.
(main): Don't handle -M specially.
2010-12-08 Arnaud Lacombe <lacombar@gmail.com> 2010-12-08 Arnaud Lacombe <lacombar@gmail.com>
* ar.c (long_options): Add target. * ar.c (long_options): Add target.

View File

@ -216,8 +216,8 @@ map_over_members (bfd *arch, void (*function)(bfd *), char **files, int count)
filename = normalize (filename, arch); filename = normalize (filename, arch);
} }
if ((filename != NULL) && if (filename != NULL
(!FILENAME_CMP (normalize (*files, arch), filename))) && !FILENAME_CMP (normalize (*files, arch), filename))
{ {
++match_count; ++match_count;
if (counted_name_mode if (counted_name_mode
@ -248,12 +248,17 @@ usage (int help)
s = help ? stdout : stderr; s = help ? stdout : stderr;
/* xgettext:c-format */
const char * command_line =
#if BFD_SUPPORTS_PLUGINS #if BFD_SUPPORTS_PLUGINS
_("Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [--plugin <name>] [member-name] [count] archive-file file...\n"); /* xgettext:c-format */
const char *command_line
= _("Usage: %s [emulation options] [-]{dmpqrstx}[abcDfilMNoPsSTuvV]"
" [--plugin <name>] [member-name] [count] archive-file file...\n");
#else #else
_("Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n"); /* xgettext:c-format */
const char *command_line
= _("Usage: %s [emulation options] [-]{dmpqrstx}[abcDfilMNoPsSTuvV]"
" [member-name] [count] archive-file file...\n");
#endif #endif
fprintf (s, command_line, program_name); fprintf (s, command_line, program_name);
@ -427,7 +432,7 @@ decode_options(int argc, char **argv)
argv = new_argv; argv = new_argv;
} }
while ((c = getopt_long (argc, argv, "hdmpqrstxabcfilNoPsSuvV", while ((c = getopt_long (argc, argv, "hdmpqrtxlcoVsSuvabiMNfPTD",
long_options, NULL)) != EOF) long_options, NULL)) != EOF)
{ {
switch (c) switch (c)
@ -539,8 +544,6 @@ decode_options(int argc, char **argv)
case 0: /* A long option that just sets a flag. */ case 0: /* A long option that just sets a flag. */
break; break;
default: default:
/* xgettext:c-format */
non_fatal (_("illegal option -- '%d'"), c);
usage (0); usage (0);
} }
} }
@ -596,9 +599,6 @@ ranlib_main(int argc, char **argv)
xexit (status); xexit (status);
} }
/* The option parsing should be in its own function.
It will be when I have getopt working. */
int main (int, char **); int main (int, char **);
int int
@ -654,12 +654,6 @@ main (int argc, char **argv)
if (is_ranlib) if (is_ranlib)
ranlib_main (argc, argv); ranlib_main (argc, argv);
if (argc == 2 && strcmp (argv[1], "-M") == 0)
{
mri_emul ();
xexit (0);
}
if (argc < 2) if (argc < 2)
usage (0); usage (0);