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

char *fn_ext(filename,extpart)
/*============================================================================*/
/* PURPOSE: EXTRACT THE EXTENSION PART OF THE FILE SPECIFICATION.  THUS,
/*	".../.../ROOT.EXT" WILL YIELD ".EXT" AS OUTPUT.  IF THERE IS NO
/*	TRAILING ".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:
/*	EXTPART		COPY OF FILE EXTENSION SPECIFICATION.
/*	RETURN VALUE	POINTER TO EXTPART.
/* WRITTEN: M.V.GRIESHABER
/* LAST MODIFICATION: 27 MARCH 1992 MVG (INITIAL CREATION)
*/
   char filename[];
   char extpart[];
   {
   char *last_dot;	/* POINTER TO LAST DOT IN FILENAME. */

   /* TRIM OFF DIRECTORY AND ROOT PARTS (MAY BE NULL IF NOT SPECIFIED). */
   last_dot=strrchr(filename,'.');
   if (last_dot!=NULL)
      strcpy(extpart,last_dot);
   else
      extpart[0]='\0';

   return(extpart);
   }
Modified: Fri Feb 11 17:00:00 1994 GMT
Page accessed 4850 times since Sat Apr 17 21:58:55 1999 GMT