commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-commons-sandbox/daemon/src/native/nt/procrun procrun.c
Date Fri, 07 Feb 2003 09:58:48 GMT
mturk       2003/02/07 01:58:48

  Modified:    daemon/src/native/nt/procrun procrun.c
  Log:
  1. Added CLOSE and SHUTDOWN Console Events
  2. Fixed bug in parsing -Java java
  3. Added prety displaying of Service description for //TS// as console title
  
  Revision  Changes    Path
  1.2       +32 -10    jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.c
  
  Index: procrun.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/daemon/src/native/nt/procrun/procrun.c,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- procrun.c	7 Feb 2003 07:04:35 -0000	1.1
  +++ procrun.c	7 Feb 2003 09:58:48 -0000	1.2
  @@ -832,7 +832,7 @@
       }
       if (has_java) {
           UINT em;
  -        DBPRINTF1("jvm_path", jvm_path);
  +        DBPRINTF1("jvm_path %s", jvm_path);
           if (strlen(jvm_path) && (stricmp(jvm_path, "auto") == 0))
               proc->java.path = procrun_guess_jvm(proc);
           else if (strlen(jvm_path) && (strnicmp(jvm_path, "java", 4) == 0)) {
  @@ -1284,13 +1284,13 @@
   
           j = make_array(env->m->java.opts, opts, 60, env->m);
   
  -        for (i = 0; i < j; j++)
  +        for (i = 0; i < j; i++)
               len += strlen(opts[i]);
  -        
  +       
           nargw = pool_calloc(env->m->pool, len);
           strcpy(nargw, env->m->argw);
           strcat(nargw, " ");
  -        for (i = 0; i < j; j++) {
  +        for (i = 0; i < j; i++) {
               strcat(nargw, opts[i]);
               strcat(nargw, " ");
           }
  @@ -1304,9 +1304,9 @@
               strcat(nargw, program);
           strcat(nargw, " ");
           strcat(nargw, env->m->java.start_class);
  -        if (env->m->java.start_method) {
  +        if (env->m->java.start_param) {
               strcat(nargw, " ");
  -            strcat(nargw, env->m->java.start_method);
  +            strcat(nargw, env->m->java.start_param);
           }
           env->m->argw = nargw;
           program = env->m->java.path;
  @@ -1520,9 +1520,12 @@
       }
       if (proc->argw)
           set_service_param(proc, PROCRUN_PARAMS_CMDARGS, proc->argw, 0, 0);
  -    if (proc->service.description)
  +    if (proc->service.description) {
           set_service_param(proc, PROCRUN_PARAMS_DESCRIPTION,
                             proc->service.description, 0, 1);
  +        set_service_param(proc, PROCRUN_PARAMS_DESCRIPTION,
  +                          proc->service.description, 0, 0);
  +    }
       if (proc->service.image)
           set_service_param(proc, PROCRUN_PARAMS_IMAGE,
                             proc->service.image, 0, 0);
  @@ -1694,9 +1697,12 @@
   
       if (proc->argw)
           set_service_param(proc, PROCRUN_PARAMS_CMDARGS, proc->argw, 0, 0);
  -    if (proc->service.description)
  +    if (proc->service.description) {
           set_service_param(proc, PROCRUN_PARAMS_DESCRIPTION,
                             proc->service.description, 0, 1);
  +        set_service_param(proc, PROCRUN_PARAMS_DESCRIPTION,
  +                          proc->service.description, 0, 1);
  +    }
       if (proc->service.image)
           set_service_param(proc, PROCRUN_PARAMS_IMAGE,
                             proc->service.image, 0, 0);
  @@ -1843,6 +1849,14 @@
               DBPRINTF0("Captured CTRL+C Event\n");
               SetEvent(g_env->m->events[0]);
               return TRUE;
  +        case CTRL_CLOSE_EVENT:
  +            DBPRINTF0("Captured CLOSE Event\n");
  +            SetEvent(g_env->m->events[0]);
  +            return TRUE;
  +        case CTRL_SHUTDOWN_EVENT:
  +            DBPRINTF0("Captured SHUTDOWN Event\n");
  +            SetEvent(g_env->m->events[0]);
  +            return TRUE;
           break;
   
      }
  @@ -1853,10 +1867,12 @@
   {
       DWORD rv;
       procrun_t *env = (procrun_t *)param;
  +    
       if (!param)
           return -1;
       rv = procrun_init_jvm(env->m);
       jni_detach(env->m);
  +
       SetEvent(env->m->events[0]);
       return rv;
   }
  @@ -1939,7 +1955,7 @@
           {NULL, NULL}
       };
   
  -    SetConsoleCtrlHandler(console_ctrl, TRUE);
  +    SetConsoleCtrlHandler((PHANDLER_ROUTINE)console_ctrl, TRUE);
       env->m->pool = pool_create();
       env->c->pool = pool_create();
       for (i = 0; i < 4; i ++) {
  @@ -1994,6 +2010,11 @@
   #ifdef _DEBUG
               debug_process(argc, argv, env->m);
   #endif
  +            if (env->m->service.description)
  +                SetConsoleTitle(env->m->service.description);
  +            else if (env->m->service.name)
  +                SetConsoleTitle(env->m->service.name);
  +
               service_main(argc, argv);
               break;
           case PROCRUN_CMD_INSTALL_SERVICE:
  @@ -2072,7 +2093,7 @@
       int rv;
       procrun_t *env = alloc_environment();
       g_proc_mode = PROCRUN_MODE_WINAPP;
  -    g_env = env;    
  +    g_env = env;
   
       rv = procrun_main(__argc, __argv, _environ, env);
   
  @@ -2088,6 +2109,7 @@
       g_proc_mode = PROCRUN_MODE_CONSOLE;
       g_env = env;
   
  +    AllocConsole();
       procrun_main(argc, argv, _environ, env);
   
       free_environment(env);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message