/* * Bridge: emit */ void T_emit( c_t * p_file ) { //printf("Emitting to file: %s\n", p_file); static int first = 0; if ( first == 0 ) { first = 1; if ( 0 == ( outputfile = fopen( p_file, "w" ) ) ) { T_print( "bad news could not open output file" ); T_exit( 1 ); } } fprintf( outputfile, "%s", buffer ); // printf("---\n"); // printf("%s", buffer); // printf("---\n"); T_clear(); }
/* * Bridge: emit */ void T_emit( c_t * p_file ) { FILE * outputfile; if ( strcmp( "stdout", p_file ) == 0 ) { outputfile = stdout; } else { // Create directories as needed. _mkdir( p_file ); // Open file. if ( 0 == ( outputfile = fopen( p_file, "w" ) ) ) { T_print( "bad news could not open output file" ); T_exit( 1 ); } } fprintf( outputfile, "%s", buffer ); T_clear(); }