cmd.exe: Implement a basic 'more'.
This implements a basic more, eg 'dir | more' or 'more file.c' but it does not support the flags or keys which can control it. Basically its not worth implementing those, as in some modes we cannot read a single key, we have to wait for <enter> anyway.
This commit is contained in:
parent
35a8ee9340
commit
ce87522f84
|
@ -199,6 +199,8 @@ P
|
|||
|
||||
WCMD_VOL, "Nápovìda k VOL\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT ukonèí bìžící sezení a vrátí kontrolu\n\
|
||||
operaènímu systému nebo pøíkazovému interpretu,\n\
|
||||
|
@ -217,6 +219,7 @@ DIR\t\tVyp
|
|||
ECHO\t\tVypíše text na terminál\n\
|
||||
HELP\t\tZobrazí detailní nápovìdu k tématu\n\
|
||||
MD (MKDIR)\tVytvoøí adresáø\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tPøesune soubor, skupinu souborù nebo adresáøový strom\n\
|
||||
PATH\t\tNastaví nebo ukáže prohledávané cesty\n\
|
||||
PROMPT\t\tZmìní výzvu pøíkazového øádku\n\
|
||||
|
@ -237,4 +240,5 @@ Zadejte HELP <p
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -215,6 +215,8 @@ Das Verify Flag hat keine Funktion in Wine.\n"
|
|||
|
||||
WCMD_VOL, "Hilfe für VOL\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT beendet die aktuelle Befehlssitzung und kehrt zum\n\
|
||||
Betriebssystem oder der Shell zurück, von der CMD gestart wurde.\n"
|
||||
|
@ -233,6 +235,7 @@ DIR\t\tListet den Inhalt eines Verzeichnisses\n\
|
|||
ECHO\t\tKopiert den Text direkt zur Konsolenausgabe\n\
|
||||
HELP\t\tZeigt detalierte Informationen zu einen Thema\n\
|
||||
MD (MKDIR)\tErzeugt ein Unterverzeichnis\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tBewegt eine oder mehrere Dateien oder einen Verzeichnisbaum\n\
|
||||
PATH\t\tSetzt oder zeigt den Suchpfad an\n\
|
||||
PROMPT\t\tÄndert den Befehlszeilenprompt\n\
|
||||
|
@ -254,4 +257,5 @@ obigen Befehle erhalten.\n"
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -202,6 +202,8 @@ stack, and then changes the current directory to the supplied one.\n"
|
|||
WCMD_POPD, "POPD changes current directory to the last one saved with\n\
|
||||
PUSHD.\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT terminates the current command session and returns\n\
|
||||
to the operating system or shell from which you invoked cmd.\n"
|
||||
|
@ -219,6 +221,7 @@ DIR\t\tList the contents of a directory\n\
|
|||
ECHO\t\tCopy text directly to the console output\n\
|
||||
HELP\t\tShow brief help details on a topic\n\
|
||||
MD (MKDIR)\tCreate a subdirectory\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tMove a file, set of files or directory tree\n\
|
||||
PATH\t\tSet or show the search path\n\
|
||||
POPD\t\tRestores the directory to the last one saved with PUSHD\n\
|
||||
|
@ -241,4 +244,5 @@ Enter HELP <command> for further information on any of the above commands\n"
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -212,6 +212,8 @@ La bandera de verificaci
|
|||
|
||||
WCMD_VOL, "Ayuda sobre VOL\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT termina la sesión de comandos actual y regresa al sistema\n\
|
||||
operativo o intérprete de comandos desde el que invocó cmd.\n"
|
||||
|
@ -229,6 +231,7 @@ DIR\t\tListar el contenido de un directorio\n\
|
|||
ECHO\t\tCopiar texto directamente a la salida de consola\n\
|
||||
HELP\t\tMostrar detalles breves de ayuda sobre un tema\n\
|
||||
MD (MKDIR)\tCrear un subdirectorio\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tMover un archivo, conjunto de archivos o árbol de directorio\n\
|
||||
PATH\t\tAjustar o cambiar la ruta de búsqueda\n\
|
||||
PROMPT\t\tCambiar el prompt de comandos\n\
|
||||
|
@ -249,4 +252,5 @@ Introduzca HELP <comando> para m
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -194,6 +194,8 @@ Le flag de verification n'a pas de fonction dans Wine.\n"
|
|||
|
||||
WCMD_VOL, "\t\tAffiche le nom de volume d'un lecteur de disque\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT termine la session de ligne de commande et retourne\n\
|
||||
au système d'exploitation ou au shell où vous avez invoqué cmd.\n"
|
||||
|
@ -211,6 +213,7 @@ DIR\t\tListe le contenu d'un r
|
|||
ECHO\t\tAffiche du texte sur la console\n\
|
||||
HELP\t\tAffiche de brefs détails sur l'utilisation d'une commande\n\
|
||||
MD (MKDIR)\tCrée un répertoire\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tDéplace un fichier, un groupe de fichiers ou un répertoire\n\
|
||||
PATH\t\tRègle ou affiche le chemin de recherche\n\
|
||||
PROMPT\t\tChange l'invite de commande\n\
|
||||
|
@ -231,4 +234,5 @@ Entrez HELP <commande> pour plus d'informations sur les commandes ci-dessus\n"
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -199,6 +199,8 @@ Wine
|
|||
|
||||
WCMD_VOL, "VOLのヘルプ\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT は現在のコマンドセッションを終了してcmdを呼び出したOSまたはシェルに戻します。\n"
|
||||
|
||||
|
@ -215,6 +217,7 @@ DIR\t\t
|
|||
ECHO\t\t文字列を直接コンソール出力にコピー\n\
|
||||
HELP\t\tトピックの詳細なヘルプを表示\n\
|
||||
MD (MKDIR)\tサブディレクトリを作成\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tファイルまたはディレクトリツリーを移動\n\
|
||||
PATH\t\tパスを表示又は設定\n\
|
||||
PROMPT\t\tコマンドプロンプトを変更\n\
|
||||
|
@ -235,4 +238,5 @@ EXIT\t\tCMD
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -194,6 +194,8 @@ verify
|
|||
|
||||
WCMD_POPD, "POPD는 현재 디렉토리를 PUSH로 마지막으로 저장했던 것으로 바꾼다.\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT는 현재 명령 세션을 중단시키고 운영체제로 돌아가거나 cmd를\n\
|
||||
호출한 셀로 돌아갑니다.\n"
|
||||
|
@ -211,6 +213,7 @@ DIR\t\t
|
|||
ECHO\t\t문자를 바로 화면 출력으로 복사\n\
|
||||
HELP\t\t 목차의 짤막한 도움말 항목 보여줌\n\
|
||||
MD (MKDIR)\t하위 디렉토리 만들기\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\t파일 이나 여러 파일,그리고 디렉토리 구조 이동\n\
|
||||
PATH\t\t탐색 경로 보여주거나 설정하기\n\
|
||||
POPD\t\tPUSHD로 마지막으로 저장했던 디렉토리로 돌아가기\n\
|
||||
|
@ -233,4 +236,5 @@ HELP <
|
|||
WCMD_NOASSOC, "이 파일확장자 %s에 연결된 풀그림이 없습니다. \n"
|
||||
WCMD_NOFTYPE, "이 파일 형식 '%s'과 연결된 어떠한 명령도 없습니다.'\n"
|
||||
WCMD_OVERWRITE, "덮어쓰기"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -197,6 +197,8 @@ De verify-schakelaar heeft geen functie binnen Wine.\n"
|
|||
|
||||
WCMD_VOL, "Uitleg bij VOL\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT beëindigt de lopende sessie en keert terug\n\
|
||||
naar het besturingssysteem of de schil van waaruit cmd werd gestart.\n"
|
||||
|
@ -214,6 +216,7 @@ DIR\t\tToon de inhoud van een directory\n\
|
|||
ECHO\t\tKopiëer tekst direct naar het uitvoerapparaat\n\
|
||||
HELP\t\tToon een korte uitleg over een onderwerp\n\
|
||||
MD (MKDIR)\tMaak een directory\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tVerplaats een bestand, een verzameling bestanden of een directory\n\
|
||||
PATH\t\tWijzig of toon het zoekpad\n\
|
||||
PROMPT\t\tWijzig de prompt\n\
|
||||
|
@ -234,4 +237,5 @@ type HELP <opdracht> voor meer informatie over bovengenoemde opdrachten\n"
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -195,6 +195,8 @@ VERIFY Viser ON hvis p
|
|||
|
||||
WCMD_VOL, "Hjelp til VOL\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT avslutter gjeldende kommandoøkt og returnerer til operativsystemet\n\
|
||||
eller skallet CMD ble startet fra.\n"
|
||||
|
@ -212,6 +214,7 @@ DIR\t\tViser innholdet i en katalgo\n\
|
|||
ECHO\t\tKopierer tekst direkte til konsoll-utdataen\n\
|
||||
HELP\t\tViser en kort hjelpebeskrivelse om et emne\n\
|
||||
MD (MKDIR)\tLager en underkatalog\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tFlytter en eller flere filer, eller en katalogtre\n\
|
||||
PATH\t\tEndrer eller viser søkestien\n\
|
||||
PROMPT\t\tEndrer kommando-klartegnet\n\
|
||||
|
@ -232,4 +235,5 @@ Skriv
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -197,6 +197,8 @@ Ustawienia flagi nic nie zmieniaj
|
|||
WCMD_POPD, "POPD ustala aktualny katalog na ostatni katalog zapamiętany przez\n\
|
||||
PUSHD\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT kończy bierzącą sesję cmd i powraca do systemu operacyjnego\n\
|
||||
lub powłoki, w której uruchomiono cmd.\n"
|
||||
|
@ -214,6 +216,7 @@ DIR\t\tWy
|
|||
ECHO\t\tKopiuje tekst na wyjście konsoli\n\
|
||||
HELP\t\tWyświetla dokładniejszą pomoc o komendzie\n\
|
||||
MD (MKDIR)\tTworzy katalog\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tPrzenosi katalog lub pliki\n\
|
||||
PATH\t\tUstawia lub wyświetla ścieżkę przeszukiwania\n\
|
||||
POPD\t\tWraca do katalogu zapamiętanego przez PUSHD\n\
|
||||
|
@ -236,4 +239,5 @@ Wpisz HELP <komenda> dla dok
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -196,6 +196,8 @@ O flag de verifica
|
|||
|
||||
WCMD_VOL, "Ajuda do comando VOL\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT termina a sessão de comando atual e retorna ao sistema operacional\n\
|
||||
ou shell que tenha invocado o cmd.\n"
|
||||
|
@ -213,6 +215,7 @@ DIR\t\tMostra o conte
|
|||
ECHO\t\tCopia texto diretamente na saída do console\n\
|
||||
HELP\t\tMostra breves detalhes de um tópico\n\
|
||||
MD (MKDIR)\tCria um subdiretório\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tMove um arquivo, conjunto de arquivos ou uma árvore de diretórios\n\
|
||||
PATH\t\tConfigira o caminho de procura\n\
|
||||
PROMPT\t\tMuda o 'prompt' de comando\n\
|
||||
|
@ -404,6 +407,8 @@ O flag de verifica
|
|||
|
||||
WCMD_VOL, "Ajuda do comando VOL\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT termina a sessão de comando actual e retorna ao sistema operacional\n\
|
||||
ou shell que tenha invocado o cmd.\n"
|
||||
|
@ -421,6 +426,7 @@ DIR\t\tMostra o conte
|
|||
ECHO\t\tCopia o texto diretamente na saída da consola\n\
|
||||
HELP\t\tMostra breves detalhes de um tópico\n\
|
||||
MD (MKDIR)\tCria um subdirectório\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tMove um ficheiro, conjunto de ficheiros ou uma árvore de directórios\n\
|
||||
PATH\t\tConfigura o caminho de procura\n\
|
||||
PROMPT\t\tMuda a 'prompt' de comando\n\
|
||||
|
@ -441,4 +447,5 @@ Digite HELP <comando> para mais informa
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -208,6 +208,8 @@ stack, and then changes the current directory to the supplied one.\n"
|
|||
WCMD_POPD, "POPD changes current directory to the last one saved with\n\
|
||||
PUSHD.\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT çàâåðøàåò òåêóùóþ êîìàíäíóþ ñåññèþ è âîçâðàùàåò\n\
|
||||
â îïåðàöèîííóþ ñèñòåìó èëè îáîëî÷êó èç êîòîðîé áûë çàïóùåí cmd.\n"
|
||||
|
@ -225,6 +227,7 @@ DIR\t\t
|
|||
ECHO\t\tÑêîïèðîâàòü òåêñò ïðÿìî íà âûõîä êîíñîëè\n\
|
||||
HELP\t\tÏîêàçàòü êðàäêóþ ïîäñêàçêó ïî êîìàíäå\n\
|
||||
MD (MKDIR)\tÑîçäàòü ïàïêó\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tÏåðåìåñòèòü ôàéë, íàáîð ôàéëîâ èëè äåðåâî ïàïîê\n\
|
||||
PATH\t\tÏîêàçàòü èëè èçìåíèòü ïóòü ïîèñêà ïðîãðàìì\n\
|
||||
POPD\t\tRestores the directory to the last one saved with PUSHD\n\
|
||||
|
@ -247,4 +250,5 @@ EXIT\t\t
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -196,6 +196,8 @@ The verify flag has no function in Wine.\n"
|
|||
|
||||
WCMD_VOL, "Help about VOL\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT terminates the current command session and returns\n\
|
||||
to the operating system or shell from which you invoked cmd.\n"
|
||||
|
@ -213,6 +215,7 @@ DIR\t\tList the contents of a directory\n\
|
|||
ECHO\t\tCopy text directly to the console output\n\
|
||||
HELP\t\tShow brief help details on a topic\n\
|
||||
MD (MKDIR)\tCreate a subdirectory\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tMove a file, set of files or directory tree\n\
|
||||
PATH\t\tSet or show the search path\n\
|
||||
PROMPT\t\tChange the command prompt\n\
|
||||
|
@ -233,4 +236,5 @@ Enter HELP <command> for further information on any of the above commands\n"
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -198,6 +198,8 @@ Do
|
|||
|
||||
WCMD_VOL, "VOL hakkında yardım\n"
|
||||
|
||||
WCMD_MORE, "MORE displays output of files or piped input in pages.\n"
|
||||
|
||||
WCMD_EXIT,
|
||||
"EXIT geçerli komut oturumunu sonlandırır ve cmd'yi çağırdığınız\n\
|
||||
yerden işletim sistemine döner.\n"
|
||||
|
@ -215,6 +217,7 @@ DIR\t\tDizin i
|
|||
ECHO\t\tMetni doğrudan konsol çıkışına kopyala\n\
|
||||
HELP\t\tBir konu üzerinde özet yardım göster\n\
|
||||
MD (MKDIR)\tAlt dizin oluştur\n\
|
||||
MORE\t\tDisplay output in pages\n\
|
||||
MOVE\t\tBir veya daha fazla dosyayı ya da dizin ağacını taşı\n\
|
||||
PATH\t\tArama yolunu düzenle veya göster\n\
|
||||
PROMPT\t\tKomut istemini değiştir\n\
|
||||
|
@ -235,4 +238,5 @@ Yukar
|
|||
WCMD_NOASSOC, "File association missing for extension %s\n"
|
||||
WCMD_NOFTYPE, "No open command associated with file type '%s'\n"
|
||||
WCMD_OVERWRITE, "Overwrite"
|
||||
WCMD_MORESTR, "More..."
|
||||
}
|
||||
|
|
|
@ -1688,6 +1688,115 @@ void WCMD_type (char *command) {
|
|||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* WCMD_more
|
||||
*
|
||||
* Output either a file or stdin to screen in pages
|
||||
*/
|
||||
|
||||
void WCMD_more (char *command) {
|
||||
|
||||
int argno = 0;
|
||||
char *argN = command;
|
||||
BOOL useinput = FALSE;
|
||||
char moreStr[100];
|
||||
char moreStrPage[100];
|
||||
char buffer[512];
|
||||
DWORD count;
|
||||
|
||||
/* Prefix the NLS more with '-- ', then load the text */
|
||||
errorlevel = 0;
|
||||
strcpy(moreStr, "-- ");
|
||||
LoadString (hinst, WCMD_MORESTR, &moreStr[3], sizeof(moreStr)-3);
|
||||
|
||||
if (param1[0] == 0x00) {
|
||||
|
||||
/* Wine implements pipes via temporary files, and hence stdin is
|
||||
effectively reading from the file. This means the prompts for
|
||||
more are satistied by the next line from the input (file). To
|
||||
avoid this, ensure stdin is to the console */
|
||||
HANDLE hstdin = GetStdHandle(STD_INPUT_HANDLE);
|
||||
HANDLE hConIn = CreateFile("CONIN$", GENERIC_READ | GENERIC_WRITE,
|
||||
FILE_SHARE_READ, NULL, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL, 0);
|
||||
SetStdHandle(STD_INPUT_HANDLE, hConIn);
|
||||
|
||||
/* Warning: No easy way of ending the stream (ctrl+z on windows) so
|
||||
once you get in this bit unless due to a pipe, its going to end badly... */
|
||||
useinput = TRUE;
|
||||
sprintf(moreStrPage, "%s --\n", moreStr);
|
||||
|
||||
WCMD_enter_paged_mode(moreStrPage);
|
||||
while (ReadFile (hstdin, buffer, sizeof(buffer)-1, &count, NULL)) {
|
||||
if (count == 0) break; /* ReadFile reports success on EOF! */
|
||||
buffer[count] = 0;
|
||||
WCMD_output_asis (buffer);
|
||||
}
|
||||
WCMD_leave_paged_mode();
|
||||
|
||||
/* Restore stdin to what it was */
|
||||
SetStdHandle(STD_INPUT_HANDLE, hstdin);
|
||||
CloseHandle(hConIn);
|
||||
|
||||
return;
|
||||
} else {
|
||||
BOOL needsPause = FALSE;
|
||||
|
||||
/* Loop through all args */
|
||||
WCMD_enter_paged_mode(moreStrPage);
|
||||
|
||||
while (argN) {
|
||||
char *thisArg = WCMD_parameter (command, argno++, &argN);
|
||||
HANDLE h;
|
||||
|
||||
if (!argN) break;
|
||||
|
||||
if (needsPause) {
|
||||
|
||||
/* Wait */
|
||||
sprintf(moreStrPage, "%s (100%%) --\n", moreStr);
|
||||
WCMD_leave_paged_mode();
|
||||
WCMD_output_asis(moreStrPage);
|
||||
ReadFile (GetStdHandle(STD_INPUT_HANDLE), buffer, sizeof(buffer), &count, NULL);
|
||||
WCMD_enter_paged_mode(moreStrPage);
|
||||
}
|
||||
|
||||
|
||||
WINE_TRACE("more: Processing arg '%s'\n", thisArg);
|
||||
h = CreateFile (thisArg, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
|
||||
FILE_ATTRIBUTE_NORMAL, NULL);
|
||||
if (h == INVALID_HANDLE_VALUE) {
|
||||
WCMD_print_error ();
|
||||
WCMD_output ("%s :Failed\n", thisArg);
|
||||
errorlevel = 1;
|
||||
} else {
|
||||
ULONG64 curPos = 0;
|
||||
ULONG64 fileLen = 0;
|
||||
WIN32_FILE_ATTRIBUTE_DATA fileInfo;
|
||||
|
||||
/* Get the file size */
|
||||
GetFileAttributesEx(thisArg, GetFileExInfoStandard, (void*)&fileInfo);
|
||||
fileLen = (((ULONG64)fileInfo.nFileSizeHigh) << 32) + fileInfo.nFileSizeLow;
|
||||
|
||||
needsPause = TRUE;
|
||||
while (ReadFile (h, buffer, sizeof(buffer), &count, NULL)) {
|
||||
if (count == 0) break; /* ReadFile reports success on EOF! */
|
||||
buffer[count] = 0;
|
||||
curPos += count;
|
||||
|
||||
/* Update % count (would be used in WCMD_output_asis as prompt) */
|
||||
sprintf(moreStrPage, "%s (%2.2d%%) --\n", moreStr, (int) min(99, (curPos * 100)/fileLen));
|
||||
|
||||
WCMD_output_asis (buffer);
|
||||
}
|
||||
CloseHandle (h);
|
||||
}
|
||||
}
|
||||
|
||||
WCMD_leave_paged_mode();
|
||||
}
|
||||
}
|
||||
|
||||
/****************************************************************************
|
||||
* WCMD_verify
|
||||
*
|
||||
|
|
|
@ -277,7 +277,7 @@ void WCMD_directory (char *cmd) {
|
|||
max_width = 80;
|
||||
}
|
||||
if (paged_mode) {
|
||||
WCMD_enter_paged_mode();
|
||||
WCMD_enter_paged_mode(NULL);
|
||||
}
|
||||
|
||||
argno = 0;
|
||||
|
|
|
@ -39,13 +39,14 @@ void WCMD_delete (char *);
|
|||
void WCMD_directory (char *);
|
||||
void WCMD_echo (const char *);
|
||||
void WCMD_endlocal (void);
|
||||
void WCMD_enter_paged_mode(void);
|
||||
void WCMD_enter_paged_mode(const char *);
|
||||
void WCMD_exit (void);
|
||||
void WCMD_for (char *);
|
||||
void WCMD_give_help (char *command);
|
||||
void WCMD_goto (void);
|
||||
void WCMD_if (char *);
|
||||
void WCMD_leave_paged_mode(void);
|
||||
void WCMD_more (char *);
|
||||
void WCMD_move (void);
|
||||
void WCMD_output (const char *format, ...);
|
||||
void WCMD_output_asis (const char *message);
|
||||
|
@ -163,9 +164,10 @@ struct env_stack
|
|||
#define WCMD_ASSOC 40
|
||||
#define WCMD_COLOR 41
|
||||
#define WCMD_FTYPE 42
|
||||
#define WCMD_MORE 43
|
||||
|
||||
/* Must be last in list */
|
||||
#define WCMD_EXIT 43
|
||||
#define WCMD_EXIT 44
|
||||
|
||||
/* Some standard messages */
|
||||
extern const char nyi[];
|
||||
|
@ -180,6 +182,7 @@ extern const char anykey[];
|
|||
#define WCMD_NOASSOC 1004
|
||||
#define WCMD_NOFTYPE 1005
|
||||
#define WCMD_OVERWRITE 1006
|
||||
#define WCMD_MORESTR 1007
|
||||
|
||||
/* msdn specified max for Win XP */
|
||||
#define MAXSTRING 8192
|
||||
|
|
|
@ -36,7 +36,7 @@ const char * const inbuilt[] = {"ATTRIB", "CALL", "CD", "CHDIR", "CLS", "COPY",
|
|||
"PROMPT", "REM", "REN", "RENAME", "RD", "RMDIR", "SET", "SHIFT",
|
||||
"TIME", "TITLE", "TYPE", "VERIFY", "VER", "VOL",
|
||||
"ENDLOCAL", "SETLOCAL", "PUSHD", "POPD", "ASSOC", "COLOR", "FTYPE",
|
||||
"EXIT" };
|
||||
"MORE", "EXIT" };
|
||||
|
||||
HINSTANCE hinst;
|
||||
DWORD errorlevel;
|
||||
|
@ -49,6 +49,7 @@ const char anykey[] = "Press Return key to continue: ";
|
|||
char quals[MAX_PATH], param1[MAX_PATH], param2[MAX_PATH];
|
||||
BATCH_CONTEXT *context = NULL;
|
||||
extern struct env_stack *pushd_directories;
|
||||
static const char *pagedMessage = NULL;
|
||||
|
||||
static char *WCMD_expand_envvar(char *start);
|
||||
|
||||
|
@ -714,6 +715,9 @@ void WCMD_process_command (char *command)
|
|||
case WCMD_FTYPE:
|
||||
WCMD_assoc(p, FALSE);
|
||||
break;
|
||||
case WCMD_MORE:
|
||||
WCMD_more(p);
|
||||
break;
|
||||
case WCMD_EXIT:
|
||||
WCMD_exit ();
|
||||
break;
|
||||
|
@ -1215,7 +1219,7 @@ static int line_count;
|
|||
static int max_height;
|
||||
static BOOL paged_mode;
|
||||
|
||||
void WCMD_enter_paged_mode(void)
|
||||
void WCMD_enter_paged_mode(const char *msg)
|
||||
{
|
||||
CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
|
||||
|
||||
|
@ -1224,12 +1228,14 @@ void WCMD_enter_paged_mode(void)
|
|||
else
|
||||
max_height = 25;
|
||||
paged_mode = TRUE;
|
||||
line_count = 5; /* keep 5 lines from previous output */
|
||||
line_count = 0;
|
||||
pagedMessage = (msg==NULL)? anykey : msg;
|
||||
}
|
||||
|
||||
void WCMD_leave_paged_mode(void)
|
||||
{
|
||||
paged_mode = FALSE;
|
||||
pagedMessage = NULL;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
|
@ -1250,7 +1256,7 @@ void WCMD_output_asis (const char *message) {
|
|||
if (ptr) {
|
||||
if (++line_count >= max_height - 1) {
|
||||
line_count = 0;
|
||||
WCMD_output_asis (anykey);
|
||||
WCMD_output_asis (pagedMessage);
|
||||
ReadFile (GetStdHandle(STD_INPUT_HANDLE), string, sizeof(string), &count, NULL);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue