/programs/system/shell/Docs_rus.txt |
---|
43,12 → 43,13 |
history cïèñîê ïîñëåäíèõ èñïîëüçîâàííûõ êîìàíä |
kill óáèâàåò ïðîöåññ ïî <PID>. kill all óáèâàåò âñå ïðîöåññû, ñëîòû >=2 |
ls âûâîäèò ñïèñîê ôàéëîâ â òåêóùåì êàòàëîãå èëè óêàçàííîì <êàòàëîãå> |
êëþ÷ '-1' âûâîäèò ñïèñîê â îäíó êîëîíêó, èíà÷å ìíîãîêîëîíî÷íûé âûâîä |
mkdir cîçäàåò <êàòàëîã>. Ïîääåðæèâàþòñÿ àáñîëþíûå è îòíîñèòåëüíûå ïóòè |
more âûâîäèò ñîäåðæèìîå <ôàéëà> íà ýêðàí |
ps ïîêàçûâàåò ñïèñîê ïðîöåññîâ è èõ PID, |
åñëè çàäàòü <èìÿ>, ïîêàæåò %CPU, èñïîëüçóåìóþ ïàìÿòü è çàïîìíèò |
âíóòðåííþþ ïåðåìåííóþ LASTPID (ïîëåçíî äëÿ êîìàíäû waitfor) |
<èìÿ> - ýòî ïåðâûå 10 áóêâ èìåíè èñïîëíÿåìîãî ôàéëà áåç ðàñøèðåíèÿ |
<èìÿ> - ýòî ïåðâûå 11 áóêâ èìåíè èñïîëíÿåìîãî ôàéëà áåç ðàñøèðåíèÿ |
pwd ïîêàçûâàåò èìÿ òåêóùåãî êàòàëîãà |
reboot ïåðåçàãðóæàåò êîìïüþòåð èëè ÿäðî KolibriOS. reboot kernel ïåðåçàïóñòèòü ÿäðî Kolibri |
rm óäàëÿåò <ôàéë> |
/programs/system/shell/History.txt |
---|
1,3 → 1,10 |
Shell 0.7.7 // 06.02.2017 // Leency |
* help ⥯¥àì ¢ë¢®¤¨â ᯨ᮪ ª®¬¬ ¤ ¢ âਠª®«®ª¨ |
* ps ⥯¥àì ¢ë¢®¤¨â à §¬¥à , ¨á¯®«ì§ã¥¬ë© ¯à®æ¥áᮬ |
* ls ⥯¥àì ¢ë¢®¤¨â ¢á¥ ä ©«ë ¥ ¢ ®¤ã, ¢ ¥áª®«ìª® ª®«®®ª |
à §¬¥à ª®«®®ª à áç¨âë¢ ¥âáï ¨áå®¤ï ¨§ á ¬®£® ¤«¨®£® ¨¬¥¨ ä ©« ¢ ¯ ¯ª¥ |
áâ àë© ¢ë¢®¤ ᯨ᪮¬ ¯® ¯à¥¦¥¬ã ¤®áâ㯥 ç¥à¥§ ª«îç '-1' |
Shell 0.7.6 // 06.02.2017 // Siemargl |
* ©«®¢ë¥ ®¯¥à 樨 ¨á¯®«ì§ãîâ 64-bit à §¬¥àë ä ©«®¢. |
cp <file> <dest> ⥯¥àì ¯®¨¬ ¥â, ¥á«¨ <dest> - ª â «®£ |
/programs/system/shell/cmd/cmd_help.c |
---|
12,9 → 12,14 |
if ( !strlen(cmd) ) |
{ |
int columns_max=3; |
printf (available, NUM_OF_CMD); |
for (i = 0; i < NUM_OF_CMD; i++) |
printf(" %s\n\r", COMMANDS[i].name); |
{ |
printf(" %-12s", COMMANDS[i].name); |
if ((i) && ((i+1)%columns_max == 0)) printf("\n\r"); |
} |
if ((i)%columns_max != 0) printf("\n\r"); |
return TRUE; |
} |
else |
/programs/system/shell/cmd/cmd_ls.c |
---|
4,12 → 4,14 |
kol_struct70 k70; |
unsigned *n; |
unsigned num_of_file; |
unsigned num_of_file; // number of files in directory |
unsigned *t; |
unsigned type_of_file; |
unsigned type_of_file; // check is this a file or a folder |
int i, result; |
bool single_column_mode = FALSE; |
k70.p00 = 1; |
k70.p04 = 0; |
//k70.p08 = 0; |
17,8 → 19,13 |
k70.p16 = (unsigned) malloc(32+k70.p12*560); |
k70.p20 = 0; |
/// !!! |
// ᫨ ls § ¯ã᪠¥âáï ¡¥§ ¯ à ¬¥â஢, ¯à®á¬ âਢ ¥¬ ⥪ã騩 ª â «®£ |
if (!strnicmp(dir,"-1",1)) |
{ |
single_column_mode = TRUE; |
dir += 3; |
} |
if ( !strlen(dir) ) |
k70.p21 = cur_dir; |
else |
25,7 → 32,7 |
k70.p21 = dir; |
result = kol_file_70(&k70); |
if ( !((result==0) || (result==6)) ) // ¯à®¢¥à塞 áãé¥á⢮¢ ¨¥ ª â «®£ |
if ( !((result==0) || (result==6)) ) // check does the directory exists |
{ |
free( (void*) k70.p16); |
return FALSE; |
32,7 → 39,7 |
} |
n = (unsigned*) (k70.p16+8); |
num_of_file = *n; // ç¨á«® ä ©«®¢ ¢ ª â «®£¥ |
num_of_file = *n; |
// now read full directory |
k70.p12 = num_of_file; |
48,6 → 55,11 |
return FALSE; |
} |
// if there was '-1' param, then show single column mode |
// otherwise show files in several columns |
if (single_column_mode == TRUE) |
{ |
_SINGLE_COLUMN_MODE: |
for (i = 0; i < num_of_file; i++) |
{ |
printf (" %s", k70.p16+32+40+(264+40)*i); |
57,7 → 69,40 |
printf ("/"); |
printf ("\n\r"); |
} |
} |
else |
{ |
int longest_name_len = 0; |
int console_window_width = 78; //need to get this value from console.obj if it's possible |
for (i = 0; i < num_of_file; i++) |
{ |
int current_name_len; |
current_name_len = strlen( (char*)k70.p16+32+40+(264+40)*i); |
if (current_name_len > longest_name_len) longest_name_len = current_name_len; |
} |
longest_name_len+=2; //consider space separator and '/' symbol for folders |
int columns_max = console_window_width / longest_name_len; |
if (longest_name_len >= console_window_width) goto _SINGLE_COLUMN_MODE; //there was too long filename |
for (i = 0; i < num_of_file; i++) |
{ |
char cur_file[2048]; |
strncpy(cur_file, (char*)k70.p16+32+40+(304)*i, sizeof(cur_file)-2); |
t = (unsigned*) (k70.p16+32+(304)*i); |
type_of_file = *t; |
if ( (0x10 == (type_of_file&0x10)) || (8 == (type_of_file&8)) ) strcat(cur_file, "/"); |
printf ("%*s", -longest_name_len, cur_file); |
if ((i>0) && ((i+1)%columns_max == 0)) printf ("\n\r"); |
} |
if ((i)%columns_max != 0) printf("\n\r"); |
} |
free((void*)k70.p16); |
return TRUE; |
} |
/programs/system/shell/cmd/cmd_ps.c |
---|
13,6 → 13,8 |
sel = param && strlen(param) > 0; |
printf (" PID NAME RAM KB\n\r", PID, buf1k+10); |
for (i = 1;;i++) |
{ |
n = kol_process_info(i, buf1k); |
22,7 → 24,7 |
{ |
if (!sel || 0 == strnicmp(param, buf1k+10, 10)) |
{ |
printf (" %7d %s\n\r", PID, buf1k+10); |
printf (" %7d %11s %d\n\r", PID, buf1k+10, (*(int*)(buf1k+26)+1)/1024); |
if (sel) |
{ |
LAST_PID = PID; |
/programs/system/shell/globals.h |
---|
1,5 → 1,5 |
#define SHELL_VERSION "0.7.6" |
#define SHELL_VERSION "0.7.7" |
extern char PATH[256]; |
extern char PARAM[256]; |
/programs/system/shell/locale/eng/globals.h |
---|
13,7 → 13,7 |
{"help", " Gives help on commands. Usage:\n\r help ;it lists all builtins\n\r help <command> ;help on command\n\r", &cmd_help}, |
{"history", " Lists used commands\n\r", &cmd_history}, |
{"kill", " Stops a running process. Usage:\n\r kill <PID of process>\n\r kill all\n\r", &cmd_kill}, |
{"ls", " Lists the files in a directory. Usage:\n\r ls ;lists the files in current directory\n\r ls <directory> ;lists the files at specified folder\n\r", &cmd_ls}, |
{"ls", " Lists the files in a directory. Usage:\n\r ls ;lists the files in current directory\n\r ls <directory> ;lists the files at specified folder\n\r ls -1 ;lists the files in a single column\n\r", &cmd_ls}, |
{"mkdir", " Makes directory. Usage:\n\r mkdir <folder name> ;creates the folder in working directory\n\r mkdir <path><folder name> ;create folder by specified path\n\r", &cmd_mkdir}, |
{"more", " Displays a file data to the screen. Usage:\n\r more <file name>\n\r", &cmd_more}, |
{"ps", " Lists the current processes running\n\r or shows more info on <procname> and save LASTPID\n\r", &cmd_ps}, |
/programs/system/shell/system/boolean.h |
---|
1,3 → 1,5 |
#define bool int |
#define FALSE 0 |
#define TRUE 1 |