diff options
Diffstat (limited to 'binutils/ar.c')
-rw-r--r-- | binutils/ar.c | 41 |
1 files changed, 35 insertions, 6 deletions
diff --git a/binutils/ar.c b/binutils/ar.c index 73ab1d4..d28419f 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -1,6 +1,6 @@ /* ar.c - Archive modify and extract. Copyright 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, - 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 + 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. This file is part of GNU Binutils. @@ -37,6 +37,7 @@ #include "arsup.h" #include "filenames.h" #include "binemul.h" +#include "plugin.h" #include <sys/stat.h> #ifdef __GO32___ @@ -230,8 +231,14 @@ usage (int help) if (! is_ranlib) { /* xgettext:c-format */ - fprintf (s, _("Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n"), - program_name); + const char * command_line = +#if BFD_SUPPORTS_PLUGINS + _("Usage: %s [emulation options] [--plugin <name>] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n"); +#else + _("Usage: %s [emulation options] [-]{dmpqrstx}[abcfilNoPsSuvV] [member-name] [count] archive-file file...\n"); +#endif + fprintf (s, command_line, program_name); + /* xgettext:c-format */ fprintf (s, _(" %s -M [<mri-script]\n"), program_name); fprintf (s, _(" commands:\n")); @@ -259,7 +266,10 @@ usage (int help) fprintf (s, _(" [v] - be verbose\n")); fprintf (s, _(" [V] - display the version number\n")); fprintf (s, _(" @<file> - read options from <file>\n")); - +#if BFD_SUPPORTS_PLUGINS + fprintf (s, _(" optional:\n")); + fprintf (s, _(" --plugin <p> - load the specified plugin\n")); +#endif ar_emul_usage (s); } else @@ -268,8 +278,11 @@ usage (int help) fprintf (s, _("Usage: %s [options] archive\n"), program_name); fprintf (s, _(" Generate an index to speed access to archives\n")); fprintf (s, _(" The options are:\n\ - @<file> Read options from <file>\n\ - -t Update the archive's symbol map timestamp\n\ + @<file> Read options from <file>\n" +#if BFD_SUPPORTS_PLUGINS +" --plugin <name> Load the specified plugin\n" +#endif +" -t Update the archive's symbol map timestamp\n\ -h --help Print this help message\n\ -v --version Print version information\n")); } @@ -480,6 +493,22 @@ main (int argc, char **argv) arg_index = 1; arg_ptr = argv[arg_index]; + if (strcmp (arg_ptr, "--plugin") == 0) + { +#if BFD_SUPPORTS_PLUGINS + if (argc < 4) + usage (1); + + bfd_plugin_set_plugin (argv[2]); + + arg_index += 2; + arg_ptr = argv[arg_index]; +#else + fprintf (stderr, _("sorry - this program has been built without plugin support\n")); + xexit (1); +#endif + } + if (*arg_ptr == '-') { /* When the first option starts with '-' we support POSIX-compatible |