summaryrefslogtreecommitdiff
path: root/binutils/ar.c
diff options
context:
space:
mode:
authorIan Lance Taylor <ian@airs.com>1999-09-12 17:34:19 +0000
committerIan Lance Taylor <ian@airs.com>1999-09-12 17:34:19 +0000
commiteac0756efaff771835e8f5785078608fb017f39e (patch)
tree91301dc2c20305f99f46bc0fbcbb448b5306caf9 /binutils/ar.c
parentd9a22e714a75d670639e109a836b2d2ce6b66fcc (diff)
downloadbinutils-redhat-eac0756efaff771835e8f5785078608fb017f39e.tar.gz
* ar.c (full_pathname): New static variable.
(map_over_members): Call normalize on command line parameter. (usage): Mention P modifier. (normalize): If full_pathname is true, don't do anything. (main): Accept P modifier. * binutils.texi, ar.1: Document P modifier.
Diffstat (limited to 'binutils/ar.c')
-rw-r--r--binutils/ar.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/binutils/ar.c b/binutils/ar.c
index 3e9dcefd92..fa89f300c8 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -150,6 +150,11 @@ get_pos_bfd PARAMS ((bfd **, enum pos, const char *));
/* Whether to truncate names of files stored in the archive. */
static boolean ar_truncate = false;
+/* Whether to use a full file name match when searching an archive.
+ This is convenient for archives created by the Microsoft lib
+ program. */
+static boolean full_pathname = false;
+
int interactive = 0;
static void
@@ -202,7 +207,7 @@ map_over_members (arch, function, files, count)
bfd_stat_arch_elt (head, &buf);
}
if ((head->filename != NULL) &&
- (!strcmp (*files, head->filename)))
+ (!strcmp (normalize (*files, arch), head->filename)))
{
found = true;
function (head);
@@ -242,6 +247,7 @@ usage (help)
fprintf (s, _(" [a] - put file(s) after [member-name]\n"));
fprintf (s, _(" [b] - put file(s) before [member-name] (same as [i])\n"));
fprintf (s, _(" [f] - truncate inserted file names\n"));
+ fprintf (s, _(" [P] - use full path names when matching\n"));
fprintf (s, _(" [o] - preserve original dates\n"));
fprintf (s, _(" [u] - only replace files that are newer than current archive contents\n"));
fprintf (s, _(" generic modifiers:\n"));
@@ -273,6 +279,9 @@ normalize (file, abfd)
{
const char *filename;
+ if (full_pathname)
+ return filename;
+
filename = strrchr (file, '/');
if (filename != (char *) NULL)
filename++;
@@ -501,6 +510,9 @@ main (argc, argv)
case 'f':
ar_truncate = true;
break;
+ case 'P':
+ full_pathname = true;
+ break;
default:
/* xgettext:c-format */
fprintf (stderr, _("%s: illegal option -- %c\n"), program_name, c);