FreeBSD/usr.sbin/ctm/ctm/ctm_input.c
/*---------------------------------------------------------------------------*/
/* get the filename in the next field, prepend BaseDir and give back the result
   strings. The sustitute filename is return (the one with the suffix SUBSUFF) 
   if it exists and the qualifier contains CTM_Q_Name_Subst
   NOTA: Buffer is already initialize with BaseDir, CatPtr is the insertion
   point on this buffer + the length test in Ffield() is enough for Fname() */
get the filename in the next field, prepend BaseDir and give back the result
strings. The sustitute filename is return (the one with the suffix SUBSUFF)
if it exists and the qualifier contains CTM_Q_Name_Subst
NOTA: Buffer is already initialize with BaseDir, CatPtr is the insertion
point on this buffer + the length test in Ffield() is enough for Fname()
get the filename in the next field prepend BaseDir and give back the result strings . The sustitute filename is return ( the one with the suffix SUBSUFF ) if it exists and the qualifier contains CTM_Q_Name_Subst NOTA : Buffer is already initialize with BaseDir CatPtr is the insertion point on this buffer + the length test in Ffield () is enough for Fname ()
u_char *
Fname(FILE *fd, MD5_CTX *ctx,u_char term,int qual, int verbose)
{
    u_char * p;
    struct stat st;
    if ((p = Ffield(fd,ctx,term)) == NULL) return(NULL);
    strcpy(CatPtr, p);
    if (!(qual & CTM_Q_Name_Subst)) return(Buffer);
    p = Buffer + strlen(Buffer);
    strcat(Buffer, SUBSUFF);
    if ( -1 == stat(Buffer, &st) ) {
	*p = '\0';
    } else {
	if(verbose > 2)
	    fprintf(stderr,"Using %s as substitute file\n", Buffer);
    }
    return (Buffer);
}
u_char * Fname ( FILE * fd , MD5_CTX * ctx , u_char term , int qual , int verbose ) { u_char * p ; struct stat st ; if ( ( p = Ffield ( fd , ctx , term ) ) == NULL ) return ( NULL ) ; strcpy ( CatPtr , p ) ; if ( ! ( qual & CTM_Q_Name_Subst ) ) return ( Buffer ) ; p = Buffer + strlen ( Buffer ) ; strcat ( Buffer , SUBSUFF ) ; if ( -1 == stat ( Buffer , & st ) ) { * p = ' \0 ' ; } else { if ( verbose > 2 ) fprintf ( stderr , " \n " , Buffer ) ; } return ( Buffer ) ; }
get the filename in the next field, prepend BaseDir and give back the result
strings.
get the filename in the next field prepend BaseDir and give back the result strings .