37 lines
1.2 KiB
Plaintext
37 lines
1.2 KiB
Plaintext
$OpenBSD: patch-binutils_bucomm_c,v 1.1 2008/10/01 04:46:20 ckuethe Exp $
|
|
--- binutils/bucomm.c.orig Mon Aug 6 12:55:09 2007
|
|
+++ binutils/bucomm.c Sat Sep 27 20:20:27 2008
|
|
@@ -501,6 +501,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. */
|