diff --git a/programs/system/shell/History.txt b/programs/system/shell/History.txt index 2fa8878570..d4c60a56a8 100644 --- a/programs/system/shell/History.txt +++ b/programs/system/shell/History.txt @@ -1,3 +1,9 @@ +Shell 0.5.2 // 16.04.2012 // Albom +======================================= +* ╚ёяЁртыхэшх т ъюьрэфх ls +* ═хчэрўшЄхы№э√х фЁєушх шёяЁртыхэш  + + Shell 0.5.1 // 15.04.2012 // Albom ======================================= * ═хъюЄюЁ√х эхчэрўшЄхы№э√х шёяЁртыхэш  diff --git a/programs/system/shell/cmd/cmd_ls.c b/programs/system/shell/cmd/cmd_ls.c index d9a3bad68f..cd86892039 100644 --- a/programs/system/shell/cmd/cmd_ls.c +++ b/programs/system/shell/cmd/cmd_ls.c @@ -7,13 +7,14 @@ unsigned *n; unsigned num_of_file; unsigned *t; unsigned type_of_file; -int i; +int i, result; + k70.p00 = 1; k70.p04 = 0; k70.p08 = 0; -k70.p12 = 2*1024*1024; // 2 MB -k70.p16 = malloc(2*1024*1024); +k70.p12 = 10000; +k70.p16 = malloc(32+k70.p12*560); k70.p20 = 0; /// !!! @@ -22,8 +23,9 @@ if ( !strlen(dir) ) k70.p21 = cur_dir; else k70.p21 = dir; - -if ( !kol_file_70(&k70) ) // яЁютхЁ хь ёє∙хёЄтютрэшх ърЄрыюур + +result = kol_file_70(&k70); +if ( !((result==0) || (result==6)) ) // яЁютхЁ хь ёє∙хёЄтютрэшх ърЄрыюур { free(k70.p16); return FALSE; diff --git a/programs/system/shell/cmd/cmd_more.c b/programs/system/shell/cmd/cmd_more.c index 7a23b5a48f..78fb137129 100644 --- a/programs/system/shell/cmd/cmd_more.c +++ b/programs/system/shell/cmd/cmd_more.c @@ -9,7 +9,7 @@ char buf[81]; // char temp[256]; unsigned flags; -if (NULL == file) +if (strlen(file)<1) { #if LANG_ENG printf (" more \n\r"); @@ -17,7 +17,7 @@ if (NULL == file) printf (" more <имя файла>\n\r"); #endif return FALSE; - } + } if ( '/' == file[0]) { @@ -25,11 +25,7 @@ if ( '/' == file[0]) if ( !file_check(temp) ) { - #if LANG_ENG - printf (" File not found!\n\r"); - #elif LANG_RUS - printf (" Файл не найден!\n\r"); - #endif + file_not_found(file); return FALSE; } } @@ -42,11 +38,7 @@ else if ( !file_check(temp) ) { - #if LANG_ENG - printf (" File not found!\n\r"); - #elif LANG_RUS - printf (" Файл не найден!\n\r"); - #endif + file_not_found(file); return FALSE; } } diff --git a/programs/system/shell/cmd/cmd_pwd.c b/programs/system/shell/cmd/cmd_pwd.c index ad6177d3d9..9b1baaca0a 100644 --- a/programs/system/shell/cmd/cmd_pwd.c +++ b/programs/system/shell/cmd/cmd_pwd.c @@ -1,6 +1,6 @@ int cmd_pwd(char param[]) { -printf (" %s\n\r", cur_dir); +printf (" %s/\n\r", cur_dir); return TRUE; } diff --git a/programs/system/shell/cmd/cmd_reboot.c b/programs/system/shell/cmd/cmd_reboot.c index 7c62e869ca..f4bcd98db1 100644 --- a/programs/system/shell/cmd/cmd_reboot.c +++ b/programs/system/shell/cmd/cmd_reboot.c @@ -2,13 +2,8 @@ int cmd_reboot(char param[]) { if (!strcmp(param, "kernel")) - { kol_system_end(4); - return TRUE; - } else - { kol_system_end(3); - return TRUE; - } +return TRUE; } diff --git a/programs/system/shell/cmd/cmd_ver.c b/programs/system/shell/cmd/cmd_ver.c index 4a61ab1fd4..05b6ef170b 100644 --- a/programs/system/shell/cmd/cmd_ver.c +++ b/programs/system/shell/cmd/cmd_ver.c @@ -26,11 +26,9 @@ if (!strcmp(param, "kernel")) printf (" KolibriOS v%d.%d.%d.%d. SVN-рев. ядра: %d\n\r", vA, vB, vC, vD, Rev); #endif free(kvbuf); - return TRUE; } else - { printf (" Shell v%s\n\r", SHELL_VERSION); - return TRUE; - } + +return TRUE; } diff --git a/programs/system/shell/globals.h b/programs/system/shell/globals.h index f20f671555..29c205ec51 100644 --- a/programs/system/shell/globals.h +++ b/programs/system/shell/globals.h @@ -1,5 +1,5 @@ -#define SHELL_VERSION "0.5.1" +#define SHELL_VERSION "0.5.2" extern char PATH[256]; extern char PARAM[256]; diff --git a/programs/system/shell/modules/module_executable.c b/programs/system/shell/modules/module_executable.c index 4cb6726a96..6e42d99b16 100644 --- a/programs/system/shell/modules/module_executable.c +++ b/programs/system/shell/modules/module_executable.c @@ -4,12 +4,7 @@ int executable_run(char cmd[], char args[]) { -char exec[256]; -#if LANG_ENG - char error_starting[]={" No such command '%s'.\n\r"}; -#elif LANG_RUS - char error_starting[]={" Нет такой команды - '%s'.\n\r"}; -#endif +char exec[256]; int result; if ( '/' == cmd[0]) // если путь абсолютный @@ -18,7 +13,7 @@ if ( '/' == cmd[0]) // if ( !file_check(exec) ) // проверяем существование файла { - printf(error_starting, cmd); + file_not_found(cmd); return FALSE; } } @@ -30,15 +25,13 @@ else strcat(exec, "/"); // add slash strcat(exec, cmd); - printf("\n%s\n", exec); - if ( !file_check(exec) ) // проверяем существование файла { strcpy(exec, "/rd/1/"); // проверяем файл на виртуальном диске strcat(exec, cmd); if ( !file_check(exec) ) // проверяем существование файла { - printf(error_starting, cmd); + file_not_found(cmd); return FALSE; } } @@ -65,7 +58,7 @@ if (result > 0) } else { - printf(error_starting, cmd); + file_not_found(cmd); return FALSE; } diff --git a/programs/system/shell/prototypes.h b/programs/system/shell/prototypes.h index 00b2779450..c54953fec7 100644 --- a/programs/system/shell/prototypes.h +++ b/programs/system/shell/prototypes.h @@ -2,6 +2,7 @@ /// =========================================================== int file_check(char file[]); +void file_not_found(char file[]); int dir_check(char dir[]); void dir_truncate(char dir[]); int iswhite(char c); diff --git a/programs/system/shell/shell.c b/programs/system/shell/shell.c index d289e6f832..0be17057e3 100644 --- a/programs/system/shell/shell.c +++ b/programs/system/shell/shell.c @@ -66,6 +66,17 @@ else /// =========================================================== +void file_not_found(char file[]) +{ +#if LANG_ENG + printf (" File '%s' not found.\n\r", file); +#elif LANG_RUS + printf (" Файл '%s' не найден.\n\r", file); +#endif +} + +/// =========================================================== + int iswhite(char c) { return ((' ' == c) || ('\t' == c) || (13 == c) || (10 == c));