initialize()
{
+ register char *cindex, *cptr ;
+
sprintf(tmpfname,"%s/abc%d",TMP_DIR,getpid());
- strcpy(datfname,program);
+ /* Find the basename */
+ /* Strip leading directories */
+ cindex= (char *)0 ;
+ for ( cptr=program ; *cptr ; cptr++ ) if ( *cptr=='/' ) cindex=cptr ;
+ if ( !cindex ) cindex= program ;
+ else {
+ cindex++ ;
+ if ( !*cindex ) {
+ warning("Null program name, assuming \"basic\"") ;
+ cindex= "basic" ;
+ }
+ }
+ cptr=datfname ;
+ while ( *cptr++ = *cindex++ ) ;
+ /* Strip trailing suffix */
+ if ( cptr>datfname+3 && cptr[-3]=='.' ) cptr[-3]=0 ;
strcat(datfname,".d");
yyin= fopen(inpfile,"r");
emfile= fopen(outfile,"w");