Mail Archives: djgpp/1994/04/29/22:16:16
I just bumped into a minor bug in fnsplit(). The current fnsplit does take
into account '/' as a possible directory division. Example:
In Out
Path Drive Dir Filename Extention
a:\dir\fn.ext a: \dir\ fn .ext
a:/dir/fn.ext a: <empty> /dir/fn .ext
The patch to fix this wasn't too bad, almost the expected one-liner. Diff
report to follow.
Potter
****************************************************************************
*** fnsplit.c Fri Apr 29 20:06:48 1994
--- original\fnsplit.c Mon Oct 4 20:27:54 1993
***************
*** 5,16 ****
#include <string.h>
- static char * max_ptr( char *p1, char *p2 )
- {
- if ( p1 > p2 )
- return p1;
- else
- return p2;
- }
-
int fnsplit (const char *path, char *drive, char *dir,
char *name, char *ext)
--- 5,8 ----
***************
*** 35,40 ****
pp += 2;
}
! pe = max_ptr( strrchr( pp, '\\'), /* find terminating \ */
! strrchr( pp, '/') ); /* find terminating / */
if ( pe )
{
--- 27,31 ----
pp += 2;
}
! pe = strrchr( pp, '\\'); /* find terminating \ */
if ( pe )
{
- Raw text -