[Coco] basename() source

Bob Devries bdevries at gil.com.au
Sat Dec 31 03:52:18 EST 2005


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/




More information about the Coco mailing list