79640: cmd: Make PAUSE accept any keypress instead of a full input line

buildbot at kegel.com buildbot at kegel.com
Thu Oct 6 20:20:25 CDT 2011


This is an experimental automated build and test service.
Please feel free to ignore this email while we work the kinks out.

For more info about this message, see http://wiki.winehq.org/BuildBot

The Buildbot has detected a failed build on builder runtests-default while building Wine.
Full details are available at: http://buildbot.kegel.com/builders/runtests-default/builds/43 (though maybe not for long, as I'm still reinstalling the buildbot periodically while experimenting)
BUILD FAILED: failed git

Errors:
error: patch failed: programs/cmd/cmd.rc:271
error: programs/cmd/cmd.rc: patch does not apply

-------------- next part --------------
From: Frédéric Delanoy <frederic.delanoy at gmail.com>
Subject: cmd: Make PAUSE accept any keypress instead of a full input line
Message-Id: <1317942128-28035-2-git-send-email-frederic.delanoy at gmail.com>
Date: Fri,  7 Oct 2011 01:02:08 +0200

All Windows versions wait for a single keypress.
Wine was waiting for a full EOL-terminated line to be entered.
---
 programs/cmd/builtins.c |   21 +++++++++++++++------
 programs/cmd/cmd.rc     |   11 ++++++-----
 2 files changed, 21 insertions(+), 11 deletions(-)

diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 6b4d0ab..1db9b3c 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -1685,16 +1685,25 @@ void WCMD_move (void) {
 /****************************************************************************
  * WCMD_pause
  *
- * Wait for keyboard input.
+ * Suspend execution of a batch script until a key is typed
  */
 
-void WCMD_pause (void) {
-
+void WCMD_pause (void)
+{
+  DWORD oldmode;
+  BOOL have_console;
   DWORD count;
-  WCHAR string[32];
+  WCHAR key;
+  HANDLE hIn = GetStdHandle(STD_INPUT_HANDLE);
+
+  have_console = GetConsoleMode(hIn, &oldmode);
+  if (have_console)
+      SetConsoleMode(hIn, 0);
 
-  WCMD_output (anykey);
-  WCMD_ReadFile(GetStdHandle(STD_INPUT_HANDLE), string, sizeof(string)/sizeof(WCHAR), &count);
+  WCMD_output(anykey);
+  WCMD_ReadFile(hIn, &key, 1, &count);
+  if (have_console)
+    SetConsoleMode(hIn, oldmode);
 }
 
 /****************************************************************************
diff --git a/programs/cmd/cmd.rc b/programs/cmd/cmd.rc
index 0786680..c11f9ad 100644
--- a/programs/cmd/cmd.rc
+++ b/programs/cmd/cmd.rc
@@ -122,10 +122,10 @@ variable, for example:\n\
 		PATH %PATH%;c:\\temp\n"
 
   WCMD_PAUSE,
-"PAUSE displays a message on the screen 'Press Return key to continue'\n\
-and waits for the user to press the Return key. It is mainly useful in\n\
-batch files to allow the user to read the output of a previous command\n\
-before it scrolls off the screen.\n"
+"PAUSE displays a message on the screen asking the user to press a key.\n\
+\n\
+It is mainly useful in batch files to allow the user to read the output\n\
+of a previous command before it scrolls off the screen.\n"
 
   WCMD_PROMPT,
 "PROMPT sets the command-line prompt.\n\
@@ -271,6 +271,7 @@ 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\
+PAUSE\t\tSuspend execution of a batch file\n\
 POPD\t\tRestore the directory to the last one saved with PUSHD\n\
 PROMPT\t\tChange the command prompt\n\
 PUSHD\t\tChange to a new directory, saving the current one\n\
@@ -317,7 +318,7 @@ Enter HELP <command> for further information on any of the above commands.\n"
   WCMD_VOLUMEDETAIL, "Volume in drive %c is %s\nVolume Serial Number is %04x-%04x\n\n"
   WCMD_VOLUMEPROMPT, "Volume label (11 characters, ENTER for none)?"
   WCMD_NOPATH, "PATH not found\n"
-  WCMD_ANYKEY,"Press Return key to continue: "
+  WCMD_ANYKEY,"Press any key to continue... "
   WCMD_CONSTITLE,"Wine Command Prompt"
   WCMD_VERSION,"CMD Version %s\n"
   WCMD_MOREPROMPT, "More? "
-- 
1.7.7



More information about the wine-tests-results mailing list