annotate lib-src/i.c @ 800:a5954632b187

[xemacs-hg @ 2002-03-31 08:27:14 by ben] more fixes, first crack at finishing behavior implementation TODO.ben-mule-21-5: Update. configure.in: Fix for new error-checking types. make-mswin-unicode.pl: Don't be fucked up by CRLF. Output code to force errors when nonintercepted Windows calls issued. behavior.el, dumped-lisp.el, menubar-items.el: Add support for saving using custom. Load into a dumped XEmacs. Correct :title to :short-doc in accordance with behavior-defs.el. Add a submenu under Options for turning on/off behaviors. cl-macs.el: Properly document `loop'. Fix a minor bug in keymap iteration and add support for bit-vector iteration. lisp-mode.el: Rearrange and add items for macro expanding. menubar-items.el: Document connection between these two functions. window.el: Port stuff from GNU 21.1. config.inc.samp, xemacs.mak: Separate out and add new variable for controlling error-checking. s/windowsnt.h: Use new ERROR_CHECK_ALL; not related to DEBUG_XEMACS. alloc.c, backtrace.h, buffer.c, buffer.h, bytecode.c, callproc.c, casetab.c, charset.h, chartab.c, cmdloop.c, config.h.in, console-msw.c, console-stream.c, console-tty.c, console.c, console.h, data.c, device-msw.c, device.c, device.h, dired-msw.c, dired.c, dumper.c, editfns.c, eldap.c, elhash.c, emacs.c, eval.c, event-Xt.c, event-gtk.c, event-msw.c, event-stream.c, events.c, extents.c, faces.c, file-coding.c, file-coding.h, fileio.c, frame-msw.c, frame.c, frame.h, glyphs-gtk.c, glyphs-msw.c, glyphs-shared.c, glyphs-widget.c, glyphs-x.c, glyphs.c, glyphs.h, insdel.c, intl-auto-encap-win32.c, intl-auto-encap-win32.h, intl-encap-win32.c, intl-win32.c, keymap.c, lisp-union.h, lisp.h, lread.c, lrecord.h, lstream.c, lstream.h, macros.c, marker.c, md5.c, menubar-x.c, menubar.c, mule-coding.c, ntproc.c, objects-gtk.c, objects-msw.c, objects-x.c, objects.c, opaque.c, print.c, process-nt.c, process-unix.c, process.c, rangetab.c, redisplay-msw.c, redisplay-output.c, redisplay.c, regex.c, scrollbar-msw.c, select-msw.c, signal.c, specifier.c, specifier.h, symbols.c, sysdep.c, syswindows.h, text.c, text.h, toolbar-msw.c, tooltalk.c, ui-gtk.c, unicode.c, window.c: Redo error-checking macros: ERROR_CHECK_TYPECHECK -> ERROR_CHECK_TYPES, ERROR_CHECK_CHARBPOS -> ERROR_CHECK_TEXT, add ERROR_CHECK_DISPLAY, ERROR_CHECK_STRUCTURES. Document these in config.h.in. Fix code to follow docs. Fix *_checking_assert() in accordance with new names. Attempt to fix periodic redisplay crash freeing display line structures. Add first implementation of sledgehammer redisplay check. Redo print_*() to use write_fmt_string(), write_fmt_string_lisp(). Fix bug in md5 handling. Rename character-to-unicode to char-to-unicode; same for unicode-to-char{acter}. Move chartab documentation to `make-char-table'. Some header cleanup. Clean up remaining places where nonintercepted Windows calls are being used. automated/mule-tests.el: Fix for new Unicode support.
author ben
date Sun, 31 Mar 2002 08:30:17 +0000
parents abe6d1db359e
children 6728e641994e
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
442
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
1 /* I-connector utility
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
2 Copyright (C) 2000 Kirill M. Katsnelson
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
3
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
4 This file is part of XEmacs.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
5
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
6 XEmacs is free software; you can redistribute it and/or modify it
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
7 under the terms of the GNU General Public License as published by the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
8 Free Software Foundation; either version 2, or (at your option) any
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
9 later version.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
10
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
11 XEmacs is distributed in the hope that it will be useful, but WITHOUT
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
14 for more details.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
15
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
16 You should have received a copy of the GNU General Public License
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
17 along with XEmacs; see the file COPYING. If not, write to
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
18 the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
19 Boston, MA 02111-1307, USA. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
20
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
21 /* When run with an argument, i treats it as a command line, and pipes
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
22 command stdin, stdout and stderr to its own respective streams. How
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
23 silly it should sound, but windowed program in Win32 cannot do output
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
24 to the console from which it has been started, and should be run using
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
25 this utility.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
26
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
27 This utility is for running [tx]emacs as part of make process so that
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
28 its output goes to the same console as the rest of the make output
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
29 does. It can be used also when xemacs should be run as a batch
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
30 command ina script, especially when its standart output should be
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
31 obtained programmatically. */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
32
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
33 #include <windows.h>
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
34 #include <stdio.h>
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
35 #include <string.h>
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
36 #include <tchar.h>
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
37
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
38 typedef struct
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
39 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
40 HANDLE source;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
41 HANDLE drain;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
42 } I_connector;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
43
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
44 /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
45 * Make new handle as that pointed to by PH but
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
46 * inheritable, substitute PH with it, and close the
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
47 * original one
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
48 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
49 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
50 make_inheritable (HANDLE* ph)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
51 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
52 HANDLE htmp;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
53 DuplicateHandle (GetCurrentProcess(), *ph, GetCurrentProcess(), &htmp,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
54 0, TRUE, DUPLICATE_CLOSE_SOURCE | DUPLICATE_SAME_ACCESS);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
55 *ph = htmp;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
56 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
57
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
58 /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
59 * Worker thread proc. Reads source, pumps into drain,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
60 * till either clogs.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
61 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
62 static DWORD CALLBACK
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
63 pump (LPVOID pv_i)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
64 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
65 I_connector* pi = (I_connector*) pv_i;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
66 BYTE buffer [256];
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
67 DWORD really_read, unused;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
68
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
69 while (ReadFile (pi->source, buffer, sizeof (buffer), &really_read, NULL) &&
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
70 WriteFile (pi->drain, buffer, really_read, &unused, NULL))
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
71 ;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
72
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
73 return 0;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
74 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
75
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
76 /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
77 * Launch a pump for the given I-connector
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
78 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
79 static void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
80 start_pump (I_connector* pi)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
81 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
82 DWORD unused;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
83 HANDLE h_thread = CreateThread (NULL, 0, pump, (void*)pi, 0, &unused);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
84 CloseHandle (h_thread);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
85 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
86
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
87 /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
88 * Get command line, skip over the executable name, return the rest.
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
89 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
90 static LPTSTR
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
91 get_command (void)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
92 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
93 LPTSTR cl = GetCommandLine ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
94 int ix;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
95
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
96 while (1)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
97 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
98 ix = _tcscspn (cl, _T(" \t\""));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
99 if (cl[ix] == '\"')
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
100 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
101 cl = _tcschr (cl + ix + 1, '\"');
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
102 if (cl == NULL)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
103 return NULL; /* Unmatched quote */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
104 cl++;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
105 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
106 else
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
107 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
108 cl += ix;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
109 cl += _tcsspn (cl, _T(" \t"));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
110 return *cl ? cl : NULL;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
111 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
112 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
113 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
114
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
115 /*
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
116 * Brew coffee and bring snickers
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
117 */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
118 void
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
119 usage (void)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
120 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
121 fprintf (stderr,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
122 "\n"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
123 "usage: i command\n"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
124 "i executes the command and reroutes its standard handles to the calling\n"
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
125 "console. Good for seeing output of GUI programs that use standard output."
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
126 "\n");
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
127 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
128
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
129 int
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
130 main (void)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
131 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
132 STARTUPINFO si;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
133 PROCESS_INFORMATION pi;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
134 I_connector I_in, I_out, I_err;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
135 DWORD exit_code;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
136
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
137 LPTSTR command = get_command ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
138 if (command == NULL)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
139 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
140 usage ();
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
141 return 1;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
142 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
143
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
144 ZeroMemory (&si, sizeof (si));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
145 si.dwFlags = STARTF_USESTDHANDLES;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
146
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
147 I_in.source = GetStdHandle (STD_INPUT_HANDLE);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
148 CreatePipe (&si.hStdInput, &I_in.drain, NULL, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
149 make_inheritable (&si.hStdInput);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
150
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
151 I_out.drain = GetStdHandle (STD_OUTPUT_HANDLE);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
152 CreatePipe (&I_out.source, &si.hStdOutput, NULL, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
153 make_inheritable (&si.hStdOutput);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
154
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
155 I_err.drain = GetStdHandle (STD_ERROR_HANDLE);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
156 CreatePipe (&I_err.source, &si.hStdError, NULL, 0);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
157 make_inheritable (&si.hStdError);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
158
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
159 if (CreateProcess (NULL, command, NULL, NULL, TRUE, 0,
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
160 NULL, NULL, &si, &pi) == 0)
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
161 {
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
162 _ftprintf (stderr, _T("Error %d launching `%s'\n"),
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
163 GetLastError (), command);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
164 return 2;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
165 }
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
166
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
167 CloseHandle (pi.hThread);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
168
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
169 /* Start pump in each I-connector */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
170 start_pump (&I_in);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
171 start_pump (&I_out);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
172 start_pump (&I_err);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
173
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
174 /* Wait for the process to complete */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
175 WaitForSingleObject (pi.hProcess, INFINITE);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
176 GetExitCodeProcess (pi.hProcess, &exit_code);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
177 CloseHandle (pi.hProcess);
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
178
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
179 /* Make pump threads eventually die out. Looks rude, I agree */
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
180 CloseHandle (GetStdHandle (STD_INPUT_HANDLE));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
181 CloseHandle (GetStdHandle (STD_OUTPUT_HANDLE));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
182 CloseHandle (GetStdHandle (STD_ERROR_HANDLE));
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
183
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
184 return exit_code;
abe6d1db359e Import from CVS: tag r21-2-36
cvs
parents:
diff changeset
185 }