$OpenBSD: patch-binutils_bucomm_c,v 1.2 2009/12/09 16:55:51 ckuethe Exp $
--- binutils/bucomm.c.orig	Wed Jan  9 02:40:32 2008
+++ binutils/bucomm.c	Sun Dec  6 21:48:53 2009
@@ -549,6 +549,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.  */
