Changeset 8f44c6b


Ignore:
Timestamp:
Feb 9, 2003, 10:08:38 PM (21 years ago)
Author:
James M. Kretchmar <kretch@mit.edu>
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:
7e3e00a
Parents:
ddb8252
Message:
Changed version to 2.0.1-pre-1
Moved the (broken) newmsgproc stuff it a function procedure
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • ChangeLog

    rddb8252 r8f44c6b  
    11$Id$
     2
     32.0.1-pre-1
     4        Moved the (broken) newmsgproc stuff it a function procedure
    25
    361.2.8
  • functions.c

    rd309eb3 r8f44c6b  
    88#include <sys/types.h>
    99#include <sys/stat.h>
     10#include <sys/wait.h>
     11#include <errno.h>
    1012#include "owl.h"
    1113
     
    25282530  fclose(file);
    25292531}
     2532
     2533
     2534
     2535void owl_function_do_newmsgproc() {
     2536  if (owl_global_get_newmsgproc(&g) && strcmp(owl_global_get_newmsgproc(&g), "")) {
     2537    /* if there's a process out there, we need to check on it */
     2538    if (owl_global_get_newmsgproc_pid(&g)) {
     2539      owl_function_debugmsg("Checking on newmsgproc pid==%i", owl_global_get_newmsgproc_pid(&g));
     2540      owl_function_debugmsg("Waitpid return is %i", waitpid(owl_global_get_newmsgproc_pid(&g), NULL, WNOHANG));
     2541      waitpid(owl_global_get_newmsgproc_pid(&g), NULL, WNOHANG);
     2542      if (waitpid(owl_global_get_newmsgproc_pid(&g), NULL, WNOHANG)==-1) {
     2543        /* it exited */
     2544        owl_global_set_newmsgproc_pid(&g, 0);
     2545        owl_function_debugmsg("newmsgproc exited");
     2546      } else {
     2547        owl_function_debugmsg("newmsgproc did not exit");
     2548      }
     2549    }
     2550   
     2551    /* if it exited, fork & exec a new one */
     2552    if (owl_global_get_newmsgproc_pid(&g)==0) {
     2553      int i, myargc;
     2554      i=fork();
     2555      if (i) {
     2556        /* parent set the child's pid */
     2557        owl_global_set_newmsgproc_pid(&g, i);
     2558        waitpid(i, NULL, WNOHANG);
     2559        owl_function_debugmsg("I'm the parent and I started a new newmsgproc with pid %i", i);
     2560      } else {
     2561        /* child exec's the program */
     2562        char **parsed;
     2563        parsed=owl_parseline(owl_global_get_newmsgproc(&g), &myargc);
     2564        parsed=realloc(parsed, strlen(owl_global_get_newmsgproc(&g)+300));
     2565        parsed[myargc]=(char *) NULL;
     2566       
     2567        owl_function_debugmsg("About to exec: %s with %i arguments", parsed[0], myargc);
     2568       
     2569        execvp(parsed[0], (char **) parsed);
     2570       
     2571       
     2572        /* was there an error exec'ing? */
     2573        owl_function_debugmsg("Error execing: %s", strerror(errno));
     2574        _exit(127);
     2575      }
     2576    }
     2577  }
     2578}
  • owl.c

    ra15a84f r8f44c6b  
    2222#include <sys/param.h>
    2323#include <sys/types.h>
    24 #include <sys/wait.h>
    25 #include <errno.h>
    2624#include "owl.h"
    2725
     
    331329       make it active */
    332330    if (newzephyrs) {
    333       if (owl_global_get_newmsgproc(&g) && strcmp(owl_global_get_newmsgproc(&g), "")) {
    334         /* if there's a process out there, we need to check on it */
    335         if (owl_global_get_newmsgproc_pid(&g)) {
    336           owl_function_debugmsg("Checking on newmsgproc pid==%i", owl_global_get_newmsgproc_pid(&g));
    337           owl_function_debugmsg("Waitpid return is %i", waitpid(owl_global_get_newmsgproc_pid(&g), NULL, WNOHANG));
    338           waitpid(owl_global_get_newmsgproc_pid(&g), NULL, WNOHANG);
    339           if (waitpid(owl_global_get_newmsgproc_pid(&g), NULL, WNOHANG)==-1) {
    340             /* it exited */
    341             owl_global_set_newmsgproc_pid(&g, 0);
    342             owl_function_debugmsg("newmsgproc exited");
    343           } else {
    344             owl_function_debugmsg("newmsgproc did not exit");
    345           }
    346         }
    347        
    348         /* if it exited, fork & exec a new one */
    349         if (owl_global_get_newmsgproc_pid(&g)==0) {
    350           int i, myargc;
    351           i=fork();
    352           if (i) {
    353             /* parent set the child's pid */
    354             owl_global_set_newmsgproc_pid(&g, i);
    355             waitpid(i, NULL, WNOHANG);
    356             owl_function_debugmsg("I'm the parent and I started a new newmsgproc with pid %i", i);
    357           } else {
    358             /* child exec's the program */
    359             char **parsed;
    360             parsed=owl_parseline(owl_global_get_newmsgproc(&g), &myargc);
    361             parsed=realloc(parsed, strlen(owl_global_get_newmsgproc(&g)+300));
    362             parsed[myargc]=(char *) NULL;
    363 
    364             owl_function_debugmsg("About to exec: %s with %i arguments", parsed[0], myargc);
    365 
    366             execvp(parsed[0], (char **) parsed);
    367            
    368 
    369             /* was there an error exec'ing? */
    370             owl_function_debugmsg("Error execing: %s", strerror(errno));
    371             _exit(127);
    372           }
    373         }
    374       }
     331      owl_function_do_newmsgproc();
    375332    }
    376333   
  • owl.h

    r5a35ae8e r8f44c6b  
    1212static const char owl_h_fileIdent[] = "$Id$";
    1313
    14 #define OWL_VERSION         1.2.8
    15 #define OWL_VERSION_STRING "1.2.8"
     14#define OWL_VERSION         2.0.1-pre-1
     15#define OWL_VERSION_STRING "2.0.1-pre-1"
    1616
    1717#define OWL_DEBUG 0
Note: See TracChangeset for help on using the changeset viewer.