[PATCH] do_execute() flush stdout before executing a command
Pavel Tsekov
ptsekov at gmx.net
Sat Aug 27 18:46:18 UTC 2005
Hello,
A very small and simple patch. It fixes the following problem with MC
linked agains ncurses:
1) mc -u (or just mc if your MC is compiled without subshell support)
2) type `ls' (without quotes)
3) Ctrl + O
As a result you'll see the actual command (ls) printed after its output.
The reason for this is that ncurses sets stdout to be block buffered and
not line buffered. Here is a quote from the ncurses/tinfo/setbuf.c from
the ncurses package:
[...]
If the output file descriptor is connected to a tty (the typical case)
it will probably be line-buffered. Keith Bostic pointed out that we
don't wantthis; it hoses people running over networks by forcing out
a bunch of smallpackets instead of one big one, so screen updates on
ptys look jerky. Restore block buffering to prevent this minor lossage.
[...]
Changelog:
2005-08-27 Pavel Tsekov <ptsekov at gmx.net>
* execute.c (do_execute): Flush stdout after printing the command
to be executed.
-------------- next part --------------
Index: src/execute.c
===================================================================
RCS file: /cvsroot/mc/mc/src/execute.c,v
retrieving revision 1.12
diff -u -p -r1.12 execute.c
--- src/execute.c 27 May 2005 03:35:15 -0000 1.12
+++ src/execute.c 27 Aug 2005 18:33:41 -0000
@@ -109,6 +109,7 @@ do_execute (const char *shell, const cha
if (!use_subshell && command && !(flags & EXECUTE_INTERNAL)) {
printf ("%s%s\n", prompt, command);
+ fflush (stdout);
}
#ifdef HAVE_SUBSHELL_SUPPORT
if (use_subshell && !(flags & EXECUTE_INTERNAL)) {
More information about the mc-devel
mailing list