Features-only commit:
- Fix version presentation at startup and when using the "ver" command (in French)
- Add to the prompt's command help, the fact that the $S specifier can be used to add a space.
- Implement the $I prompt specifier (see http://www.robvanderwoude.com/prompt.php), which sets
  an information line on top of the screen (à la OS/2).
  Use this new setting by default (I'm doing a poll on who loves it / hates it, and how we can improve it).
  To disable it, use the command: "prompt $p$g" (the default windows' prompt).
  To enable it, add the $s specifier to the prompt string (e.g. "prompt $i$p$g").
  For your information, OS/2 uses "prompt $i[$p]" :)

svn path=/trunk/; revision=59422
This commit is contained in:
Hermès Bélusca-Maïto 2013-07-04 01:05:14 +00:00
parent 0671cb8e23
commit 84e1ebcd07
21 changed files with 114 additions and 33 deletions

View file

@ -1615,7 +1615,6 @@ Initialize()
HMODULE NtDllModule;
TCHAR commandline[CMDLINE_LENGTH];
TCHAR ModuleName[_MAX_PATH + 1];
TCHAR lpBuffer[2];
INT nExitCode;
//INT len;
@ -1643,16 +1642,12 @@ Initialize()
hOut = GetStdHandle(STD_OUTPUT_HANDLE);
hIn = GetStdHandle(STD_INPUT_HANDLE);
/* Set EnvironmentVariable PROMPT if it does not exists any env value.
for you can change the EnvirommentVariable for prompt before cmd start
this patch are not 100% right, if it does not exists a PROMPT value cmd should use
$P$G as defualt not set EnvirommentVariable PROMPT to $P$G if it does not exists */
if (GetEnvironmentVariable(_T("PROMPT"),lpBuffer, sizeof(lpBuffer) / sizeof(lpBuffer[0])) == 0)
SetEnvironmentVariable(_T("PROMPT"), _T("$P$G"));
/* Initialize prompt support */
InitPrompt();
#ifdef FEATURE_DIR_STACK
/* initialize directory stack */
InitDirectoryStack ();
InitDirectoryStack();
#endif
#ifdef FEATURE_HISTORY
@ -1750,6 +1745,7 @@ Initialize()
if (!*ptr)
{
/* If neither /C or /K was given, display a simple version string */
ConOutChar(_T('\n'));
ConOutResPrintf(STRING_REACTOS_VERSION,
_T(KERNEL_RELEASE_STR),
_T(KERNEL_VERSION_BUILD_STR));

View file

@ -405,6 +405,7 @@ INT cmd_path (LPTSTR);
/* Prototypes from PROMPT.C */
VOID InitPrompt (VOID);
VOID PrintPrompt (VOID);
INT cmd_prompt (LPTSTR);

View file

@ -361,10 +361,12 @@ Sie kann aus normalen Zeichen und folgenden Sonderzeichen bestehen:\n\n\
$F ) (Klammer zu)\n\
$G > (Größer-als-Zeichen)\n\
$H Rückschritt (löscht vorangehendes Zeichen)\n\
$I Information line\n\
$L < (Kleiner-als-Zeichen)\n\
$N Aktuelles Laufwerk\n\
$P Aktuelles Laufwerk und Pfad\n\
$Q = (Gleichheitszeichen)\n\
$S (space)\n\
$T Aktuelle Zeit\n\
$V Betriebssystem-Versionsnummer\n\
$_ Wagenrücklauf und Zeilenvorschub\n\

View file

@ -364,10 +364,12 @@ Prompt can be made up of normal characters and the following special codes:\n\n\
$F ) (Right parenthesis)\n\
$G > (greater-than sign)\n\
$H Backspace (erases previous character)\n\
$I Information line\n\
$L < (less-than sign)\n\
$N Current drive\n\
$P Current drive and path\n\
$Q = (equal sign)\n\
$S (space)\n\
$T Current time\n\
$V OS version number\n\
$_ Carriage return and linefeed\n\

View file

@ -364,10 +364,12 @@ Prompt can be made up of normal characters and the following special codes:\n\n\
$F ) (Right parenthesis)\n\
$G > (greater-than sign)\n\
$H Backspace (erases previous character)\n\
$I Information line\n\
$L < (less-than sign)\n\
$N Current drive\n\
$P Current drive and path\n\
$Q = (equal sign)\n\
$S (space)\n\
$T Current time\n\
$V OS version number\n\
$_ Carriage return and linefeed\n\

View file

