Shell: ls command fix, other small fixes

git-svn-id: svn://kolibrios.org@2617 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
Albom 2012-04-16 10:40:07 +00:00
parent 0485c4d0b8
commit f5c6b33aac
10 changed files with 38 additions and 40 deletions

View File

@ -1,3 +1,9 @@
Shell 0.5.2 // 16.04.2012 // Albom
=======================================
* Исправление в команде ls
* Незначительные другие исправления
Shell 0.5.1 // 15.04.2012 // Albom
=======================================
* Некоторые незначительные исправления

View File

@ -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;

View File

@ -9,7 +9,7 @@ char buf[81]; //
char temp[256];
unsigned flags;
if (NULL == file)
if (strlen(file)<1)
{
#if LANG_ENG
printf (" more <filename>\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;
}
}

View File

@ -1,6 +1,6 @@
int cmd_pwd(char param[])
{
printf (" %s\n\r", cur_dir);
printf (" %s/\n\r", cur_dir);
return TRUE;
}

View File

@ -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;
}

View File

@ -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;
}

View File

@ -1,5 +1,5 @@
#define SHELL_VERSION "0.5.1"
#define SHELL_VERSION "0.5.2"
extern char PATH[256];
extern char PARAM[256];

View File

@ -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[]={" <20>¥â â ª®© ª®¬ ­¤ë - '%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;
}

View File

@ -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);

View File

@ -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));