Changeset afbf668
- Timestamp:
- Mar 1, 2004, 12:42:56 PM (21 years ago)
- Branches:
- master, barnowl_perlaim, debian, owl, release-1.10, release-1.4, release-1.5, release-1.6, release-1.7, release-1.8, release-1.9
- Children:
- 948b942
- Parents:
- c61918e
- Files:
-
- 2 added
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
rc61918e rafbf668 1 1 $Id$ 2 2 3 2.1.6pre1 4 pexec will now incrimentally display data as it is output 5 by the child process. Additionally, commands running under 6 pexec may now be killed by quitting out of the popless window. 7 Added muxevents select loop dispatcher. File descriptors may 8 be registered with muxevents and handlers will be dispatched 9 to when data is available for non-blocking read/write/except. 10 Switched the stderr_redir stuff to use muxevents. 11 3 12 2.1.5 4 13 Added a licence -
Makefile.in
r094009a rafbf668 24 24 keypress.c keymap.c keybinding.c cmd.c context.c zcrypt.c \ 25 25 aim.c buddy.c buddylist.c timer.c style.c stylefunc.c errqueue.c \ 26 zbuddylist.c 26 zbuddylist.c muxevents.c popexec.c 27 27 OWL_SRC = owl.c 28 28 TESTER_SRC = tester.c -
functions.c
rdebb15d rafbf668 2241 2241 strcat(newbuff, redirect); 2242 2242 2243 p=popen(newbuff, "r"); 2244 out=owl_malloc(1024); 2245 size=1024; 2246 strcpy(out, ""); 2247 while (fgets(buff2, 1024, p)!=NULL) { 2248 size+=1024; 2249 out=owl_realloc(out, size); 2250 strcat(out, buff2); 2251 } 2252 pclose(p); 2253 2254 if (type==1) { 2255 owl_function_popless_text(out); 2256 } else if (type==0) { 2257 return out; 2258 } else if (type==2) { 2259 owl_function_adminmsg(buff, out); 2243 if (type == 1) { 2244 owl_popexec_new(newbuff); 2260 2245 } else { 2261 owl_function_popless_text(out); 2262 } 2263 owl_free(out); 2246 p=popen(newbuff, "r"); 2247 out=owl_malloc(1024); 2248 size=1024; 2249 strcpy(out, ""); 2250 while (fgets(buff2, 1024, p)!=NULL) { 2251 size+=1024; 2252 out=owl_realloc(out, size); 2253 strcat(out, buff2); 2254 } 2255 pclose(p); 2256 2257 if (type==1) { 2258 owl_function_popless_text(out); 2259 } else if (type==0) { 2260 return out; 2261 } else if (type==2) { 2262 owl_function_adminmsg(buff, out); 2263 } else { 2264 owl_function_popless_text(out); 2265 } 2266 owl_free(out); 2267 } 2264 2268 return NULL; 2265 2269 } -
global.c
r5a95b69 rafbf668 50 50 owl_keys_setup_keymaps(&g->kh); 51 51 52 owl_list_create(&(g->muxevents)); 52 53 owl_list_create(&(g->filterlist)); 53 54 owl_list_create(&(g->puntlist)); … … 523 524 } 524 525 526 /* muxevents */ 527 528 owl_muxevents *owl_global_get_muxevents(owl_global *g) { 529 return(&(g->muxevents)); 530 } 531 525 532 /* filterlist */ 526 533 -
owl.c
r5d365f6 rafbf668 57 57 #endif 58 58 int stderr_replace(void); 59 void stderr_redirect(int rfd);60 59 #endif 61 60 … … 196 195 owl_function_debugmsg("startup: doing stderr redirection"); 197 196 newstderr = stderr_replace(); 197 owl_muxevents_add(owl_global_get_muxevents(&g), newstderr, OWL_MUX_READ, 198 stderr_redirect_handler, NULL); 198 199 #endif 199 200 … … 579 580 } 580 581 } 582 583 /* dispatch any muxevents */ 584 owl_muxevents_dispatch(owl_global_get_muxevents(&g), 0); 581 585 582 586 /* follow the last message if we're supposed to */ … … 665 669 } 666 670 667 #if OWL_STDERR_REDIR668 stderr_redirect(newstderr);669 #endif670 671 671 /* Log any error signals */ 672 672 { … … 675 675 if ((signum = owl_global_get_errsignal_and_clear(&g, &si)) > 0) { 676 676 owl_function_error("Got unexpected signal: %d %s (code: %d band: %d errno: %d)", 677 signum, signum==SIGPIPE?"SIGPIPE":" ",677 signum, signum==SIGPIPE?"SIGPIPE":"SIG????", 678 678 si.si_code, si.si_band, si.si_errno); 679 679 } … … 690 690 */ 691 691 owl_function_resize(); 692 } else if (sig==SIGPIPE ) {692 } else if (sig==SIGPIPE || sig==SIGCHLD) { 693 693 /* Set a flag and some info that we got the sigpipe 694 694 * so we can record that we got it and why... */ … … 732 732 } 733 733 734 /* Sends stderr (read from rfd) messages to a file */735 void stderr_redirect (int rfd)734 /* Sends stderr (read from rfd) messages to the error console */ 735 void stderr_redirect_handler(int handle, int rfd, int eventmask, void *data) 736 736 { 737 737 int navail, bread; -
owl.h
rc61918e rafbf668 59 59 static const char owl_h_fileIdent[] = "$Id$"; 60 60 61 #define OWL_VERSION 2.1. 562 #define OWL_VERSION_STRING "2.1. 5"61 #define OWL_VERSION 2.1.6pre1 62 #define OWL_VERSION_STRING "2.1.6pre1" 63 63 64 64 /* Feature that is being tested to redirect stderr through a pipe. … … 110 110 #define OWL_MESSAGE_DIRECTION_IN 1 111 111 #define OWL_MESSAGE_DIRECTION_OUT 2 112 113 #define OWL_MUX_READ 1 114 #define OWL_MUX_WRITE 2 115 #define OWL_MUX_EXCEPT 4 112 116 113 117 #define OWL_DIRECTION_NONE 0 … … 352 356 int winlines, wincols; 353 357 WINDOW *curswin; 358 void (*onclose_hook) (struct _owl_viewwin *vwin, void *data); 359 void *onclose_hook_data; 354 360 } owl_viewwin; 355 361 … … 363 369 void (*handler) (int ch); 364 370 } owl_popwin; 371 372 typedef struct _owl_popexec { 373 int refcount; 374 owl_viewwin *vwin; 375 int winactive; 376 int pid; /* or 0 if it has terminated */ 377 int rfd; 378 } owl_popexec; 365 379 366 380 typedef struct _owl_messagelist { … … 419 433 } owl_editwin; 420 434 435 typedef struct _owl_mux { 436 int handle; /* for referencing this */ 437 int active; /* has this been deleted? */ 438 int fd; 439 int eventmask; /* bitmask of OWL_MUX_* */ 440 void (*handler_fn)(int handle, int fd, int eventmask, void *data); 441 void *data; /* data reference to pass to callback */ 442 } owl_mux; 443 typedef owl_list owl_muxevents; 444 421 445 typedef struct _owl_keybinding { 422 446 int *j; /* keypress stack (0-terminated) */ … … 478 502 owl_list filterlist; 479 503 owl_list puntlist; 504 owl_muxevents muxevents; /* fds to dispatch on */ 480 505 owl_vardict vars; 481 506 owl_cmddict cmds; -
viewwin.c
rb2b0773 rafbf668 14 14 if (text) { 15 15 owl_fmtext_append_normal(&(v->fmtext), text); 16 if (text[strlen(text)-1]!='\n' ) {16 if (text[strlen(text)-1]!='\n' && text[0]!='\0') { 17 17 owl_fmtext_append_normal(&(v->fmtext), "\n"); 18 18 } … … 24 24 v->wincols=wincols; 25 25 v->curswin=win; 26 v->onclose_hook = NULL; 27 } 28 29 void owl_viewwin_append_text(owl_viewwin *v, char *text) { 30 owl_fmtext_append_normal(&(v->fmtext), text); 31 v->textlines=owl_fmtext_num_lines(&(v->fmtext)); 26 32 } 27 33 … … 45 51 v->winlines=winlines; 46 52 v->wincols=wincols; 53 } 54 55 void owl_viewwin_set_onclose_hook(owl_viewwin *v, void (*onclose_hook) (owl_viewwin *vwin, void *data), void *onclose_hook_data) { 56 v->onclose_hook = onclose_hook; 57 v->onclose_hook_data = onclose_hook_data; 47 58 } 48 59 … … 135 146 void owl_viewwin_free(owl_viewwin *v) 136 147 { 148 if (v->onclose_hook) { 149 v->onclose_hook(v, v->onclose_hook_data); 150 } 137 151 owl_fmtext_free(&(v->fmtext)); 138 152 }
Note: See TracChangeset
for help on using the changeset viewer.