@ -364,10 +364,12 @@ códigos especiales:\n\n\
$F ) (Paréntesis derecho)\n\
$G > (Signo mayor que)\n\
$H Borra el caracter anterior\n\
$I Information line\n\
$L < (Signo menor que)\n\
$N Unidad actual\n\
$P Unidad y ruta actuales\n\
$Q = (signo igual)\n\
$S (space)\n\
$T Hora actual\n\
$V Número de versión del SO\n\
$_ Salto de linea\n\

View file

@ -378,10 +378,12 @@ des caractères spéciaux suivants:\n\n\
$F ) (parenthèse fermante)\n\
$G > (signe supérieur à)\n\
$H Backspace (efface le caractère précédent)\n\
$I Ligne d'information\n\
$L < (signe inférieur à)\n\
$N Lecteur courant\n\
$P Lecteur et chemin courants\n\
$Q = (signe égale)\n\
$S (espace)\n\
$T Heure courante\n\
$V Numéro de version de ReactOS\n\
$_ Retour chariot/saut de ligne\n\
@ -718,7 +720,7 @@ STRING_REPLACE_ERROR6, "Aucun fichier trouvé - %s\n"
STRING_REPLACE_ERROR7, "Erreur étendue 32\n"
STRING_REACTOS_VERSION, "ReactOS Operating System [Version %s-%s]\n"
STRING_CMD_SHELLINFO, "\n Interpréteur de ligne de commandes ReactOS\nVersion %s %s"
STRING_CMD_SHELLINFO, "\nInterpréteur de ligne de commandes ReactOS\nVersion %s %s"
STRING_VERSION_RUNVER, " tournant sur %s"
STRING_COPY_FILE, " %d fichier(s) copié(s)\n"
STRING_DELETE_WIPE, "effacé(s)"

View file

@ -350,10 +350,12 @@ A parancssor speciális kódokat is tartalmazhat:\n\n\
$F ) (záró zárójel)\n\
$G > ('nagyobb' jel)\n\
$H Törlés (elötte lévõ karaktert törli)\n\
$I Information line\n\
$L < ('kissebb' jel)\n\
$N Aktuális meghajtó\n\
$P Aktuális meghajtó és mappa\n\
$Q = (egyenlõség jel)\n\
$S (space)\n\
$T Aktuális idõ\n\
$V OS verziószám\n\
$_ Újsor\n\

View file

@ -364,10 +364,12 @@ Prompt bisa dibuat dari karakter normal dan kode spesial berikut:\n\n\
$F ) (Tanda kurung Kanan)\n\
$G > (Tanda lebih-dari)\n\
$H Backspace (menghapus karakter sebelumnya)\n\
$I Information line\n\
$L < (tanda kurang-dari)\n\
$N Drive saat ini\n\
$P Drive dan path saat ini\n\
$Q = (tanda sama dengan)\n\
$S (space)\n\
$T Jam saat ini\n\
$V Nomor versi OS\n\
$_ Carriage return dan linefeed\n\

View file

@ -368,10 +368,12 @@ Può essere composto da un testo qualunque e dai seguenti codici speciali:\n\n\
$F ) (parentesi destra)\n\
$G > (simbolo di maggiore di)\n\
$H Backspace (cancella il carattere precedente)\n\
$I Information line\n\
$L < (simbolo di minore di)\n\
$N Disco corrente\n\
$P Disco e percorso corrente\n\
$Q = (simbolo di uguale)\n\
$S (space)\n\
$T Ora attuale\n\
$V Versione del sistema operativo\n\
$_ CR LF (a capo)\n\

View file

@ -373,10 +373,12 @@ PROMPT には通常の文字と次に示す特殊コードを使用できます:
$F ) (右かっこ)\n\
$G > (不等号 (大なり))\n\
$H バックスペース (直前の文字を削除します)\n\
$I Information line\n\
$L < (不等号 (小なり))\n\
$N 現在のドライブ\n\
$P 現在のドライブとパス\n\
$Q = (等号)\n\
$S (space)\n\
$T 現在の時刻\n\
$V OS のバージョン番号\n\
$_ キャリッジ リターンとラインフィード\n\

View file

@ -359,10 +359,12 @@ Ledeteksten kan bli satt sammen av normale tegn og følgende spesielle koder:\n\
$F ) (Høyreparentes)\n\
$G > (større-enn symbol)\n\
$H Tilbake (sletter forrige tegn)\n\
$I Information line\n\
$L < (mindre-enn symbol)\n\
$N Gjeldende stasjon\n\
$P Gjeldende stasjon og mappe\n\
$Q = (likhetstegn)\n\
$S (space)\n\
$T Gjeldende klokkeslett\n\
$V Versjonsnummer for ReactOS\n\
$_ Retur og linjeskift\n\

