From: Alan Modra <amodra@gmail.com>
To: Arnaud Lacombe <lacombar@gmail.com>
Cc: binutils@sourceware.org
Subject: Re: [PATCH 3/3] binutils/ar: learn --target
Date: Wed, 08 Dec 2010 05:08:00 -0000 [thread overview]
Message-ID: <20101208050818.GE15607@bubble.grove.modra.org> (raw)
In-Reply-To: <1291433814-27666-3-git-send-email-lacombar@gmail.com>
Applied, with this followup patch to fix ar -T and ar -D regressions.
* 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.
Index: binutils/ar.c
===================================================================
RCS file: /cvs/src/src/binutils/ar.c,v
retrieving revision 1.71
diff -u -p -r1.71 ar.c
--- binutils/ar.c 8 Dec 2010 05:00:14 -0000 1.71
+++ binutils/ar.c 8 Dec 2010 05:05:15 -0000
@@ -216,8 +216,8 @@ map_over_members (bfd *arch, void (*func
filename = normalize (filename, arch);
}
- if ((filename != NULL) &&
- (!FILENAME_CMP (normalize (*files, arch), filename)))
+ if (filename != NULL
+ && !FILENAME_CMP (normalize (*files, arch), filename))
{
++match_count;
if (counted_name_mode
@@ -248,12 +248,17 @@ usage (int help)
s = help ? stdout : stderr;
- /* xgettext:c-format */
- const char * command_line =
#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
- _("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
fprintf (s, command_line, program_name);
@@ -301,7 +306,7 @@ usage (int help)
}
static void
-ranlib_usage(int help)
+ranlib_usage (int help)
{
FILE *s;
@@ -378,7 +383,7 @@ remove_output (void)
}
static char **
-decode_options(int argc, char **argv)
+decode_options (int argc, char **argv)
{
int c;
@@ -427,7 +432,7 @@ decode_options(int argc, char **argv)
argv = new_argv;
}
- while ((c = getopt_long (argc, argv, "hdmpqrstxabcfilNoPsSuvV",
+ while ((c = getopt_long (argc, argv, "hdmpqrtxlcoVsSuvabiMNfPTD",
long_options, NULL)) != EOF)
{
switch (c)
@@ -539,8 +544,6 @@ decode_options(int argc, char **argv)
case 0: /* A long option that just sets a flag. */
break;
default:
- /* xgettext:c-format */
- non_fatal (_("illegal option -- '%d'"), c);
usage (0);
}
}
@@ -549,7 +552,7 @@ decode_options(int argc, char **argv)
}
static void
-ranlib_main(int argc, char **argv)
+ranlib_main (int argc, char **argv)
{
int arg_index, status = 0;
bfd_boolean touch = FALSE;
@@ -577,7 +580,7 @@ ranlib_main(int argc, char **argv)
ranlib_usage (0);
if (show_help)
- usage(1);
+ usage (1);
if (show_version)
print_version ("ranlib");
@@ -596,9 +599,6 @@ ranlib_main(int argc, char **argv)
xexit (status);
}
-/* The option parsing should be in its own function.
- It will be when I have getopt working. */
-
int main (int, char **);
int
@@ -652,21 +652,15 @@ main (int argc, char **argv)
argc -= (i - 1);
if (is_ranlib)
- ranlib_main(argc, argv);
-
- if (argc == 2 && strcmp (argv[1], "-M") == 0)
- {
- mri_emul ();
- xexit (0);
- }
+ ranlib_main (argc, argv);
if (argc < 2)
usage (0);
- argv = decode_options(argc, argv);
+ argv = decode_options (argc, argv);
if (show_help)
- usage(1);
+ usage (1);
if (show_version)
print_version ("ar");
@@ -709,7 +703,7 @@ main (int argc, char **argv)
if (counted_name_mode)
{
if (operation != extract && operation != del)
- fatal (_("`N' is only meaningful with the `x' and `d' options."));
+ fatal (_("`N' is only meaningful with the `x' and `d' options."));
counted_name_counter = atoi (argv[arg_index++]);
if (counted_name_counter <= 0)
fatal (_("Value for `N' must be positive."));
@@ -718,7 +712,7 @@ main (int argc, char **argv)
inarch_filename = argv[arg_index++];
for (file_count = 0; argv[arg_index + file_count] != NULL; file_count++)
- continue;
+ continue;
files = (file_count > 0) ? argv + arg_index : NULL;
@@ -800,8 +794,8 @@ open_inarch (const char *archive_filenam
stat() works just fine in v2.x, so I think this should be
removed. For now, I enable it for DJGPP v2. -- EZ. */
-/* KLUDGE ALERT! Temporary fix until I figger why
- stat() is wrong ... think it's buried in GO32's IDT - Jax */
+ /* KLUDGE ALERT! Temporary fix until I figger why
+ stat() is wrong ... think it's buried in GO32's IDT - Jax */
if (errno != ENOENT)
bfd_fatal (archive_filename);
#endif
--
Alan Modra
Australia Development Lab, IBM
next prev parent reply other threads:[~2010-12-08 5:08 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-12-01 19:27 Using binutils with all target enabled Arnaud Lacombe
2010-12-01 20:56 ` Andreas Schwab
2010-12-01 22:06 ` Mike Frysinger
2010-12-01 23:16 ` Arnaud Lacombe
2010-12-04 3:37 ` [PATCH 2/3] binutils/ar: use getopt_long() for options parsing Arnaud Lacombe
2010-12-04 3:37 ` [PATCH 1/3] binutils/ar: split ar/ranlib path Arnaud Lacombe
2010-12-04 10:45 ` Mike Frysinger
2010-12-04 3:38 ` [PATCH 3/3] binutils/ar: learn --target Arnaud Lacombe
2010-12-08 5:08 ` Alan Modra [this message]
2010-12-15 19:58 ` H.J. Lu
2010-12-15 20:09 ` Arnaud Lacombe
2010-12-16 1:23 ` H.J. Lu
2010-12-04 3:47 ` Using binutils with all target enabled Arnaud Lacombe
2010-12-02 0:10 ` Joseph S. Myers
2010-12-02 0:17 ` Arnaud Lacombe
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101208050818.GE15607@bubble.grove.modra.org \
--to=amodra@gmail.com \
--cc=binutils@sourceware.org \
--cc=lacombar@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).