- if(strcmp(Arg, "SCRIPT") == 0) {
- Log("Config Script: '%s'", value);
- gsConfigScript = value;
- } else {
- Warning("Kernel config setting '%s' is not recognised", Arg);
- }
-
- }
-}
-
-/**
- * \fn void System_ExecuteScript()
- */
-void System_ExecuteScript()
-{
- int fp;
- int fLen = 0;
- int i = 0;
- char *fData;
- tConfigFile *file;
- tConfigLine *line;
-
- // Open Script
- fp = VFS_Open(gsConfigScript, VFS_OPENFLAG_READ);
- if(fp == -1) {
- Warning("[CFG] Passed script '%s' does not exist", gsConfigScript);
- return;
- }
-
- // Read into memory buffer
- VFS_Seek(fp, 0, SEEK_END);
- fLen = VFS_Tell(fp);
- VFS_Seek(fp, 0, SEEK_SET);
- fData = malloc(fLen+1);
- VFS_Read(fp, fLen, fData);
- fData[fLen] = '\0';
- VFS_Close(fp);
-
-
-
- // Parse File
- file = System_Int_ParseFile(fData);
-
- // Loop lines
- for( i = 0; i < file->nLines; i++ )
- {
- line = &file->Lines[i];
- if( line->nParts == 0 ) continue; // Skip blank
-
- // Mount
- if( strcmp(line->Parts[0], "mount") == 0 ) {
- if( line->nParts != 4 ) {
- Warning("Configuration command 'mount' requires 3 arguments, %i given",
- line->nParts-1);
- continue;
- }
- //Log("[CFG ] Mount '%s' to '%s' (%s)",
- // line->Parts[1], line->Parts[2], line->Parts[3]);
- //! \todo Use an optional 4th argument for the options string
- VFS_Mount(line->Parts[1], line->Parts[2], line->Parts[3], "");
- }
- // Module
- else if(strcmp(line->Parts[0], "module") == 0) {
- if( line->nParts < 2 || line->nParts > 3 ) {
- Warning("Configuration command 'module' requires 1 or 2 arguments, %i given",
- line->nParts-1);
- continue;
- }
- if( line->nParts == 3 )
- Module_LoadFile(line->Parts[1], line->Parts[2]);