Mercurial > dropbear
comparison compat.c @ 703:caa09587c3fb
Fix compat basename() to handle paths with no slashes. Thanks to Frank Teo
author | Matt Johnston <matt@ucc.asn.au> |
---|---|
date | Tue, 19 Mar 2013 20:04:55 +0800 |
parents | ace512d2ad5d |
children | a0062a354a80 |
comparison
equal
deleted
inserted
replaced
702:48e173a0c52b | 703:caa09587c3fb |
---|---|
191 #ifndef HAVE_BASENAME | 191 #ifndef HAVE_BASENAME |
192 | 192 |
193 char *basename(const char *path) { | 193 char *basename(const char *path) { |
194 | 194 |
195 char *foo = strrchr(path, '/'); | 195 char *foo = strrchr(path, '/'); |
196 if (!foo) | |
197 { | |
198 return path; | |
199 } | |
196 return ++foo; | 200 return ++foo; |
197 } | 201 } |
198 | 202 |
199 #endif /* HAVE_BASENAME */ | 203 #endif /* HAVE_BASENAME */ |
200 | 204 |