commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From billbar...@apache.org
Subject cvs commit: jakarta-commons/daemon/src/native/nt/procrun procrun.c
Date Thu, 18 Mar 2004 04:20:20 GMT
billbarker    2004/03/17 20:20:19

  Modified:    daemon/src/native/nt/procrun procrun.c
  Log:
  Allow the ability to pass multiple arguments to the startup and shutdown methods.
  
  Based on patch Submitted By: Ryan M. Graham <ryan@ELOQUENT-SYSTEMS.com>
  
  Revision  Changes    Path
  1.15      +31 -12    jakarta-commons/daemon/src/native/nt/procrun/procrun.c
  
  Index: procrun.c
  ===================================================================
  RCS file: /home/cvs/jakarta-commons/daemon/src/native/nt/procrun/procrun.c,v
  retrieving revision 1.14
  retrieving revision 1.15
  diff -u -r1.14 -r1.15
  --- procrun.c	11 Feb 2004 06:52:24 -0000	1.14
  +++ procrun.c	18 Mar 2004 04:20:19 -0000	1.15
  @@ -923,7 +923,11 @@
                   if (p) {
                       *p = '\0';
                       ++p;
  -                    proc->java.start_param = pool_strdup(proc->pool, p);
  +                    proc->java.start_param = pool_calloc(proc->pool, strlen(p)+2);
  +                    p = strcpy(proc->java.start_param, p);
  +                    while((p = strchr(p, ';')) != NULL) {
  +                      *p++ = '\0';
  +                    }
                   }
               }
           }
  @@ -942,7 +946,11 @@
                   if (p) {
                       *p = '\0';
                       ++p;
  -                    proc->java.stop_param = pool_strdup(proc->pool, p);
  +                    proc->java.stop_param = pool_calloc(proc->pool, strlen(p)+2);
  +                    p = strcpy(proc->java.stop_param, p);
  +                    while((p = strchr(p, ';')) != NULL) {
  +                      *p++ = '\0';
  +                    }
                   }
               }
           }
  @@ -1261,9 +1269,14 @@
   
           strclass = (*env)->FindClass(env, "java/lang/String");
           if (proc->java.stop_param) {
  -            jstring arg = (*env)->NewStringUTF(env, proc->java.stop_param);
  -            jargs = (*env)->NewObjectArray(env, 1, strclass, NULL);
  -            (*env)->SetObjectArrayElement(env, jargs, 0, arg);
  +            char opts[64];
  +            int nopts = make_array(proc->java.stop_param, opts, 60, proc);
  +            int i;
  +            jargs = (*env)->NewObjectArray(env, nopts, strclass, NULL);
  +            for(i=0; i < nopts; i++) {
  +              jstring arg = (*env)->NewStringUTF(env, opts[i]);
  +              (*env)->SetObjectArrayElement(env, jargs, i, arg);
  +            }
           }
           (*env)->CallStaticVoidMethod(env,
                                        proc->java.stop_bridge,
  @@ -1310,7 +1323,7 @@
       jclass strclass;
       jarray jargs = NULL;
       char *cp;
  -    char *opts[32];
  +    char *opts[64];
       int optn, i, err;
   
       vm_args11.version = JNI_VERSION_1_2;
  @@ -1329,7 +1342,7 @@
       if(proc->service.path != NULL) {
         SetCurrentDirectory(proc->service.path);
       }
  -    optn = make_array(proc->java.opts, opts, 30, proc);
  +    optn = make_array(proc->java.opts, opts, 60, proc);
       for (i = 0; i < optn; i++)
           options[i].optionString = remove_quotes(opts[i]);
       cp = (char *)pool_alloc(proc->pool, strlen("-Djava.class.path=") +
  @@ -1404,9 +1417,12 @@
       } 
       strclass = (*env)->FindClass(env, "java/lang/String");
       if (proc->java.start_param) {
  -        jstring arg = (*env)->NewStringUTF(env, proc->java.start_param);
  -        jargs = (*env)->NewObjectArray(env, 1, strclass, NULL);
  -        (*env)->SetObjectArrayElement(env, jargs, 0, arg);
  +        optn = make_array(proc->java.start_param, opts, 60, proc);
  +        jargs = (*env)->NewObjectArray(env, optn, strclass, NULL);
  +        for(i=0; i < optn; i++) {
  +          jstring arg = (*env)->NewStringUTF(env, opts[i]);
  +          (*env)->SetObjectArrayElement(env, jargs, i, arg);
  +        }
       }
       (*env)->CallStaticVoidMethod(env,
                                    proc->java.start_bridge,
  @@ -1701,8 +1717,11 @@
           strcat(nargw, " ");
           strcat(nargw, javaClass);
           if (javaParam) {
  -            strcat(nargw, " ");
  -            strcat(nargw, javaParam);
  +            j = make_array(javaParam, opts, 60, env->m);
  +            for(i=0; i < j; i++) {
  +              strcat(nargw, " ");
  +              strcat(nargw, opts[i]);
  +            }
           }
           env->m->argw = nargw;
           program = env->m->java.jbin;
  
  
  

---------------------------------------------------------------------
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