comparison main.c @ 302:3b11e32e8d7e

we close stdin as well
author Anselm R.Garbe <arg@10ksloc.org>
date Wed, 16 Aug 2006 09:31:41 +0200
parents 7565875d07d3
children 204427dcc087
comparison
equal deleted inserted replaced
301:87d1c9978ed2 302:3b11e32e8d7e
16 #include <X11/Xproto.h> 16 #include <X11/Xproto.h>
17 17
18 /* static */ 18 /* static */
19 19
20 static int (*xerrorxlib)(Display *, XErrorEvent *); 20 static int (*xerrorxlib)(Display *, XErrorEvent *);
21 static Bool otherwm; 21 static Bool otherwm, readin;
22 22
23 static void 23 static void
24 cleanup() 24 cleanup()
25 { 25 {
26 close(STDIN_FILENO);
26 while(sel) { 27 while(sel) {
27 resize(sel, True, TopLeft); 28 resize(sel, True, TopLeft);
28 unmanage(sel); 29 unmanage(sel);
29 } 30 }
30 if(dc.font.set) 31 if(dc.font.set)
144 } 145 }
145 146
146 void 147 void
147 quit(Arg *arg) 148 quit(Arg *arg)
148 { 149 {
149 running = False; 150 readin = running = False;
150 } 151 }
151 152
152 /* 153 /*
153 * There's no way to check accesses to destroyed windows, thus those cases are 154 * There's no way to check accesses to destroyed windows, thus those cases are
154 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs 155 * ignored (especially on UnmapNotify's). Other types of errors call Xlibs
174 main(int argc, char *argv[]) 175 main(int argc, char *argv[])
175 { 176 {
176 int i, j, xfd; 177 int i, j, xfd;
177 unsigned int mask; 178 unsigned int mask;
178 fd_set rd; 179 fd_set rd;
179 Bool readin = True;
180 Window w; 180 Window w;
181 XModifierKeymap *modmap; 181 XModifierKeymap *modmap;
182 XSetWindowAttributes wa; 182 XSetWindowAttributes wa;
183 183
184 if(argc == 2 && !strncmp("-v", argv[1], 3)) { 184 if(argc == 2 && !strncmp("-v", argv[1], 3)) {
277 scan(); 277 scan();
278 278
279 /* main event loop, also reads status text from stdin */ 279 /* main event loop, also reads status text from stdin */
280 XSync(dpy, False); 280 XSync(dpy, False);
281 procevent(); 281 procevent();
282 readin = True;
282 while(running) { 283 while(running) {
283 FD_ZERO(&rd); 284 FD_ZERO(&rd);
284 if(readin) 285 if(readin)
285 FD_SET(STDIN_FILENO, &rd); 286 FD_SET(STDIN_FILENO, &rd);
286 FD_SET(xfd, &rd); 287 FD_SET(xfd, &rd);