void ObjFini( void ) { //******************** ObjFlushLabels(); // In case there're still pending labels OWLFileFini( OwlFile ); close( objFile ); fclose( ErrorFile ); if( ErrorsExceeding( 0 ) || ( _IsOption( WARNING_ERROR ) && WarningsExceeding( 0 ) ) ) { remove( objName ); ExitStatus = EXIT_FAILURE; } else if( !WarningsExceeding( 0 ) ) { remove( errorFilename ); } OWLFini( OwlHandle ); SectionFini(); }
void main( int argc, char *argv[] ) { char buffer[ BUFFER_SIZE ]; owl_handle owl; owl_file_handle file; owl_string_table *table; owl_client_funcs funcs = { NULL, NULL, NULL, malloc, free }; char *t_buff; owl = OWLInit( &funcs, OWL_CPU_PPC ); file = OWLFileInit( owl, "test", NULL, OWL_FORMAT_ELF, OWL_FILE_OBJECT ); table = OWLStringInit( file ); while( fgets( buffer, BUFFER_SIZE, stdin ) != NULL ) { addStrings( table, buffer ); OWLStringDump( table ); } t_buff = malloc( OWLStringTableSize( table ) + 1 ); OWLStringEmit( table, t_buff ); write( STDOUT_FILENO, t_buff, OWLStringTableSize( table ) ); free( t_buff ); OWLStringFini( table ); OWLFileFini( file ); OWLFini( owl ); }