forked from KolibriOS/kolibrios
Shell 0.4.5: Multilanguage, russification, some new commands (see History.txt for details)
git-svn-id: svn://kolibrios.org@1668 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
int cmd_about(char param[])
|
||||
{
|
||||
|
||||
#if LANG_ENG
|
||||
char message[] = {
|
||||
"\
|
||||
\n\r\
|
||||
@@ -11,6 +12,17 @@ version %s\n\r\n\r\
|
||||
e-mail: albom85@yandex.ru\n\r\
|
||||
site: http://albom85.narod.ru/\n\r\n\r\
|
||||
"};
|
||||
#elif LANG_RUS
|
||||
char message[] = {
|
||||
"\
|
||||
\n\r\
|
||||
Shell ¤«ï KolibriOS\n\r\
|
||||
¢¥àá¨ï %s\n\r\n\r\
|
||||
¢â®à: €«¥ªá ¤à <20>®£®¬ § aka Albom\n\r\
|
||||
e-mail: albom85@yandex.ru\n\r\
|
||||
á ©â: http://albom85.narod.ru/\n\r\n\r\
|
||||
"};
|
||||
#endif
|
||||
|
||||
printf(message, SHELL_VERSION);
|
||||
return TRUE;
|
||||
|
||||
@@ -7,7 +7,11 @@ unsigned result;
|
||||
|
||||
if (NULL == dir)
|
||||
{
|
||||
printf(" cd directory\n\r");
|
||||
#if LANG_ENG
|
||||
printf(" cd <directory>\n\r");
|
||||
#elif LANG_RUS
|
||||
printf(" cd <äèðåêòîðèÿ>\n\r");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -6,7 +6,11 @@ unsigned date;
|
||||
unsigned time;
|
||||
|
||||
date = kol_system_date_get();
|
||||
printf(" date [dd.mm.yy]: %x%x.%x%x.%x%x",
|
||||
#if LANG_ENG
|
||||
printf(" Date [dd.mm.yy]: %x%x.%x%x.%x%x",
|
||||
#elif LANG_RUS
|
||||
printf(" „ â [¤¤.¬¬.££]: %x%x.%x%x.%x%x",
|
||||
#endif
|
||||
(date&0xf00000)>>20, (date&0xf0000)>>16, // day
|
||||
(date&0xf000)>>12, (date&0xf00)>>8, //month
|
||||
(date&0xf0)>>4, (date&0xf) ); // year
|
||||
@@ -14,7 +18,11 @@ printf(" date [dd.mm.yy]: %x%x.%x%x.%x%x",
|
||||
|
||||
time = kol_system_time_get();
|
||||
|
||||
printf("\n\r time [hh:mm:ss]: %x%x:%x%x:%x%x\n\r",
|
||||
#if LANG_ENG
|
||||
printf("\n\r Time [hh:mm:ss]: %x%x:%x%x:%x%x\n\r",
|
||||
#elif LANG_RUS
|
||||
printf("\n\r ‚६ï [çç:¬¬:áá]: %x%x:%x%x:%x%x\n\r",
|
||||
#endif
|
||||
(time&0xf0)>>4, (time&0xf), // hours
|
||||
(time&0xf000)>>12, (time&0xf00)>>8, // minutes
|
||||
(time&0xf00000)>>20, (time&0xf0000)>>16 ); // seconds
|
||||
|
||||
@@ -4,7 +4,11 @@ int cmd_help(char cmd[])
|
||||
|
||||
int i;
|
||||
|
||||
char available[]={" %d commands available:\n\r"};
|
||||
#if LANG_ENG
|
||||
char available[]={" %d commands available:\n\r"};
|
||||
#elif LANG_RUS
|
||||
char available[]={" Š®«-¢® ¤®áâã¯ëå ª®¬ ¤: %d\n\r"};
|
||||
#endif
|
||||
|
||||
if ( !strlen(cmd) )
|
||||
{
|
||||
@@ -22,7 +26,11 @@ else
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
printf (" Command \'%s\' not found.\n\r", cmd);
|
||||
#if LANG_ENG
|
||||
printf (" Command \'%s\' not found.\n\r", cmd);
|
||||
#elif LANG_RUS
|
||||
printf (" Š®¬ ¤ \'%s\' ¥ ©¤¥ .\n\r", cmd);
|
||||
#endif
|
||||
printf (available, NUM_OF_CMD);
|
||||
for (i = 0; i < NUM_OF_CMD; i++)
|
||||
printf(" %s\n\r", COMMANDS[i].name);
|
||||
|
||||
27
programs/system/shell/cmd/cmd_kerver.c
Normal file
27
programs/system/shell/cmd/cmd_kerver.c
Normal file
@@ -0,0 +1,27 @@
|
||||
int cmd_kerver(char param[])
|
||||
{
|
||||
char *kvbuf;
|
||||
char *vA, *vB, *vC, *vD;
|
||||
unsigned *Rev;
|
||||
|
||||
kvbuf = malloc(16);
|
||||
kol_get_kernel_ver(kvbuf);
|
||||
vA = kvbuf+0;
|
||||
vA = *vA;
|
||||
vB = kvbuf+1;
|
||||
vB = *vB;
|
||||
vC = kvbuf+2;
|
||||
vC = *vC;
|
||||
vD = kvbuf+3;
|
||||
vD = *vD;
|
||||
Rev = kvbuf+5;
|
||||
Rev = *Rev;
|
||||
|
||||
#if LANG_ENG
|
||||
printf (" KolibriOS v%d.%d.%d.%d. Kernel SVN-rev.: %d\n\r", vA, vB, vC, vD, Rev);
|
||||
#elif LANG_RUS
|
||||
printf (" Š®«¨¡à¨Ž‘ v%d.%d.%d.%d. SVN-ॢ. ï¤à : %d\n\r", vA, vB, vC, vD, Rev);
|
||||
#endif
|
||||
free(kvbuf);
|
||||
return TRUE;
|
||||
}
|
||||
@@ -24,7 +24,7 @@ int result;
|
||||
|
||||
if (NULL == process)
|
||||
{
|
||||
printf(" kill PID\n\r");
|
||||
printf(" kill <PID>\n\r");
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
|
||||
18
programs/system/shell/cmd/cmd_memory.c
Normal file
18
programs/system/shell/cmd/cmd_memory.c
Normal file
@@ -0,0 +1,18 @@
|
||||
|
||||
int cmd_memory(char param[])
|
||||
{
|
||||
unsigned total, free, used;
|
||||
|
||||
total = kol_system_mem();
|
||||
free = kol_system_memfree();
|
||||
used = total - free;
|
||||
|
||||
#if LANG_ENG
|
||||
printf (" Total [kB / MB / %%]: %-7d / %-5d / 100\n\r Free [kB / MB / %%]: %-7d / %-5d / %d\n\r Used [kB / MB / %%]: %-7d / %-5d / %d\n\r",
|
||||
#elif LANG_RUS
|
||||
printf (" ‚ᥣ® [Š<> / Œ<> / %%]: %-7d / %-5d / 100\n\r ‘¢®¡®¤® [Š<> / Œ<> / %%]: %-7d / %-5d / %d\n\r ˆá¯®«ì§ã¥âáï [Š<> / Œ<> / %%]: %-7d / %-5d / %d\n\r",
|
||||
#endif
|
||||
total, total/1024, free, free/1024, (free*100)/total, used, total/1024-free/1024, 100-(free*100)/total );
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
@@ -8,7 +8,11 @@ unsigned result;
|
||||
|
||||
if (NULL == dir)
|
||||
{
|
||||
printf(" mkdir directory\n\r");
|
||||
#if LANG_ENG
|
||||
printf(" mkdir <directory>\n\r");
|
||||
#elif LANG_RUS
|
||||
printf(" mkdir <¤¨à¥ªâ®à¨ï>\n\r");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,13 +5,17 @@ int cmd_more(char file[])
|
||||
kol_struct70 k70;
|
||||
kol_struct_BDVK bdvk;
|
||||
unsigned result, filesize, pos, i;
|
||||
char buf[81]; //áóôåð
|
||||
char buf[81]; //¡ãä¥à
|
||||
char temp[256];
|
||||
unsigned flags;
|
||||
|
||||
if (NULL == file)
|
||||
{
|
||||
printf (" less filename\n\r");
|
||||
#if LANG_ENG
|
||||
printf (" more <filename>\n\r");
|
||||
#elif LANG_RUS
|
||||
printf (" more <¨¬ï ä ©« >\n\r");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
@@ -41,11 +45,11 @@ k70.p16 = &bdvk;
|
||||
k70.p20 = 0;
|
||||
k70.p21 = temp;
|
||||
|
||||
result = kol_file_70(&k70); // ïîëó÷àåì èíôîðìàöèþ î ôàéëå
|
||||
result = kol_file_70(&k70); // ¯®«ãç ¥¬ ¨ä®à¬ æ¨î ® ä ©«¥
|
||||
if ( 0 != result )
|
||||
return FALSE;
|
||||
|
||||
filesize = bdvk.p32[0]; // ïîëó÷àåì ðàçìåð ôàéëà
|
||||
filesize = bdvk.p32[0]; // ¯®«ãç ¥¬ à §¬¥à ä ©«
|
||||
|
||||
buf[80]=0;
|
||||
flags = con_get_flags();
|
||||
@@ -63,7 +67,7 @@ for (pos=0;pos<filesize;pos+=80)
|
||||
k70.p20 = 0;
|
||||
k70.p21 = temp;
|
||||
|
||||
result = kol_file_70(&k70); // ÷òåíèå 80 ñèìâîëîâ
|
||||
result = kol_file_70(&k70); // ç⥨¥ 80 ᨬ¢®«®¢
|
||||
for (i=0; i<80; i++)
|
||||
{
|
||||
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
|
||||
int cmd_reboot(char param[])
|
||||
{
|
||||
kol_system_end(3);
|
||||
return TRUE;
|
||||
if (strcmp(param, "kernel"))
|
||||
{
|
||||
kol_system_end(4);
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
kol_system_end(3);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,11 @@ unsigned result;
|
||||
|
||||
if (NULL == file)
|
||||
{
|
||||
printf (" rm filename\n\r");
|
||||
#if LANG_ENG
|
||||
printf (" rm <filename>\n\r");
|
||||
#elif LANG_RUS
|
||||
printf (" rm <¨¬ï ä ©« >\n\r");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,11 @@ unsigned result;
|
||||
|
||||
if (NULL == dir)
|
||||
{
|
||||
printf(" rmdir directory\n\r");
|
||||
#if LANG_ENG
|
||||
printf(" rmdir <directory>\n\r");
|
||||
#elif LANG_ENG
|
||||
printf(" rmdir <¤¨à¥ªâ®à¨ï>\n\r");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,11 @@ unsigned result;
|
||||
|
||||
if (NULL == file)
|
||||
{
|
||||
printf(" touch filename\n\r");
|
||||
#if LANG_ENG
|
||||
printf(" touch <filename>\n\r");
|
||||
#elif LANG_RUS
|
||||
printf(" touch <¨Źď ä ŠŤ >\n\r");
|
||||
#endif
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
6
programs/system/shell/cmd/cmd_turnoff.c
Normal file
6
programs/system/shell/cmd/cmd_turnoff.c
Normal file
@@ -0,0 +1,6 @@
|
||||
|
||||
int cmd_turnoff(char param[])
|
||||
{
|
||||
kol_system_end(2);
|
||||
return TRUE;
|
||||
}
|
||||
19
programs/system/shell/cmd/cmd_uptime.c
Normal file
19
programs/system/shell/cmd/cmd_uptime.c
Normal file
@@ -0,0 +1,19 @@
|
||||
|
||||
int cmd_uptime(char param[])
|
||||
{
|
||||
unsigned time_tick, up_days, up_hours, up_minutes, up_seconds, up_millisecs;
|
||||
|
||||
time_tick = kol_time_tick();
|
||||
up_days = (time_tick/(24*60*60*100));
|
||||
up_hours = (time_tick/(60*60*100))%24;
|
||||
up_minutes = (time_tick/(60*100))%60;
|
||||
up_seconds = (time_tick/100)%60;
|
||||
up_millisecs = (time_tick*10)%100;
|
||||
|
||||
#if LANG_ENG
|
||||
printf (" Uptime: %d day(s), %d:%d:%d.%d\n\r", up_days, up_hours, up_minutes, up_seconds, up_millisecs);
|
||||
#elif LANG_RUS
|
||||
printf (" Uptime: %d ¤¥©, %d:%d:%d.%d\n\r", up_days, up_hours, up_minutes, up_seconds, up_millisecs);
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
Reference in New Issue
Block a user