- init: Booten mit init.cfg und Fehlermeldung entfernen -- Antoine Kaufmann <toni@xxxxxxxxxxxxxxxx>
Index: src/modules/init/init.c =================================================================== --- src/modules/init/init.c (Revision 920) +++ src/modules/init/init.c (Arbeitskopie) @@ -128,96 +128,7 @@ void _start(dword modules) load_modules((init_module_list_t*) modules); - - //Den Prozessen erstmal Zeit geben, sich zu registrieren - yield(); - yield(); - yield(); - - - if(boot != NULL) - { - boot += 5; - char* init_config_name = "config/init.cfg"; - char* init_config_path = malloc(strlen(init_config_name) + strlen(boot) + 1); - memcpy(init_config_path, boot, strlen(boot)); - memcpy((void*)((dword) init_config_path + strlen(boot)), init_config_name, strlen(init_config_name) + 1); - - directory_close(directory_open(boot)); - - - FILE* config_file = fopen(init_config_path, "r"); - fclose(config_file); - - config_file = fopen(init_config_path, "r"); - if(config_file == NULL) - { - puts("Fehler beim Oeffnen der Konfigurationsdatei!"); - } - else - { - //Groesse der Datei holen - fseek(config_file, 0, SEEK_END); - size_t size = ftell(config_file); - - //Buffer allokieren - char* config_file_content = malloc(size+1); - - //Datei auslesen - fseek(config_file, 0, SEEK_SET); - fread(config_file_content, 1, 4096, config_file); - fclose(config_file); - config_file_content[size] = 0; - - //Datei zeilenweise auswerten - char* config_line = config_file_content; - int i; - for(i = 0; i <= size; i++) - { - if((config_file_content[i] == '\n') || (config_file_content[i] == '\0')) - { - config_file_content[i] = '\0'; - - if(config_line == strstr(config_line, "start ")) - { - char* module_path = config_line + 6; - char* module_args = strstr(module_path, " "); - - //Eventuelle Argumente zuschneiden - if(module_args != NULL) - { - module_args[0] = '\0'; - //module_args++; - } - - char* module_path_comp = malloc(strlen(boot) + strlen(module_path) + 1); - memcpy(module_path_comp, boot, strlen(boot)); - memcpy((void*)((dword)module_path_comp + strlen(boot)), module_path, strlen(module_path) + 1); - - if (module_args != NULL) { - module_args[0] = ' '; - } - - if(start_program(module_path_comp, /*module_args*/module_path, 0) == 0) - { - printf("Fehler beim laden von '%s'!\n", module_path_comp); - } - - free(module_path_comp); - } - - config_line = &(config_file_content[i + 1]); - config_file_content[i] = '\n'; - } - } - - free(config_file_content); - } - - free(init_config_path); - } - while(TRUE) { wait_for_rpc(); }
Attachment:
pgpqSGpDVZvHw.pgp
Description: PGP signature