View file

@ -366,10 +366,12 @@ Znak zachęty może składać się z normalnych znaków, a także poniższych sy
$F ) (prawy nawias)\n\
$G > (znak większości)\n\
$H (usuwa ostatni znak)\n\
$I Information line\n\
$L < (znak mniejszości)\n\
$N Bieżący napęd\n\
$P Bieżący napęd i ścieżka\n\
$Q = (znak równości)\n\
$S (space)\n\
$T Bieżący czas\n\
$V Wersja systemu\n\
$_ Znak CR/LF\n\

View file

@ -401,10 +401,12 @@ PROMPT [text]\n\n\
$F ) (paranteză dreapta)\n\
$G > (semnul mai mare decât)\n\
$H Backspace (ștergerea caracterului precedent)\n\
$I Information line\n\
$L < (semnul mai mic decât)\n\
$N Unitatea de stocare curentă\n\
$P Unitatea de stocare și calea curentă\n\
$Q = (semnul egal)\n\
$S (space)\n\
$T Ora curentă\n\
$V Numărul versiunii SO\n\
$_ Sfârșit de linie și rând nou\n\

View file

@ -369,10 +369,12 @@ PROMPT [текст]\n\n\
$F ) (правая круглая скобка)\n\
$G > (знак ""больше"")\n\
$H BACKSPACE (удаление предыдущего символа)\n\
$I Information line\n\
$L < (знак ""меньше"")\n\
$N Текущий диск\n\
$P Текущие диск и каталог\n\
$Q = (знак равенства)\n\
$S (space)\n\
$T Текущее время\n\
$V Номер версии операционной системы\n\
$_ Перевод строки\n\

View file

@ -368,10 +368,12 @@ Prompt can be made up of normal characters and the following special codes:\n\n\
$F ) (Pravá okrúhla zátvorka)\n\
$G > (greater-than sign)\n\
$H Backspace (erases previous character)\n\
$I Information line\n\
$L < (less-than sign)\n\
$N Current drive\n\
$P Current drive and path\n\
$Q = (equal sign)\n\
$S (space)\n\
$T Aktuálny čas\n\
$V Číslo verzie OS\n\
$_ Carriage return and linefeed\n\

View file

@ -359,10 +359,12 @@ Ledeteksten kan bli satt sammen av normale tegn och følgende spesielle koder:\n
$F ) (Høyreparentes)\n\
$G > (større-enn symbol)\n\
$H Tilbake (sletter forrige tegn)\n\
$I Information line\n\
$L < (mindre-enn symbol)\n\
$N aktuell enhet\n\
$P aktuell enhet och mapp\n\
$Q = (likhetstegn)\n\
$S (space)\n\
$T aktuell klokkeslett\n\
$V Versjonsnummer for ReactOS\n\
$_ Retur och linjeskift\n\

View file

@ -371,10 +371,12 @@ PROMPT [текст]\n\n\
$F ) (Права кругла дужка)\n\
$G > (знак більше)\n\
$H Backspace (видалення попередьного символу)\n\
$I Information line\n\
$L < (знак меньше)\n\
$N Поточний диск\n\
$P Поточний диск та каталог\n\
$Q = (знак рiвностi)\n\
$S (space)\n\
$T Поточний час\n\
$V Номер версоперацiйної системи\n\
$_ Повернення каретки та переведення рядка\n\

View file

@ -346,10 +346,12 @@ PROMPT [文本]\n\n\
$F ) (右括号)\n\
$G > (大于号)\n\
$H 退格 (擦除前一个字符)\n\
$I Information line\n\
$L < (小于号)\n\
$N 当前驱动器\n\
$P 当前驱动器和路径\n\
$Q = (等于号)\n\
$S (space)\n\
$T 当前时间\n\
$V 操作系统版本号\n\
$_ 回车和换行符\n\

View file

