int main(void) { OpenLibs(); GetArguments(); Action(); Cleanup(0); return 0; }
int main(void) { InitLocale("System/Prefs/IControl.catalog", 1); InitMenus(); OpenLibs(); GetArguments(); InitPrefs((STRPTR)args[ARG_FROM], (args[ARG_USE] ? TRUE : FALSE), (args[ARG_SAVE] ? TRUE : FALSE)); MakeGUI(); HandleAll(); Cleanup(NULL); return 0; }
int main(int argc, char *argv[]) { char *cdfile = NULL; char *ctfile = NULL; char *pofile = NULL; char *newctfile = NULL; char *catalog = NULL; char *source; char *template; int makenewct = FALSE; int makecatalog = FALSE; int i; if(argc == 0) /* Aztec's entry point for workbench programs */ { fprintf(stderr, "FlexCat can't be run from Workbench!\n" \ "\n" "Open a Shell session and type FlexCat ?\n" \ "for more information\n"); exit(5); } if(OpenLibs() == FALSE) exit(20); OpenFlexCatCatalog(); /* Big Endian vs. Little Endian (both supported ;-) */ if(!SwapChoose()) { fprintf(stderr, "FlexCat is unable to determine\n" \ "the byte order used by your system.\n" \ "It's neither Little nor Big Endian?!.\n"); exit(5); } #ifdef AMIGA ReadPrefs(); #endif if(argc == 1) { Usage(); } for(i = 1; i < argc; i++) { if(Strnicmp(argv[i], "catalog=", 8) == 0) { catalog = argv[i] + 8; makecatalog = TRUE; } else if(Stricmp(argv[i], "catalog") == 0) { if(i == argc - 1) { catalog = NULL; makecatalog = TRUE; } else if(i < argc - 1) { if(isParam(argv[i + 1]) != TRUE) { catalog = argv[i + 1]; i++; makecatalog = TRUE; } else { catalog = NULL; makecatalog = TRUE; } } } else if(Strnicmp(argv[i], "pofile=", 7) == 0) { pofile = argv[i] + 7; } else if(Stricmp(argv[i], "pofile") == 0) { if(i == argc - 1) pofile = NULL; else if(i < argc - 1) { if(isParam(argv[i + 1]) != TRUE) { pofile = argv[i + 1]; i++; } else pofile = NULL; } } else if(Strnicmp(argv[i], "codeset=", 8) == 0) { strcpy(DestCodeset, argv[i] + 8); } else if(Stricmp(argv[i], "codeset") == 0) { if(i == argc - 1) DestCodeset[0] = '\0'; else if(i < argc - 1) { if(isParam(argv[i + 1]) != TRUE) { strcpy(DestCodeset, argv[i + 1]); i++; } else DestCodeset[0] = '\0'; } } else if(Strnicmp(argv[i], "version=", 8) == 0) { CatVersion = strtol(argv[i]+8, NULL, 10); } else if(Stricmp(argv[i], "version") == 0) { if(i == argc - 1) CatVersion = -1; else if(i < argc - 1) { if(isParam(argv[i + 1]) != TRUE) { CatVersion = strtol(argv[i + 1], NULL, 10); i++; } else CatVersion = -1; } } else if(Strnicmp(argv[i], "revision=", 9) == 0) { CatRevision = strtol(argv[i]+9, NULL, 10); } else if(Stricmp(argv[i], "revision") == 0) { if(i == argc - 1) CatRevision = -1; else if(i < argc - 1) { if(isParam(argv[i + 1]) != TRUE) { CatRevision = strtol(argv[i + 1], NULL, 10); i++; } else CatRevision = -1; } } else if(Stricmp(argv[i], "nooptim") == 0) { NoOptim = TRUE; } else if(Stricmp(argv[i], "fill") == 0) { Fill = TRUE; } else if(Stricmp(argv[i], "quiet") == 0) { Quiet = TRUE; } else if(Stricmp(argv[i], "flush") == 0) { DoExpunge = TRUE; } else if(Stricmp(argv[i], "nobeep") == 0) { NoBeep = TRUE; } else if(Stricmp(argv[i], "nobufferedio") == 0) { NoBufferedIO = TRUE; } else if(Strnicmp(argv[i], "newctfile=", 10) == 0) { newctfile = argv[i] + 10; makenewct = TRUE; } else if(Stricmp(argv[i], "newctfile") == 0) { if(i == argc - 1) { newctfile = NULL; makenewct = TRUE; } else if(i < argc - 1) { if(isParam(argv[i + 1]) != TRUE) { newctfile = argv[i + 1]; i++; makenewct = TRUE; } else { newctfile = NULL; makenewct = TRUE; } } } else if(Stricmp(argv[i], "nolangtolower") == 0) { LANGToLower = FALSE; } else if(Stricmp(argv[i], "modified") == 0) { Modified = TRUE; } else if(Stricmp(argv[i], "warnctgaps") == 0) { WarnCTGaps = TRUE; } else if(Stricmp(argv[i], "copymsgnew") == 0) { CopyNEWs = TRUE; } else if(Stricmp(argv[i], "oldmsgnew") == 0) { snprintf(Old_Msg_New, sizeof(Old_Msg_New), "; %s", argv[++i]); } else if(Stricmp(argv[i], "noautodate") == 0 || Stricmp(argv[i], "nospaces") == 0) { // just swallow some no longer supported options to // keep old scripts alive and happy } else if(cdfile == NULL) { if(Stricmp(argv[i], "?") == 0 || Stricmp(argv[i], "-h") == 0 || Stricmp(argv[i], "help") == 0 || Stricmp(argv[i], "--help") == 0) { Usage(); } cdfile = argv[i]; // find out file extension and depending on it // we eiterh scan a CD file or the supplied pot file if(strstr(cdfile, ".pot") != NULL) { if(!ScanPOFile(cdfile, FALSE)) MyExit(10); } else { if(!ScanCDFile(cdfile)) MyExit(10); } } else if(strchr(argv[i], '=') != NULL) { /* Determine basename. */ if(BaseName == NULL && cdfile != NULL) { char *lslash = strrchr(cdfile, '/'); char *ldot = strrchr(cdfile, '.'); if(lslash == NULL) lslash = cdfile; else lslash++; if(ldot == NULL) ldot = cdfile + strlen(cdfile); if(ldot - lslash > 0) { BaseName = calloc(ldot - lslash + 3, 1); strncpy(BaseName, lslash, ldot - lslash); } } source =AllocString(argv[i]); template = strchr(source, '='); *template++ = '\0';
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; }
struct ISAPNPBase* ASMCALL initRoutine( REG( d0, struct ISAPNPBase* res ), REG( a0, APTR seglist ), REG( a6, struct ExecBase* sysbase ) ) { D(bug("[ISAPNP] Init\n")); /* SysBase = sysbase;*/ if(OpenLibs() ) { // Set up the ISAPNPBase structure res->m_Library.lib_Node.ln_Type = NT_RESOURCE; res->m_Library.lib_Node.ln_Name = (STRPTR) ResName; res->m_Library.lib_Flags = LIBF_SUMUSED | LIBF_CHANGED; res->m_Library.lib_Version = VERSION; res->m_Library.lib_Revision = REVISION; res->m_Library.lib_IdString = (STRPTR) IDString; NewList( &res->m_Cards ); /* Base address, on i386 we don't have any mapping res->m_Base = NULL; */ res->m_RegReadData = 0x0000; if( ! ISAPNP_ScanCards( res ) ) { // No cards found Req( "No PnP ISA cards found." ); FreeISAPNPBase( res ); } else { if( ! PatchBrokenCards( res ) ) { FreeISAPNPBase( res ); } else { struct ISAPNP_Card* card; card = ISAPNP_AllocCard( res ); if( card == NULL ) { Req( "Out of memory!" ); FreeISAPNPBase( res ); } else { static const char descr[] = "Non-PnP devices"; char* d; d = AllocVec( sizeof( descr ), MEMF_PUBLIC ); if( d != NULL ) { CopyMem( (void*) descr, d, sizeof( descr ) ); card->isapnpc_Node.ln_Name = d; } card->isapnpc_ID.isapnpid_Vendor[ 0 ] = '?'; card->isapnpc_ID.isapnpid_Vendor[ 1 ] = '?'; card->isapnpc_ID.isapnpid_Vendor[ 2 ] = '?'; card->isapnpc_SerialNumber = -1; // Add *first* AddHead( &res->m_Cards, (struct Node*) card ); // Let's see if we're to disable any cards or devices etc /* TODO: We will start up early because we can have even ISA PnP video cards, disk controllers, etc. Because of this we can't load any list of disabled devices. Think off what to do with them is really a big TODO. if( ! HandleToolTypes( current_binding.cb_ToolTypes, card, res ) ) { // Error requester already displayed. FreeISAPNPBase( res ); } else {*/ if( ! ISAPNP_ConfigureCards( res ) ) { // Unable to configure cards Req( "Unable to configure the cards. This is most likely\n" "because of an unresolvable hardware conflict.\n\n" "Use the DISABLE_DEVICE tool type to disable one of\n" "the devices in conflict." ); FreeISAPNPBase( res ); } else ISAPNPBase = res; /* }*/ } } } } return ISAPNPBase; }
BOOL __asm __saveds OpenLibs(register __a6 struct PopupMenuBase *l) { if(UtilityBase) return TRUE; l->pmb_UtilityBase=OpenLibrary("utility.library",37L); if(l->pmb_UtilityBase) { UtilityBase=l->pmb_UtilityBase; l->pmb_GfxBase=OpenLibrary("graphics.library",40L); if(!l->pmb_GfxBase) l->pmb_GfxBase=OpenLibrary("graphics.library",37L); else V40Gfx=TRUE; if(l->pmb_GfxBase) { GfxBase=(struct GfxBase *)l->pmb_GfxBase; l->pmb_IntuitionBase=OpenLibrary("intuition.library",37L); if(l->pmb_IntuitionBase) { IntuitionBase=(struct IntuitionBase *)l->pmb_IntuitionBase; l->pmb_DOSBase=OpenLibrary("dos.library",0L); if(l->pmb_DOSBase) { DOSBase=(struct DosLibrary *)l->pmb_DOSBase; l->pmb_ExecBase = (struct Library *)SysBase; l->pmb_CxBase=OpenLibrary("commodities.library",37L); if(l->pmb_CxBase) { CxBase=l->pmb_CxBase; LayersBase=OpenLibrary("layers.library",0); l->pmb_LayersBase=LayersBase; if(LayersBase) { CyberGfxBase=OpenLibrary("cybergraphics.library",39L); if(CyberGfxBase) CyberGfx=TRUE; l->pmb_CyberGfxBase=CyberGfxBase; #if defined(__AROS__) || defined(__MORPHOS) if((MemPool = CreatePool(MEMF_ANY | MEMF_CLEAR | MEMF_SEM_PROTECTED, 10240L, 10240L))) { #else if((MemPool = CreatePool(MEMF_ANY, 10240L, 10240L))) { #endif PM_Prefs_Load(PMP_PATH); return TRUE; } } } } } } } return FALSE; } // // Library initializtion // int __asm __saveds __UserLibInit(register __a6 struct PopupMenuBase *l) { //kprintf("UserLibInit, pmbase = %08lx\n", l); #ifdef __AROS__ SysBase = (struct ExecBase *)l->pmb_ExecBase; #else SysBase=*((struct ExecBase **)4); #endif if(!OpenLibs(l)) return -1; //kprintf("UserLibInit failed\n"); return 0; }
struct ISAPNPBase* ASMCALL initRoutine( REG( d0, struct ISAPNPBase* res ), REG( a0, APTR seglist ), REG( a6, struct ExecBase* sysbase ) ) { SysBase = sysbase; if( ! OpenLibs() ) { // No libraries? Req( "Failed to open required libraries." ); } else { ULONG actual; struct CurrentBinding current_binding; actual = GetCurrentBinding( ¤t_binding, sizeof( current_binding ) ); if( actual < sizeof( current_binding ) ) { // No legal CurrentBinding structure Req( "No legal CurrentBinding structure found." ); } else { struct ConfigDev* cd = current_binding.cb_ConfigDev; if( cd == NULL ) { // No card found Req( "No bridge card found." ); } else { if( cd->cd_Rom.er_Manufacturer != 2150 || cd->cd_Rom.er_Product != 1 ) { // Unsupported ISA bridge Req( "Unsupported ISA bridge: %ld/%ld.\n" "Only the GG2 Bus+ card is supported.", cd->cd_Rom.er_Manufacturer, cd->cd_Rom.er_Product ); } else { if( cd->cd_BoardAddr == NULL ) { // No board address? Req( "No board address?" ); } else { // Set up the ISAPNPBase structure res->m_Library.lib_Node.ln_Type = NT_RESOURCE; res->m_Library.lib_Node.ln_Name = (STRPTR) ResName; res->m_Library.lib_Flags = LIBF_SUMUSED | LIBF_CHANGED; res->m_Library.lib_Version = VERSION; res->m_Library.lib_Revision = REVISION; res->m_Library.lib_IdString = (STRPTR) IDString; NewList( &res->m_Cards ); res->m_Base = cd->cd_BoardAddr; res->m_RegReadData = 0x0000; res->m_ConfigDev = cd; if( ! ISAPNP_ScanCards( res ) ) { // No cards found Req( "No PnP ISA cards found." ); FreeISAPNPBase( res ); } else { struct ISAPNP_Card* card; card = ISAPNP_AllocCard( res ); if( card == NULL ) { Req( "Out of memory!" ); FreeISAPNPBase( res ); } else { static const char descr[] = "Non-PnP devices"; char* d; d = AllocVec( sizeof( descr ), MEMF_PUBLIC ); if( d != NULL ) { CopyMem( (void*) descr, d, sizeof( descr ) ); card->isapnpc_Node.ln_Name = d; } card->isapnpc_ID.isapnpid_Vendor[ 0 ] = '?'; card->isapnpc_ID.isapnpid_Vendor[ 1 ] = '?'; card->isapnpc_ID.isapnpid_Vendor[ 2 ] = '?'; card->isapnpc_SerialNumber = -1; // Add *first* AddHead( &res->m_Cards, (struct Node*) card ); // Let's see if we're to disable any cards or devices etc if( ! HandleToolTypes( current_binding.cb_ToolTypes, card, res ) ) { // Error requester already displayed. FreeISAPNPBase( res ); } else { if( ! ISAPNP_ConfigureCards( res ) ) { // Unable to configure cards Req( "Unable to configure the cards. This is most likely\n" "because of an unresolvable hardware conflict.\n\n" "Use the DISABLE_DEVICE tool type to disable one of\n" "the devices in conflict." ); FreeISAPNPBase( res ); } else { cd->cd_Flags &= ~CDF_CONFIGME; cd->cd_Driver = res; ISAPNPBase = res; } } } } } } } } } return ISAPNPBase; }