home *** CD-ROM | disk | FTP | other *** search
/ Frozen Fish 1: Amiga / FrozenFish-Apr94.iso / bbs / alib / d5xx / d523 / bmake.lha / BMake / source.lzh / ben / basename.c next >
C/C++ Source or Header  |  1991-07-20  |  532b  |  30 lines

  1. /*    basename.c
  2.  *  (c) Copyright 1991 by Ben Eng, All Rights Reserved
  3.  *
  4.  */
  5.  
  6. #include <graphics/gfxbase.h>
  7. #include <dos/dos.h>
  8. #include <clib/dos_protos.h>
  9.  
  10. extern struct GfxBase *GfxBase;
  11.  
  12. char *
  13. basename( char *pathname )
  14. {
  15.     char *ptr, *filename;
  16.  
  17.     if( GfxBase->LibNode.lib_Version >= 36L ) {
  18.         filename = FilePart( pathname );        
  19.     }
  20.     else {
  21.         for( filename = ptr = pathname; *ptr; ptr++ )
  22.             if( *ptr == '/'        /* directory delimiter */
  23.                 || *ptr == ':'    /* device delimiter */
  24.                 ) filename = ptr+1;
  25.  
  26.     }
  27.     return( filename );
  28. }
  29.  
  30.