CCL Home Page
Up Directory CCL fn_base
#include "utility.h"

char *fn_base(filename,basepart)
/*============================================================================*/
/* PURPOSE: EXTRACT THE BASE PART OF THE FILE SPECIFICATION.  THUS,
/*	".../.../ROOT.EXT" WILL YIELD "ROOT.EXT" AS OUTPUT.  IF THERE IS NO
/*	TRAILING "ROOT.EXT", THE RETURN STRING WILL BE NULL.  THE DIRECTORY PART
/*	IS DEFINED TO BE EVERYTHING UP TO BUT NOT INCLUDING THE LAST SLASH.
/* INPUTS:
/*	FILENAME	FILENAME WITH OPTIONAL DIRECTORY PREFIX.
/* OUTPUTS:
/*	BASEPART	COPY OF FILE BASE SPECIFICATION.
/*	RETURN VALUE	POINTER TO BASEPART.
/* WRITTEN: M.V.GRIESHABER
/* LAST MODIFICATION: 27 MARCH 1992 MVG (INITIAL CREATION)
*/
   char filename[];
   char basepart[];
   {
   char *last_slash;

   /* TRIM OFF DIRECTORY PART (MAY BE NULL IF NOT SPECIFIED). */
   last_slash=strrchr(filename,'/');
   strcpy(basepart,(last_slash!=NULL ? last_slash+1 : filename));

   return(basepart);
   }
Modified: Fri Feb 11 17:00:00 1994 GMT
Page accessed 4892 times since Sat Apr 17 21:58:53 1999 GMT