Index: commmands.c =================================================================== --- commmands.c (Revision 602) +++ commmands.c (Arbeitskopie) @@ -301,7 +301,7 @@ return -1; } else { cd_args++; - char* path = shell_get_absolute_path(cd_args); + char* path = io_get_absolute_path(cd_args); DIR* dir = opendir(path); if (dir == NULL) { Index: shell.c =================================================================== --- shell.c (Revision 602) +++ shell.c (Arbeitskopie) @@ -150,7 +150,7 @@ } else if (argc == 2) { // Wenn nur ein Argument uebergeben wird, wird das Argument als // Dateiname fuer ein Shell-Skript benutzt. - char* path = shell_get_absolute_path(argv[1]); + char* path = io_get_absolute_path(argv[1]); FILE* script = fopen(path, "r"); free(path); @@ -240,60 +240,6 @@ } -char* shell_get_absolute_path(char* path) -{ - char* cwd = getcwd(NULL, 0); - char* buffer = malloc(strlen(path) + strlen(cwd) + 2); - size_t cwd_len = strlen(cwd); - - //Ueberpruefen, ob ein relativer pfad vorliegt - if(strcmp(path, "..") == 0) - { - //CWD kopieren - memcpy(buffer, cwd, cwd_len + 1); - - int i = strlen(buffer) - 2; - for(; i > 0; i--) - { - if(buffer[i] == '/') - { - if(buffer[i-1] == ':') - { - i++; - } - buffer[i] = 0; - break; - } - } - } - else if((strcmp(path, ".") == 0) && (strlen(path) == 1)) - { - memcpy(buffer, cwd, cwd_len); - buffer[cwd_len] = 0; - } - else if(strstr(path, ":/") == NULL) - { - //CWD kopieren - memcpy(buffer, cwd, cwd_len); - - - if(buffer[cwd_len-1] != '/') - { - buffer[cwd_len] = '/'; - memcpy((void*)((dword)buffer + cwd_len + 1), path, strlen(path) + 1); - } - else - { - memcpy((void*)((dword)buffer + cwd_len), path, strlen(path) + 1); - } - } - else - { - memcpy(buffer, path, strlen(path) + 1); - } - return buffer; -} - /** * Testet ob der Befehl am Anfang der uebergebenen Kommandozeile steht. * Index: shell.h =================================================================== --- shell.h (Revision 602) +++ shell.h (Arbeitskopie) @@ -36,8 +36,6 @@ #ifndef _SHELL_H_ #define _SHELL_H_ -char* shell_get_absolute_path(char* path); - bool shell_match_command(const char* cmd, const char* cmdline); int shell_command_default(int argc, char* argv[], const char* args);