Changeset 700c712
- Timestamp:
- Sep 25, 2002, 3:59: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:
- 55faab7
- Parents:
- 601a9e0
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
ChangeLog
r601a9e0 r700c712 1 1 $Id$ 2 1.2.6 3 Started adding code for newmsgproc. It doesn't fully work yet! 4 Don't use it. 5 2 6 1.2.5 3 7 Patch to fix memory bug in replying to CC messages -
global.c
r61e79a9 r700c712 62 62 g->starttime=time(NULL); /* assumes we call init only a start time */ 63 63 strcpy(g->buffercommand, ""); 64 64 g->newmsgproc_pid=0; 65 65 66 66 owl_global_set_config_format(g, 0); … … 598 598 return(g->searchstring); 599 599 } 600 601 void owl_global_set_newmsgproc_pid(owl_global *g, int i) { 602 g->newmsgproc_pid=i; 603 } 604 605 int owl_global_get_newmsgproc_pid(owl_global *g) { 606 return(g->newmsgproc_pid); 607 } 608 -
owl.c
r601a9e0 r700c712 21 21 #include <time.h> 22 22 #include <sys/param.h> 23 #include <sys/types.h> 24 #include <sys/wait.h> 25 #include <errno.h> 23 26 #include "owl.h" 24 27 … … 325 328 if (newzephyrs && followlast) { 326 329 owl_function_lastmsg_noredisplay(); 330 } 331 332 /* check if newmsgproc is active, if not but the option is on, 333 make it active */ 334 if (newzephyrs) { 335 if (owl_global_get_newmsgproc(&g) && strcmp(owl_global_get_newmsgproc(&g), "")) { 336 /* if there's a process out there, we need to check on it */ 337 if (owl_global_get_newmsgproc_pid(&g)) { 338 owl_function_debugmsg("Checking on newmsgproc pid==%i", owl_global_get_newmsgproc_pid(&g)); 339 owl_function_debugmsg("Waitpid return is %i", waitpid(owl_global_get_newmsgproc_pid(&g), NULL, WNOHANG)); 340 waitpid(owl_global_get_newmsgproc_pid(&g), NULL, WNOHANG); 341 if (waitpid(owl_global_get_newmsgproc_pid(&g), NULL, WNOHANG)==-1) { 342 /* it exited */ 343 owl_global_set_newmsgproc_pid(&g, 0); 344 owl_function_debugmsg("newmsgproc exited"); 345 } else { 346 owl_function_debugmsg("newmsgproc did not exit"); 347 } 348 } 349 350 /* if it exited, fork & exec a new one */ 351 if (owl_global_get_newmsgproc_pid(&g)==0) { 352 int i, argc; 353 i=fork(); 354 if (i) { 355 /* parent set the child's pid */ 356 owl_global_set_newmsgproc_pid(&g, i); 357 waitpid(i, NULL, WNOHANG); 358 owl_function_debugmsg("I'm the parent and I started a new newmsgproc with pid %i", i); 359 } else { 360 /* child exec's the program */ 361 char **parsed; 362 363 parsed=owl_parseline(owl_global_get_newmsgproc(&g), &argc); 364 parsed=realloc(parsed, strlen(owl_global_get_newmsgproc(&g)+300)); 365 parsed[argc]='\0'; 366 367 owl_function_debugmsg("About to exec: -%s- with %i arguments", parsed[0], argc); 368 369 execvp(*parsed, parsed); 370 371 372 /* was there an error exec'ing? */ 373 owl_function_debugmsg("Error execing: %s", strerror(errno)); 374 _exit(127); 375 } 376 } 377 } 327 378 } 328 379 -
owl.h
r601a9e0 r700c712 386 386 int colorpairs; 387 387 int searchactive; 388 int newmsgproc_pid; 388 389 char *searchstring; 389 390 owl_filterelement fe_true; -
variable.c
rf9c43ae r700c712 147 147 "This program should produce a zsig on stdout when run.\n" 148 148 "Note that it is important that this program not block.\n" ), 149 150 OWLVAR_PATH( "newmsgproc" /* %OwlVarStub:newmsgproc */, NULL, 151 "name of a program to run when new messages are present", 152 "The named program will be run when owl recevies new.\n" 153 "messages. It will not be run again until the first\n" 154 "instance exits"), 149 155 150 156 OWLVAR_STRING( "zsig" /* %OwlVarStub */, "",
Note: See TracChangeset
for help on using the changeset viewer.