From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30852 invoked by alias); 4 Dec 2010 03:38:00 -0000 Received: (qmail 30756 invoked by uid 22791); 4 Dec 2010 03:37:59 -0000 X-SWARE-Spam-Status: No, hits=-2.7 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-gw0-f41.google.com (HELO mail-gw0-f41.google.com) (74.125.83.41) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 04 Dec 2010 03:37:51 +0000 Received: by gwj22 with SMTP id 22so3447301gwj.14 for ; Fri, 03 Dec 2010 19:37:50 -0800 (PST) Received: by 10.150.144.2 with SMTP id r2mr5187766ybd.107.1291433870012; Fri, 03 Dec 2010 19:37:50 -0800 (PST) Received: from localhost.localdomain (206-248-170-50.dsl.teksavvy.com [206.248.170.50]) by mx.google.com with ESMTPS id j4sm660982yha.37.2010.12.03.19.37.48 (version=SSLv3 cipher=RC4-MD5); Fri, 03 Dec 2010 19:37:49 -0800 (PST) From: Arnaud Lacombe To: binutils@sourceware.org Cc: Arnaud Lacombe Subject: [PATCH 3/3] binutils/ar: learn --target Date: Sat, 04 Dec 2010 03:38:00 -0000 Message-Id: <1291433814-27666-3-git-send-email-lacombar@gmail.com> In-Reply-To: References: Mailing-List: contact binutils-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: binutils-owner@sourceware.org X-SW-Source: 2010-12/txt/msg00177.txt.bz2 2010-12-02 Arnaud Lacombe * ar.c (long_options): Add target. (decode_options): Handle the --target option. (open_inarch): Check for plugin's target, default to --target (replace_members): Use generic `target'. --- binutils/ar.c | 15 +++++++++++---- 1 files changed, 11 insertions(+), 4 deletions(-) diff --git a/binutils/ar.c b/binutils/ar.c index de2f631..a5ae4f0 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -143,12 +143,16 @@ static int show_help = 0; static const char *plugin_target = NULL; +static const char *target = NULL; + #define OPTION_PLUGIN 201 +#define OPTION_TARGET 202 static struct option long_options[] = { {"help", no_argument, &show_help, 1}, {"plugin", required_argument, NULL, OPTION_PLUGIN}, + {"target", required_argument, NULL, OPTION_TARGET}, {"version", no_argument, &show_version, 1}, {NULL, no_argument, NULL, 0} }; @@ -529,6 +533,9 @@ decode_options(int argc, char **argv) xexit (1); #endif break; + case OPTION_TARGET: + target = optarg; + break; case 0: /* A long option that just sets a flag. */ break; default: @@ -773,7 +780,6 @@ main (int argc, char **argv) bfd * open_inarch (const char *archive_filename, const char *file) { - const char *target; bfd **last_one; bfd *next_one; struct stat sbuf; @@ -782,7 +788,8 @@ open_inarch (const char *archive_filename, const char *file) bfd_set_error (bfd_error_no_error); - target = plugin_target; + if (target == NULL) + target = plugin_target; if (stat (archive_filename, &sbuf) != 0) { @@ -1270,7 +1277,7 @@ replace_members (bfd *arch, char **files_to_move, bfd_boolean quick) after_bfd = get_pos_bfd (&arch->archive_next, pos_after, current->filename); if (ar_emul_replace (after_bfd, *files_to_move, - plugin_target, verbose)) + target, verbose)) { /* Snip out this entry from the chain. */ *current_ptr = (*current_ptr)->archive_next; @@ -1286,7 +1293,7 @@ replace_members (bfd *arch, char **files_to_move, bfd_boolean quick) /* Add to the end of the archive. */ after_bfd = get_pos_bfd (&arch->archive_next, pos_end, NULL); - if (ar_emul_append (after_bfd, *files_to_move, plugin_target, + if (ar_emul_append (after_bfd, *files_to_move, target, verbose, make_thin_archive)) changed = TRUE; -- 1.7.2.30.gc37d7.dirty