[Coco] basename() source

Bob Devries devries.bob at gmail.com
Sat Dec 31 04:23:50 EST 2005


just a thought.... should basename() also check for  a colon (:) in the 
MSDOS pathname, in case it looks like this: "C:name"?

--
Regards, Bob Devries, Dalby, Queensland, Australia

Isaiah 50:4 The sovereign Lord has given me
the capacity to be his spokesman,
so that I know how to help the weary.

website: http://www.home.gil.com.au/~bdevasl
my blog: http://bdevries.invigorated.org/

----- Original Message ----- 
From: "Bob Devries" <bdevries at gil.com.au>
To: <coco at maltedmedia.com>
Sent: Saturday, December 31, 2005 6:52 PM
Subject: [Coco] basename() source


> Here's my source for basename() :
>
> char *basename(pathname)
> char *pathname;
> {
>       char *name;
>       char *strrchr();
>
>       if ((name = strrchr(pathname, '/')) == NULL)
>               {
>               if ((name = strrchr(pathname, '\\')) == NULL)
>                       {
>                       return(pathname);
>                       }
>               }
>       return(name + 1);
> }
>
> It works on both windows(DOS Box) and OS9 (MESS).
> --
> Regards, Bob Devries, Dalby, Queensland, Australia
>
> Isaiah 50:4 The sovereign Lord has given me
> the capacity to be his spokesman,
> so that I know how to help the weary.
>
> website: http://www.home.gil.com.au/~bdevasl
> my blog: http://bdevries.invigorated.org/
>
>
> -- 
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco 




More information about the Coco mailing list