@ -48,19 +48,72 @@
*/
#include "precomp.h"
// FIXME: Localize the information line.
static TCHAR InfoLine[] = _T(" ReactOS Command Prompt Type HELP = Help ");
/* The default prompt */
static TCHAR DefaultPrompt[] = _T("$I$P$G");
/*
* print the command-line prompt
* Initialize prompt support
*/
VOID InitPrompt(VOID)
{
TCHAR Buffer[2];
/*
* Set the PROMPT environment variable if it doesn't exist already.
* You can change the PROMPT environment variable before cmd start.
*/
if (GetEnvironmentVariable(_T("PROMPT"), Buffer, sizeof(Buffer) / sizeof(Buffer[0])) == 0)
SetEnvironmentVariable(_T("PROMPT"), DefaultPrompt);
}
/*
* Print an information line on top of the screen
*/
VOID PrintInfoLine(VOID)
{
#define FOREGROUND_WHITE (FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_INTENSITY)
HANDLE hOutput = GetStdHandle(STD_OUTPUT_HANDLE);
CONSOLE_SCREEN_BUFFER_INFO csbi;
COORD coPos;
DWORD dwWritten;
if (!GetConsoleScreenBufferInfo(hOutput, &csbi))
{
/* No console */
return;
}
coPos.X = 0;
coPos.Y = 0;
FillConsoleOutputAttribute(hOutput, BACKGROUND_BLUE | FOREGROUND_WHITE,
csbi.dwSize.X,
coPos, &dwWritten);
FillConsoleOutputCharacter(hOutput, _T(' '),
csbi.dwSize.X,
coPos, &dwWritten);
WriteConsoleOutputCharacter(hOutput, InfoLine,
sizeof(InfoLine)/sizeof(TCHAR) - 1,
coPos, &dwWritten);
}
/*
* Print the command-line prompt
*/
VOID PrintPrompt(VOID)
{
static TCHAR default_pr[] = _T("$P$G");
TCHAR szPrompt[256];
LPTSTR pr;
if (GetEnvironmentVariable(_T("PROMPT"), szPrompt, 256))
pr = szPrompt;
else
pr = default_pr;
pr = DefaultPrompt;
while (*pr)
{
@ -108,6 +161,10 @@ VOID PrintPrompt(VOID)
ConOutChar(_T('\x08'));
break;
case _T('I'):
PrintInfoLine();
break;
case _T('L'):
ConOutChar(_T('<'));
break;
@ -185,40 +242,33 @@ VOID PrintPrompt(VOID)
#ifdef INCLUDE_CMD_PROMPT
INT cmd_prompt (LPTSTR param)
INT cmd_prompt(LPTSTR param)
{
if (!_tcsncmp (param, _T("/?"), 2))
if (!_tcsncmp(param, _T("/?"), 2))
{
ConOutResPaging(TRUE,STRING_PROMPT_HELP1);
ConOutResPaging(TRUE, STRING_PROMPT_HELP1);
#ifdef FEATURE_DIRECTORY_STACK
ConOutResPaging(FALSE,STRING_PROMPT_HELP2);
ConOutResPaging(FALSE, STRING_PROMPT_HELP2);
#endif
ConOutResPaging(FALSE,STRING_PROMPT_HELP3);
ConOutResPaging(FALSE, STRING_PROMPT_HELP3);
return 0;
}
/*
* if it is null, then it needs to set to default,
* If 'param' is NULL, then we need to set it to default,
* because that means the user entered "prompt" only.
* so even if param is null you _must_ still set prompt
* to the default. There seems to be some kinda difference
* So even if 'param' is null you _must_ still set prompt
* to the default. There seems to be some kind of difference
* between winxp and 2k in this matter and this way will
* cover both. Do not use fixed size of szParam for param the buffer
* are 8192 bytes and will later change to dymatic buffer.
* are 8192 bytes and will later change to dynamic buffer.
*/
/* set PROMPT environment variable */
if (param[0] != _T('\0'))
/* Set the PROMPT environment variable */
if (!SetEnvironmentVariable(_T("PROMPT"),
(param[0] != _T('\0') ? param : DefaultPrompt)))
{
if (!SetEnvironmentVariable (_T("PROMPT"), param))
return 1;
}
else
{
TCHAR szParam[5];
_tcscpy(szParam,_T("$P$G"));
if (!SetEnvironmentVariable (_T("PROMPT"),szParam))
return 1;
}

View file

@ -72,8 +72,8 @@ INT cmd_ver (LPTSTR param)
/* Basic copyright notice */
if (param[0] != _T('\0'))
{
ConOutPuts (_T("Copyright (C) 1994-1998 Tim Norman and others."));
ConOutPuts (_T("Copyright (C) 1998-") _T(COPYRIGHT_YEAR) _T(" ReactOS Team"));
ConOutPuts(_T("Copyright (C) 1994-1998 Tim Norman and others.\n"));
ConOutPuts(_T("Copyright (C) 1998-") _T(COPYRIGHT_YEAR) _T(" ReactOS Team\n"));
for (i = 0; param[i]; i++)
{