2cfd028b83
git-svn-id: svn://kolibrios.org@772 a494cfbc-eb01-0410-851d-a64ba20cac60
382 lines
15 KiB
Plaintext
382 lines
15 KiB
Plaintext
CMD - Èíòåðïðåòàòîð êîìàíäíîé ñòðîêè äëÿ Menuet
|
||
Íàïèñàíî by Chemist dmitry_gt@tut.by
|
||
|
||
Âåðñèÿ 0.27
|
||
|
||
Ðóññêèé òåêñò íåìíîãî ïîíèæå.
|
||
|
||
-----------------------------------------------------------------------
|
||
|
||
CMD - Command Line Interpreter for Menuet
|
||
Copyleft Chemist - dmitry_gt@tut.by
|
||
|
||
Version 0.27
|
||
|
||
As my english is not well, I will tell a few words about this
|
||
program. It supports 14 commands, such as cp (copy file),
|
||
rn (rename file), ps (process list), kill (kill process) etc.
|
||
You can type 'help' after starting this shell to examine with
|
||
other commands. Also it uses several special symbols, such as
|
||
&, /, . and +. Use & sumbol to enter params. For example,
|
||
type tinypad&cmd.asm to open cmd.asm file in tinypad editor.
|
||
/ symbol is used to run special command scripts for CMD.
|
||
It's syntax is: /filename without extension (For example,
|
||
type /autoexec to execute autoexec.cmd file for CMD). And +
|
||
symbol is used in cp and rn commands. You must type
|
||
cp example.asm+example.bak to copy example.asm file to
|
||
example.bak. Use dot to launch program, if CMD command and
|
||
other external command match. For example, type help for
|
||
'help' command or type .help to run 'help' program.
|
||
|
||
This shell supports executeing special command
|
||
scripts (something like .BAT files in MS-DOS). This files
|
||
have an .CMD extinsion and u must use / symbol to execute it.
|
||
U can use any CMD commands and filenames in this scripts.
|
||
But you can't run other scripts from any CMD script (/ symbol).
|
||
I recommed to use tipypad editor to edit this scripts and do
|
||
not leave spaces and other symbols after commands in the script
|
||
file, because it's executeing is not very developed yet.
|
||
And it's strongly recommended to use ends command in the end
|
||
of the script, because there are some problems with redrawing
|
||
the window after executing scripts without this command.
|
||
Every time when you launch CMD autoexec.cmd file automatically
|
||
executes. You can edit or delete this file if you want.
|
||
|
||
This version of CMD shell supports IPC. It mean, than you can
|
||
write your own programs for this shell. Look at .ASM files in
|
||
the Examples directory in this archive. I think that you will
|
||
understand them without any difficulties. Do not forget, that
|
||
you need CMDIPC.ASM file to compile this sources. It's
|
||
recommended to compile it with MACROS.INC file (included in
|
||
this archieve) to make their size smaller.
|
||
|
||
And now about some bugs etc.
|
||
|
||
----------------------------
|
||
|
||
I've noticed, that there are some difficulties with files with
|
||
1 or 2 symbols in extension. I recommend do not use such files
|
||
not only in CMD, but almost in every programs in MeOS. It's
|
||
possible to create such file in tinypad, and then (in MS-DOS or
|
||
Windows) Scandisk will find errors in filenames etc. CMD do
|
||
not support properly such filenames now.
|
||
|
||
In CMDIPC.INC and CMD.ASM I used 5-th function (pause), because
|
||
I need it when CMD communicates with IPC programs. It's
|
||
even possible, that it will not enough 1/100 sec. on slow PC's,
|
||
because CMD need this time to finish IPC-command from other
|
||
IPC-program. U can change ebx value in CMDIPC.ASM in pause1:
|
||
if you want. But it slows communication betwen CMD and
|
||
IPC-programs for CMD. I hope, that you understand my words. :)
|
||
|
||
Now (in this version) you can launch only one CMD shell.
|
||
Because it's difficult to make communication betwen several
|
||
copyes of CMD in memory and IPC-programs. I will solve this
|
||
problem in future.
|
||
|
||
I've tested this shell only on Ivan Poddubny's russian
|
||
distributive. Also I recommend you to use it. :) CMD shell
|
||
is included into this distributive (but possible not it's
|
||
final version).
|
||
|
||
Source code of this program is not optimized yet. I have such
|
||
manner of programming from my childhood that my source code
|
||
is not very "compact"
|
||
|
||
etc. ;-)
|
||
|
||
And now other information:
|
||
--------------------------
|
||
|
||
I do not want CMD design to change. I like white symbols on
|
||
the black background. If you want to change the source and
|
||
redistribute it, please, do not change it's design. :)
|
||
|
||
If you will find some bugs or you have some wishes (or even you
|
||
correct some mistakes in my english texts) -
|
||
email me: dmitry_gt@tut.by
|
||
|
||
And this program is distributed "as is". Use it on your own
|
||
risk. ;-)
|
||
|
||
And again - my English is not well. :)
|
||
|
||
That's all!
|
||
|
||
19.06.2004,
|
||
Chemist
|
||
|
||
Now russian text :)
|
||
|
||
-----------------------------------------------------------------------
|
||
|
||
Äîñòóïíûå êîìàíäû:
|
||
|
||
ls [filename] - âûâîä ñïèñêà ôàéëîâ. Åñëè ïîñëå êîìàíäû
|
||
óêàçàòü èìÿ ôàéëà, òî êîìàíäà ïðîâåðèò åãî
|
||
íà íàëè÷èå.
|
||
|
||
cp [source_file+destination_file] - êîìàíäà äëÿ
|
||
êîïèðîâàíèÿ ôàéëîâ. Ïðîâåðÿåò ôàéëû íà
|
||
íàëè÷èå, è â ñëó÷àå îøèáêè âûâîäèò
|
||
ñîîòâåòñòâóþùèå ñîîáùåíèÿ.
|
||
|
||
rn [source_file+destination_file] - êîìàíäà äëÿ
|
||
ïåðåèìåíîâàíèÿ ôàéëîâ. Òàê æå
|
||
ïðîâåðÿåò ôàéëû íà íàëè÷èå, è â
|
||
ñëó÷àå îøèáêè âûâîäèò ñîîòâåòñòâóþùèå
|
||
ñîîáùåíèÿ.
|
||
|
||
ps - âûâîä èíôîðìàöèè î ïðîöåññàõ â ñèñòåìå.
|
||
|
||
kill - ïðåðâàòü ïðîöåññ â ñèñòåìå. Âíèìàíèå,
|
||
ïîñëå êîìàíäû ñëåäóåò ââîäèòü 4-õ
|
||
çíà÷íûé íîìåð ïðîöåññà, à íå PID. Íîìåð
|
||
ïðîöåññà óêàçàí â ïîñëåäíåé êîëîíêå ïðè
|
||
âûçîâå êîìàíäû ps.
|
||
|
||
help - âûâîä êðàòêîé ñïðàâî÷íîé èíôîðìàöèè.
|
||
|
||
ver - âûâîä èñïîëüçóåìîé âåðñèè èíòåðïðåòàòîðà.
|
||
|
||
cls - î÷èñòêà ýêðàíà.
|
||
|
||
exit - âûõîä èç èíòåðïðåòàòîðà.
|
||
|
||
del [filename] - óäàëèòü ôàéë ñ ðàìäèñêà. Ïðè îòñóòñòâèè
|
||
çàïðàøèâàåìîãî ôàéëà áóäåò âûâåäåíî
|
||
ñîîòâåòñòâóþùèå ñîîáùåíèå îá îøèáêå.
|
||
|
||
shutdown - çàâåðøèòü ðàáîòó ñèñòåìû.
|
||
|
||
pause - îæèäàòü íàæàòèå êëàâèøè. Èñïîëüçóåòñÿ äëÿ
|
||
"âçàèìîäåéñòâèÿ" ïîëüçîâàòåëÿ ñ êîìàíäíûìè
|
||
ñêðèïòàìè äëÿ êîíñîëè (èíòåðïðåòàòîðà).
|
||
Íàïðèìåð, ìîæíî èñïîëüçîâàòü äàííûé ñêðèïò
|
||
|
||
echo Do you want to delete cmd.asm?
|
||
pause
|
||
del cmd.asm
|
||
|
||
äëÿ òîãî, ÷òîáû ïîèíòåðåñîâàòüñÿ ìíåíèåì
|
||
ïîëüçîâàòåëÿ, õî÷åò ëè îí óäàëèòü ôàéë cmd.asm
|
||
èëè ïðåðâàòü ðàáîòó ñêðèïòà.
|
||
|
||
pause >nul Òî æå ñàìîå, òîëüêî áåç âûâîäà ñòðîêè
|
||
'Press ane key to continue (ESC - cancel)'
|
||
|
||
echo [text] - âûâîä òåêñòà íà ýêðàí. Ïðåäíàçíà÷åíà äëÿ
|
||
ïîäà÷è ïîëüçîâàòåëþ èíôîðìàöèè èç êîìàíäíîãî
|
||
ñêðèïòà. Åñëè ââåñòè êîìàíäó echo áåç òåêñòà,
|
||
òî ýòî ïðîñòî âûçîâåò ïåðåõîä íà ñëåäóþùóþ
|
||
ñòðîêó.
|
||
|
||
ends - êîìàíäà, äîñòóïíàÿ òîëüêî èç èñïîëíÿåìûõ
|
||
ñêðèïòîâ. Ñëóæèò äëÿ èõ êîððåêòíîãî çàâåðøåíèÿ,
|
||
ò.ê. èíîãäà êîìàíäíûå ñêðèïòû, ó êîòîðûõ â
|
||
êîíöå ñòîÿëè íåíóæíûå ïðîáåëû èëè ñèìâîëû EOL,
|
||
âûçûâàëè ïðîáëåìû ñ ïåðåðèñîâêîé îêíà. Ñêîðåå
|
||
âñåãî ýòà êîìàíäà ïðèñóòñòâóåò â êîíñîëè
|
||
âðåìåííî è áóäåò óáðàíà ïîñëå ðåøåíèÿ ýòîé
|
||
ïðîáëåìû.
|
||
|
||
-----------------------------------------------------------------------
|
||
|
||
Óïðàâëÿþùèå ñèìâîëû:
|
||
|
||
/[êîìàíäíûé ñêðèïò] - ïðåäíàçíà÷åí äëÿ âûçîâà íà èñïîëíåíèå
|
||
êîìàíäíîãî ñêðèïòà èç êîíñîëè. Íå ìîæåò
|
||
èñïîëüçîâàòüñÿ â íåïîñðåäñòâåííî â ñàìèõ
|
||
êîìàíäíûõ ñêðèïòàõ. Åñëè ðàñøèðåíèå èñïîë-
|
||
íÿåìîãî ñêðèïòà .cmd, òî åãî óêàçûâàòü
|
||
íåîáÿçàòåëüíî.
|
||
|
||
& - äàííûé ñèìâîë èñïîëüçóåòñÿ äëÿ ïåðåäà÷è âûçûâàåìîé
|
||
ïðîãðàììå ïàðàìåòðîâ. Íàïðèìåð, êîìàíäà tinypad&cmd.asm
|
||
ïåðåäàñò ïðîãðàììå tinypad ïàðàìåòð cmd.asm,
|
||
ñîîòâåòñòâåííî, tinypad îòêðîåò ôàéë cmd.asm.
|
||
|
||
+ - ðàçäåëÿåò èìåíà èñõîäíîãî è ðåçóëüòèðóþùåãî ôàéëîâ â
|
||
êîìàíäàõ cp è rn.
|
||
|
||
. - çàïóñêàåò óêàçàííóþ ïîñëå òî÷êè ïðîãðàììó, äàæå åñëè îíà
|
||
ñîâïàäàåò ñ êîìàíäîé CMD. Íàïðèìåð, help - âûïîëíèòü
|
||
êîìàíäó 'help', íî .help - çàïóñòèòü âíåøíþþ ïðîãðàììó
|
||
'help' (õîòÿ òàêîé ïîêà âðîäå è íåòó :).
|
||
|
||
-----------------------------------------------------------------------
|
||
|
||
Íàâèãàöèÿ ïî êîíñîëè:
|
||
|
||
Äëÿ ðåäàêòèðîâàíèÿ êîìàíäíîé ñòðîêè èñïîëüçóþòñÿ êëàâèøè ESC,
|
||
BACKSPACE. ESC - äëÿ óäàëåíèÿ âñåé êîìàíäíîé ñòðîêè,
|
||
BACKSPACE - äëÿ óäàëåíèÿ ïîñëåäíåãî ââåäåííîãî ñèìâîëà. Ïî
|
||
ìîåìó ìíåíèþ, èñïîëüçîâàíèå òàêèõ êëàâèø, êàê HOME, END, ARROW
|
||
KEY etc. íå èìååò ñìûñëà, ò.ê. ââîäèìûå êîìàíäû ñëèøêîì
|
||
ïðîñòû è íå òðåáóþò ïîäðîáíîãî ðåäàêòèðîâàíèÿ. Ïîýòîìó ÿ
|
||
îñòàâèë âñå ïðèìåðíî òàê, êàê áûëî â MS-DOS 6.22.
|
||
|
||
Êëàâèøà UPARROW èñïîëüçóåòñÿ äëÿ ïîâòîðà ïîñëåäíåé ââåäåííîé
|
||
êîìàíäû.
|
||
|
||
-----------------------------------------------------------------------
|
||
|
||
Èñïîëüçîâàíèå IPC âî âíåøíèõ ïðîãðàììàõ:
|
||
|
||
Âû ìîæåòå ïèñàòü ïðîãðàììû, âçàèìîäåéñòâóþùèå ñ CMD ÷åðåç IPC.
|
||
 îñíîâíîì, ÿ ïîëàãàþ, ýòî ìîæåò ïðèãîäèòñÿ äëÿ íàïèñàíèÿ
|
||
êîíñîëüíûõ ïðèëîæåíèé äëÿ ñàìîãî CMD (õîòÿ âîçìîæíî è äðóãîå).
|
||
|
||
Äëÿ ýòîãî, ê âàøåé ïðîãðàììå âàì íåîáõîj |