OSDN Git Service
(root)
/
lha
/
lha.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
386a9e2
)
* src/util.c (basename): newly added.
author
arai
<arai@6a8cc165-1e22-0410-a132-eb4e3f353aba>
Mon, 16 Dec 2002 16:20:49 +0000
(16:20 +0000)
committer
arai
<arai@6a8cc165-1e22-0410-a132-eb4e3f353aba>
Mon, 16 Dec 2002 16:20:49 +0000
(16:20 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/lha/lha/trunk@600
6a8cc165
-1e22-0410-a132-
eb4e3f353aba
src/util.c
patch
|
blob
|
history
diff --git
a/src/util.c
b/src/util.c
index
de9059a
..
2a668f7
100644
(file)
--- a/
src/util.c
+++ b/
src/util.c
@@
-393,3
+393,29
@@
xmemrchr(const char *s, int c, size_t n)
return p;
}
#endif
+
+#ifndef HAVE_BASENAME
+char *
+basename(char *s)
+{
+ int len;
+ char *t;
+
+ if (!s || *s == 0)
+ return ".";
+
+ /* strip trailing slashs */
+ t = s + strlen(s) - 1;
+ while (s != t && *t == '/')
+ *t-- = '\0';
+ if (s == t)
+ return s;
+
+ t = strrchr(s, '/');
+ if (t)
+ return t + 1;
+ else
+ return s;
+
+}
+#endif