void Cleanup(STRPTR msg) { if (msg) { if (IntuitionBase && !((struct Process *)FindTask(NULL))->pr_CLI) { ShowMessage("IControl", msg, MSG(MSG_OK)); } else { printf("IControl: %s\n", msg); } } KillGUI(); FreeArguments(); CloseLibs(); CleanupLocale(); exit(prog_exitcode); }
int ResourceEntry( void ) { struct ISAPNPBase* ISAPNPBase; struct RDArgs* rdargs; int rc = -1; struct { ULONG m_ShowConfig; ULONG m_ShowOptions; /* ULONG m_Remove;*/ } args = { FALSE, FALSE/*, FALSE*/ }; if( ! OpenLibs() ) { CloseLibs(); return RETURN_FAIL; } ISAPNPBase = (struct ISAPNPBase* ) OpenResource( ISAPNPNAME ); if( ISAPNPBase == NULL ) { Printf( ISAPNPNAME " not found.\n" ); CloseLibs(); return RETURN_FAIL; } rdargs = ReadArgs( TEMPLATE, (LONG *) &args, NULL ); if( rdargs != NULL ) { if( ! args.m_ShowConfig && args.m_ShowOptions ) { Printf( "SHOWOPTIONS can only be used together with SHOWCONFIG\n" ); rc = RETURN_ERROR; } else { if( args.m_ShowConfig ) { ShowCards( args.m_ShowOptions, ISAPNPBase ); rc = RETURN_OK; } /* if( args.m_Remove ) { // Dangerous! Only for debugging FreeISAPNPBase( ISAPNPBase ); ISAPNPBase->m_ConfigDev->cd_Flags |= CDF_CONFIGME; ISAPNPBase->m_ConfigDev->cd_Driver = NULL; RemResource( ISAPNPBase ); rc = RETURN_OK; }*/ } FreeArgs( rdargs ); } if( rc == -1 ) { Printf( "Usage: ISA-PnP [ SHOWCONFIG [ SHOWOPTIONS ] ] [ REMOVE ]\n" ); rc = RETURN_ERROR; } CloseLibs(); return rc; }