$OpenBSD: patch-binutils_bucomm_c,v 1.3 2010/06/27 20:58:10 ckuethe Exp $
--- binutils/bucomm.c.orig	Sat Jun 26 11:22:43 2010
+++ binutils/bucomm.c	Sat Jun 26 11:31:17 2010
@@ -550,6 +550,32 @@ parse_vma (const char *s, const char *arg)
   return ret;
 }
 
+/* Return the basename of "file", i. e. everything minus whatever
+   directory part has been provided.  Stolen from bfd/archive.c.
+   Should we also handle the VMS case (as in bfd/archive.c)?  */
+const char *
+bu_basename (file)
+     const char *file;
+{
+  const char *filename = strrchr (file, '/');
+
+#ifdef HAVE_DOS_BASED_FILE_SYSTEM
+  {
+    /* We could have foo/bar\\baz, or foo\\bar, or d:bar.  */
+    char *bslash = strrchr (file, '\\');
+    if (filename == NULL || (bslash != NULL && bslash > filename))
+      filename = bslash;
+    if (filename == NULL && file[0] != '\0' && file[1] == ':')
+      filename = file + 1;
+  }
+#endif
+  if (filename != (char *) NULL)
+    filename++;
+  else
+    filename = file;
+  return filename;
+}
+
 /* Returns the size of the named file.  If the file does not
    exist, or if it is not a real file, then a suitable non-fatal
    error message is printed and zero is returned.  */
