commons-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r921765 [1/2] - /commons/proper/daemon/trunk/src/native/unix/native/
Date Thu, 11 Mar 2010 10:03:33 GMT
Author: mturk
Date: Thu Mar 11 10:03:32 2010
New Revision: 921765

URL: http://svn.apache.org/viewvc?rev=921765&view=rev
Log:
Format the code. No functional change

Modified:
    commons/proper/daemon/trunk/src/native/unix/native/arguments.h
    commons/proper/daemon/trunk/src/native/unix/native/debug.c
    commons/proper/daemon/trunk/src/native/unix/native/debug.h
    commons/proper/daemon/trunk/src/native/unix/native/dso-dlfcn.c
    commons/proper/daemon/trunk/src/native/unix/native/dso-dyld.c
    commons/proper/daemon/trunk/src/native/unix/native/dso.h
    commons/proper/daemon/trunk/src/native/unix/native/help.c
    commons/proper/daemon/trunk/src/native/unix/native/help.h
    commons/proper/daemon/trunk/src/native/unix/native/home.c
    commons/proper/daemon/trunk/src/native/unix/native/home.h
    commons/proper/daemon/trunk/src/native/unix/native/java.c
    commons/proper/daemon/trunk/src/native/unix/native/java.h
    commons/proper/daemon/trunk/src/native/unix/native/location.c
    commons/proper/daemon/trunk/src/native/unix/native/location.h
    commons/proper/daemon/trunk/src/native/unix/native/locks.c
    commons/proper/daemon/trunk/src/native/unix/native/locks.h
    commons/proper/daemon/trunk/src/native/unix/native/replace.c
    commons/proper/daemon/trunk/src/native/unix/native/replace.h
    commons/proper/daemon/trunk/src/native/unix/native/signals.c
    commons/proper/daemon/trunk/src/native/unix/native/signals.h
    commons/proper/daemon/trunk/src/native/unix/native/version.h

Modified: commons/proper/daemon/trunk/src/native/unix/native/arguments.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/arguments.h?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/arguments.h (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/arguments.h Thu Mar 11 10:03:32 2010
@@ -1,25 +1,26 @@
-/*
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /* @version $Id$ */
 #ifndef __JSVC_ARGUMENTS_H__
 #define __JSVC_ARGUMENTS_H__
 
 #ifdef __cplusplus
-extern "C" {
+extern "C"
+{
 #endif
 
 /**
@@ -85,4 +86,5 @@ arg_data *arguments(int argc, char *argv
 #ifdef __cplusplus
 }
 #endif
-#endif /* ifndef __JSVC_ARGUMENTS_H__ */
+#endif                          /* ifndef __JSVC_ARGUMENTS_H__ */
+

Modified: commons/proper/daemon/trunk/src/native/unix/native/debug.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/debug.c?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/debug.c (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/debug.c Thu Mar 11 10:03:32 2010
@@ -1,24 +1,24 @@
-/*
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /* @version $Id$ */
 #include "jsvc.h"
 #include <sys/types.h>
 #include <unistd.h>
-#include <time.h> 
+#include <time.h>
 
 /* Wether debug is enabled or not */
 bool log_debug_flag = false;
@@ -27,44 +27,49 @@ bool log_debug_flag = false;
 char *log_prog = "jsvc";
 
 /* Dump a debug message to stderr */
-void log_debug(const char *fmt, ...) {
+void log_debug(const char *fmt, ...)
+{
     va_list ap;
     time_t now;
     struct tm *nowtm;
     char buff[80];
 
-    if (log_debug_flag==false) return;
-    if (fmt==NULL) return;
+    if (log_debug_flag == false)
+        return;
+    if (fmt == NULL)
+        return;
 
-    now = time(NULL);
+    now   = time(NULL);
     nowtm = localtime(&now);
     strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm);
 
-    va_start(ap,fmt);
-    fprintf(stderr,"%s %d %s debug: ", buff,  getpid(), log_prog);
-    vfprintf(stderr,fmt,ap);
-    fprintf(stderr,"\n");
+    va_start(ap, fmt);
+    fprintf(stderr, "%s %d %s debug: ", buff, getpid(), log_prog);
+    vfprintf(stderr, fmt, ap);
+    fprintf(stderr, "\n");
     fflush(stderr);
     va_end(ap);
 }
 
 /* Dump an error message to stderr */
-void log_error(const char *fmt, ...) {
+void log_error(const char *fmt, ...)
+{
     va_list ap;
     time_t now;
     struct tm *nowtm;
     char buff[80];
 
-    if (fmt==NULL) return;
+    if (fmt == NULL)
+        return;
 
     now = time(NULL);
     nowtm = localtime(&now);
     strftime(buff, sizeof(buff), "%d/%m/%Y %T", nowtm);
 
-    va_start(ap,fmt);
-    fprintf(stderr,"%s %d %s error: ", buff, getpid(), log_prog);
-    vfprintf(stderr,fmt,ap);
-    fprintf(stderr,"\n");
+    va_start(ap, fmt);
+    fprintf(stderr, "%s %d %s error: ", buff, getpid(), log_prog);
+    vfprintf(stderr, fmt, ap);
+    fprintf(stderr, "\n");
     fflush(stderr);
     va_end(ap);
 }

Modified: commons/proper/daemon/trunk/src/native/unix/native/debug.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/debug.h?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/debug.h (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/debug.h Thu Mar 11 10:03:32 2010
@@ -1,29 +1,29 @@
-/*
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /* @version $Id$ */
 #ifndef __JSVC_DEBUG_H__
 #define __JSVC_DEBUG_H__
 
-/**
- * Wether debugging is enabled or not.
- */
 #ifdef __cplusplus
 extern "C" {
 #endif
+/**
+ * Wether debugging is enabled or not.
+ */
 extern bool log_debug_flag;
 
 /**
@@ -55,5 +55,5 @@ void log_error(const char *fmt, ...);
 #ifdef __cplusplus
 }
 #endif
+#endif                          /* ifndef __JSVC_DEBUG_H__ */
 
-#endif /* ifndef __JSVC_DEBUG_H__ */

Modified: commons/proper/daemon/trunk/src/native/unix/native/dso-dlfcn.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/dso-dlfcn.c?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/dso-dlfcn.c (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/dso-dlfcn.c Thu Mar 11 10:03:32 2010
@@ -1,56 +1,62 @@
-/*
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /* @version $Id$ */
 #include "jsvc.h"
 
 #ifdef DSO_DLFCN
-
 #include <dlfcn.h>
-
 #ifdef OS_LINUX
-bool ld_library_path_set=false;
+bool ld_library_path_set = false;
 #endif /* ifdef OS_LINUX */
 
 /* Initialize all DSO stuff */
-bool dso_init(void) {
-    return(true);
+bool dso_init(void)
+{
+    return true;
 }
 
 /* Attempt to link a library from a specified filename */
-dso_handle dso_link(const char *path) {
-    log_debug("Attemtping to load library %s",path);
+dso_handle dso_link(const char *path)
+{
+    log_debug("Attemtping to load library %s", path);
 
-    return((void *)dlopen(path,RTLD_GLOBAL|RTLD_NOW));
+    return ((void *)dlopen(path, RTLD_GLOBAL | RTLD_NOW));
 }
 
 /* Attempt to unload a library */
-bool dso_unlink(dso_handle libr) {
-    if (dlclose(libr)==0) return(true);
-    else return(false);
+bool dso_unlink(dso_handle libr)
+{
+    if (dlclose(libr) == 0)
+        return true;
+    else
+        return false;
 }
 
 /* Get the address for a specifed symbol */
-void *dso_symbol(dso_handle hdl, const char *nam) {
-    return(dlsym(hdl,nam));
+void *dso_symbol(dso_handle hdl, const char *nam)
+{
+    return dlsym(hdl, nam);
 }
 
 /* Return the error message from dlopen */
-char *dso_error(void) {
-    return(dlerror());
+char *dso_error(void)
+{
+    return (dlerror());
 }
 
 #endif /* ifdef DSO_DLFCN */
+

Modified: commons/proper/daemon/trunk/src/native/unix/native/dso-dyld.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/dso-dyld.c?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/dso-dyld.c (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/dso-dyld.c Thu Mar 11 10:03:32 2010
@@ -21,7 +21,7 @@
 
 #include <mach-o/dyld.h>
 
-#ifdef __bool_true_false_are_defined 
+#ifdef __bool_true_false_are_defined
 /* We define these differently than stdbool.h, so ignore the defs there */
 #undef bool
 #undef true
@@ -30,111 +30,124 @@
 
 
 /* Print an error message and abort all if a specified symbol wasn't found */
-static void nosymbol(const char *s) {
-    log_error("Cannot find symbol '%s' in library",s);
+static void nosymbol(const char *s)
+{
+    log_error("Cannot find symbol '%s' in library", s);
     abort();
 }
 
 /* We found two symbols for the same name in two different modules */
-static NSModule multiple(NSSymbol s, NSModule om, NSModule nm) {
-    NSModule ret=nm;
+static NSModule multiple(NSSymbol s, NSModule om, NSModule nm)
+{
+    NSModule ret = nm;
 
     log_debug("Symbol \"%s\" found in modules \"%s\" and \"%s\" (using %s)",
-        NSNameOfSymbol(s), NSNameOfModule(om), NSNameOfModule(nm),
-        NSNameOfModule(ret));
+              NSNameOfSymbol(s), NSNameOfModule(om), NSNameOfModule(nm),
+              NSNameOfModule(ret));
 
-    return(ret);
+    return (ret);
 }
 
 /* We got an error while linking a module, and if it's not a warning we have
    to abort the whole program */
 static void linkedit(NSLinkEditErrors category, int number, const char *file,
-                     const char *message) {
+                     const char *message)
+{
     log_error("Errors during link edit of file \"%s\" (error=%d): %s", file,
-              number,message);
+              number, message);
     /* Check if this error was only a warning */
-    if (category!=NSLinkEditWarningError) {
+    if (category != NSLinkEditWarningError) {
         log_error("Cannot continue");
         abort();
     }
 }
 
 /* Initialize all DSO stuff */
-bool dso_init() {
+bool dso_init()
+{
     NSLinkEditErrorHandlers h;
 
-    h.undefined=nosymbol;
-    h.multiple=multiple;
-    h.linkEdit=linkedit;
+    h.undefined = nosymbol;
+    h.multiple = multiple;
+    h.linkEdit = linkedit;
 
     NSInstallLinkEditErrorHandlers(&h);
-    return(true);
+    return (true);
 }
 
 /* Attempt to link a library from a specified filename */
-dso_handle dso_link(const char *path) {
+dso_handle dso_link(const char *path)
+{
     /* We need to load the library publically as NSModuleFileImage is not
        yet implemented (at least for non MH_BUNDLE libraries */
-    if (NSAddLibrary(path)!=TRUE) return(NULL);
+    if (NSAddLibrary(path) != TRUE)
+        return (NULL);
     /* We need to return a non-null value, even if it has no meaning. One day
        this whole crap will be fixed */
-    return((void *)!NULL);
+    return ((void *)!NULL);
 }
 
 /* Attempt to unload a library */
-bool dso_unlink(dso_handle libr) {
+bool dso_unlink(dso_handle libr)
+{
     /* Check the handle */
-    if (libr==NULL) {
+    if (libr == NULL) {
         log_error("Attempting to unload a module without handle");
-        return(false);
+        return (false);
     }
 
     /* We don't have a module, so, we don't really have to do anything */
-    return(true);
+    return (true);
 }
 
 /* Get the address for a specifed symbol */
-void *dso_symbol(dso_handle hdl, const char *nam) {
-    NSSymbol sym=NULL;
-    NSModule mod=NULL;
-    char *und=NULL;
-    void *add=NULL;
-    int x=0;
+void *dso_symbol(dso_handle hdl, const char *nam)
+{
+    NSSymbol sym = NULL;
+    NSModule mod = NULL;
+    char *und = NULL;
+    void *add = NULL;
+    int x = 0;
 
     /* Check parameters */
-    if (hdl==NULL) {
+    if (hdl == NULL) {
         log_error("Invalid library handler specified");
-        return(NULL);
+        return (NULL);
     }
 
-    if (nam==NULL) {
+    if (nam == NULL) {
         log_error("Invalid symbol name specified");
-        return(NULL);
+        return (NULL);
     }
 
     /* Process the correct name (add a _ before the name) */
-    while (nam[x]!='\0') x++;
-    und=(char*)malloc(sizeof(char)*(x+2));
-    while(x>=0) und[x+1]=nam[x--];
-    und[0]='_';
+    while (nam[x] != '\0')
+        x++;
+    und = (char *)malloc(sizeof(char) * (x + 2));
+    while (x >= 0)
+        und[x + 1] = nam[x--];
+    und[0] = '_';
 
     /* Find the symbol */
-    sym=NSLookupAndBindSymbol(und);
+    sym = NSLookupAndBindSymbol(und);
     free(und);
-    if (sym==NULL) return(NULL);
+    if (sym == NULL)
+        return (NULL);
 
     /* Dump some debugging output since this part is shaky */
-    mod=NSModuleForSymbol(sym);
-    add=NSAddressOfSymbol(sym);
+    mod = NSModuleForSymbol(sym);
+    add = NSAddressOfSymbol(sym);
     log_debug("Symbol \"%s\" found in module \"%s\" at address \"0x%08X\"",
-              NSNameOfSymbol(sym),NSNameOfModule(mod),add);
+              NSNameOfSymbol(sym), NSNameOfModule(mod), add);
 
     /* We want to return the address of the symbol */
-    return(add);
+    return (add);
 }
+
 /* Return the error message from dlopen: Well we already print it */
-char *dso_error() {
-    return("no additional message");
+char *dso_error()
+{
+    return ("no additional message");
 }
 
 #endif /* ifdef DSO_DYLD */

Modified: commons/proper/daemon/trunk/src/native/unix/native/dso.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/dso.h?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/dso.h (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/dso.h Thu Mar 11 10:03:32 2010
@@ -1,19 +1,19 @@
-/*
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /* @version $Id$ */
 #ifndef __JSVC_DSO_H__
 #define __JSVC_DSO_H__
@@ -30,7 +30,7 @@ typedef void *dso_handle;
 
 bool dso_init(void);
 dso_handle dso_link(const char *pth);
-bool dso_unlink(dso_handle lib);
+bool  dso_unlink(dso_handle lib);
 void *dso_symbol(dso_handle lib, const char *nam);
 char *dso_error(void);
 

Modified: commons/proper/daemon/trunk/src/native/unix/native/help.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/help.c?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/help.c (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/help.c Thu Mar 11 10:03:32 2010
@@ -1,41 +1,40 @@
-/*
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /* @version $Id$ */
 #include "jsvc.h"
 
-void help(home_data *data) {
+void help(home_data *data)
+{
     int x;
 
-    printf("Usage: %s [-options] class [args...]\n",log_prog);
+    printf("Usage: %s [-options] class [args...]\n", log_prog);
     printf("\n");
     printf("Where options include:\n");
     printf("\n");
-
     printf("    -jvm <JVM name>\n");
     printf("        use a specific Java Virtual Machine. Available JVMs:\n");
     printf("           ");
-    for (x=0; x<data->jnum; x++) {
-      printf(" '%s'",PRINT_NULL(data->jvms[x]->name));
+    for (x = 0; x < data->jnum; x++) {
+        printf(" '%s'", PRINT_NULL(data->jvms[x]->name));
     }
     printf("\n");
 
     printf("    -cp / -classpath <directories and zip/jar files>\n");
     printf("        set search path for service classes and resouces\n");
-
     printf("    -home <directory>\n");
     printf("        set the path of your JDK or JRE installation (or set\n");
     printf("        the JAVA_HOME environment variable)\n");
@@ -43,56 +42,40 @@ void help(home_data *data) {
     printf("    -version\n");
     printf("        show the current Java environment version (to check\n");
     printf("        correctness of -home and -jvm. Implies -nodetach)\n");
-
     printf("    -help / -?\n");
     printf("        show this help page (implies -nodetach)\n");
-
     printf("    -nodetach\n");
     printf("        don't detach from parent process and become a daemon\n");
-
     printf("    -debug\n");
     printf("        verbosely print debugging information\n");
-
     printf("    -check\n");
     printf("        only check service (implies -nodetach)\n");
- 
     printf("    -user <user>\n");
     printf("        user used to run the daemon (defaults to current user)\n");
- 
     printf("    -verbose[:class|gc|jni]\n");
     printf("        enable verbose output\n");
- 
     printf("    -outfile </full/path/to/file>\n");
     printf("        Location for output from stdout (defaults to /dev/null)\n");
     printf("        Use the value '&2' to simulate '1>&2'\n");
-
     printf("    -errfile </full/path/to/file>\n");
     printf("        Location for output from stderr (defaults to /dev/null)\n");
     printf("        Use the value '&1' to simulate '2>&1'\n");
-
     printf("    -pidfile </full/path/to/file>\n");
     printf("        Location for output from the file containing the pid of jsvc\n");
     printf("        (defaults to /var/run/jsvc.pid)\n");
-
     printf("    -D<name>=<value>\n");
     printf("        set a Java system property\n");
-
     printf("    -X<option>\n");
     printf("        set Virtual Machine specific option\n");
-
     printf("    -procname <procname>\n");
     printf("        use the specified process name (works only for Linux)\n");
-
     printf("    -wait <waittime>\n");
     printf("        wait waittime seconds for the service to start\n");
     printf("        waittime should multiple of 10 (min=10)\n");
-
     printf("    -stop\n");
     printf("        stop the service using the file given in the -pidfile option\n");
-
     printf("    -keepstdin\n");
     printf("        does not redirect stdin to /dev/null\n");
-
     printf("\njsvc (Apache Commons Daemon) " JSVC_VERSION_STRING "\n");
     printf("Copyright (c) 1999-2010 Apache Software Foundation.\n");
 

Modified: commons/proper/daemon/trunk/src/native/unix/native/help.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/help.h?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/help.h (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/help.h Thu Mar 11 10:03:32 2010
@@ -1,19 +1,19 @@
-/*
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /* @version $Id$ */
 #ifndef __JSVC_HELP_H__
 #define __JSVC_HELP_H__

Modified: commons/proper/daemon/trunk/src/native/unix/native/home.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/home.c?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/home.c (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/home.c Thu Mar 11 10:03:32 2010
@@ -18,227 +18,248 @@
 #include "jsvc.h"
 
 /* Check if a path is a directory */
-static bool checkdir(char *path) {
+static bool checkdir(char *path)
+{
     struct stat home;
 
-    if (path==NULL) return(false);
-    if (stat(path,&home)!=0) return(false);
-    if (S_ISDIR(home.st_mode)) return(true);
-    return(false);
+    if (path == NULL)
+        return (false);
+    if (stat(path, &home) != 0)
+        return (false);
+    if (S_ISDIR(home.st_mode))
+        return (true);
+    return (false);
 }
 
 /* Check if a path is a file */
-static bool checkfile(char *path) {
+static bool checkfile(char *path)
+{
     struct stat home;
 
-    if (path==NULL) return(false);
-    if (stat(path,&home)!=0) return(false);
-    if (S_ISREG(home.st_mode)) return(true);
-    return(false);
+    if (path == NULL)
+        return (false);
+    if (stat(path, &home) != 0)
+        return (false);
+    if (S_ISREG(home.st_mode))
+        return (true);
+    return (false);
 }
 
 /* Parse a VM configuration file */
-static bool parse(home_data *data) {
-    FILE *cfgf=fopen(data->cfgf,"r");
-    char *ret=NULL, *sp;
+static bool parse(home_data *data)
+{
+    FILE *cfgf = fopen(data->cfgf, "r");
+    char *ret = NULL, *sp;
     char buf[1024];
 
-    if (cfgf==NULL) {
-      log_debug("Can't open %s\n",data->cfgf);
-      return(false);
+    if (cfgf == NULL) {
+        log_debug("Can't open %s\n", data->cfgf);
+        return (false);
     }
 
-    data->jvms=(home_jvm **)malloc(256*sizeof(home_jvm *));
+    data->jvms = (home_jvm **)malloc(256 * sizeof(home_jvm *));
 
-    while((ret=fgets(buf,1024,cfgf))!=NULL) {
-        char *tmp=strchr(ret,'#');
+    while ((ret = fgets(buf, 1024, cfgf)) != NULL) {
+        char *tmp = strchr(ret, '#');
         int pos;
 
         /* Clear the string at the first occurrence of '#' */
-        if (tmp!=NULL) tmp[0]='\0';
+        if (tmp != NULL)
+            tmp[0] = '\0';
 
         /* Trim the string (including leading '-' chars */
-        while((ret[0]==' ')||(ret[0]=='\t')||(ret[0]=='-')) ret++;
-        pos=strlen(ret);
-        while(pos>=0) {
-            if ((ret[pos]=='\r')||(ret[pos]=='\n')||(ret[pos]=='\t')||
-                (ret[pos]=='\0')||(ret[pos]==' ')) {
-                ret[pos--]='\0';
-            } else break;
+        while ((ret[0] == ' ') || (ret[0] == '\t') || (ret[0] == '-'))
+            ret++;
+        pos = strlen(ret);
+        while (pos >= 0) {
+            if ((ret[pos] == '\r') || (ret[pos] == '\n') || (ret[pos] == '\t')
+                || (ret[pos] == '\0') || (ret[pos] == ' ')) {
+                ret[pos--] = '\0';
+            }
+            else
+                break;
         }
         /* Format changed for 1.4 JVMs */
         sp = strchr(ret, ' ');
-        if(sp != NULL)
+        if (sp != NULL)
             *sp = '\0';
 
         /* Did we find something significant? */
-        if (strlen(ret)>0) {
-            char *libf=NULL;
-            int x=0;
-
-            log_debug("Found VM %s definition in configuration",ret);
-            while(location_jvm_configured[x]!=NULL) {
-                char *orig=location_jvm_configured[x];
+        if (strlen(ret) > 0) {
+            char *libf = NULL;
+            int x = 0;
+
+            log_debug("Found VM %s definition in configuration", ret);
+            while (location_jvm_configured[x] != NULL) {
+                char *orig = location_jvm_configured[x];
                 char temp[1024];
                 char repl[1024];
                 int k;
 
-                k=replace(temp,1024,orig,"$JAVA_HOME",data->path);
-                if (k!=0) {
-                    log_error("Can't replace home in VM library (%d)",k);
-                    return(false);
+                k = replace(temp, 1024, orig, "$JAVA_HOME", data->path);
+                if (k != 0) {
+                    log_error("Can't replace home in VM library (%d)", k);
+                    return (false);
                 }
-                k=replace(repl,1024,temp,"$VM_NAME",ret);
-                if (k!=0) {
-                    log_error("Can't replace name in VM library (%d)",k);
-                    return(false);
+                k = replace(repl, 1024, temp, "$VM_NAME", ret);
+                if (k != 0) {
+                    log_error("Can't replace name in VM library (%d)", k);
+                    return (false);
                 }
 
-                log_debug("Checking library %s",repl);
+                log_debug("Checking library %s", repl);
                 if (checkfile(repl)) {
-                    libf=strdup(repl);
+                    libf = strdup(repl);
                     break;
                 }
                 x++;
             }
 
-            if (libf==NULL) {
-                log_debug("Cannot locate library for VM %s (skipping)",ret);
-            } else {
-                data->jvms[data->jnum]=(home_jvm *)malloc(sizeof(home_jvm));
-                data->jvms[data->jnum]->name=strdup(ret);
-                data->jvms[data->jnum]->libr=libf;
+            if (libf == NULL) {
+                log_debug("Cannot locate library for VM %s (skipping)", ret);
+            }
+            else {
+                data->jvms[data->jnum] = (home_jvm *)malloc(sizeof(home_jvm));
+                data->jvms[data->jnum]->name = strdup(ret);
+                data->jvms[data->jnum]->libr = libf;
                 data->jnum++;
-                data->jvms[data->jnum]=NULL;
+                data->jvms[data->jnum] = NULL;
             }
         }
     }
-    return(true);
+    return (true);
 }
 
 /* Build a Java Home structure for a path */
-static home_data *build(char *path) {
-    home_data *data=NULL;
-    char *cfgf=NULL;
+static home_data *build(char *path)
+{
+    home_data *data = NULL;
+    char *cfgf = NULL;
     char buf[1024];
-    int x=0;
-    int k=0;
+    int x = 0;
+    int k = 0;
 
-    if (path==NULL) return(NULL);
+    if (path == NULL)
+        return (NULL);
 
-    log_debug("Attempting to locate Java Home in %s",path);
-    if (checkdir(path)==false) {
-        log_debug("Path %s is not a directory",path);
-        return(NULL);
-    }
-
-    while(location_jvm_cfg[x]!=NULL) {
-        if ((k=replace(buf,1024,location_jvm_cfg[x],"$JAVA_HOME",path))!=0) {
-            log_error("Error replacing values for jvm.cfg (%d)",k);
-            return(NULL);
-        }
-        log_debug("Attempting to locate VM configuration file %s",buf);
-        if(checkfile(buf)==true) {
-            log_debug("Found VM configuration file at %s",buf);
-            cfgf=strdup(buf);
+    log_debug("Attempting to locate Java Home in %s", path);
+    if (checkdir(path) == false) {
+        log_debug("Path %s is not a directory", path);
+        return (NULL);
+    }
+
+    while (location_jvm_cfg[x] != NULL) {
+        if ((k =
+             replace(buf, 1024, location_jvm_cfg[x], "$JAVA_HOME",
+                     path)) != 0) {
+            log_error("Error replacing values for jvm.cfg (%d)", k);
+            return (NULL);
+        }
+        log_debug("Attempting to locate VM configuration file %s", buf);
+        if (checkfile(buf) == true) {
+            log_debug("Found VM configuration file at %s", buf);
+            cfgf = strdup(buf);
             break;
         }
         x++;
     }
 
-    data=(home_data *)malloc(sizeof(home_data));
-    data->path=strdup(path);
-    data->cfgf=cfgf;
-    data->jvms=NULL;
-    data->jnum=0;
+    data = (home_data *)malloc(sizeof(home_data));
+    data->path = strdup(path);
+    data->cfgf = cfgf;
+    data->jvms = NULL;
+    data->jnum = 0;
 
     /* We don't have a jvm.cfg configuration file, so all we have to do is
        trying to locate the "default" Java Virtual Machine library */
-    if (cfgf==NULL) {
+    if (cfgf == NULL) {
         log_debug("VM configuration file not found");
-        x=0;
-        while(location_jvm_default[x]!=NULL) {
-            char *libr=location_jvm_default[x];
-
-            if ((k=replace(buf,1024,libr,"$JAVA_HOME",path))!=0) {
-                log_error("Error replacing values for JVM library (%d)",k);
-                return(NULL);
-            }
-            log_debug("Attempting to locate VM library %s",buf);
-            if (checkfile(buf)==true) {
-                data->jvms=(home_jvm **)malloc(2*sizeof(home_jvm *));
-                data->jvms[0]=(home_jvm *)malloc(sizeof(home_jvm));
-                data->jvms[0]->name=NULL;
-                data->jvms[0]->libr=strdup(buf);
-                data->jvms[1]=NULL;
-                data->jnum=1;
-                return(data);
+        x = 0;
+        while (location_jvm_default[x] != NULL) {
+            char *libr = location_jvm_default[x];
+
+            if ((k = replace(buf, 1024, libr, "$JAVA_HOME", path)) != 0) {
+                log_error("Error replacing values for JVM library (%d)", k);
+                return (NULL);
+            }
+            log_debug("Attempting to locate VM library %s", buf);
+            if (checkfile(buf) == true) {
+                data->jvms = (home_jvm **)malloc(2 * sizeof(home_jvm *));
+                data->jvms[0] = (home_jvm *)malloc(sizeof(home_jvm));
+                data->jvms[0]->name = NULL;
+                data->jvms[0]->libr = strdup(buf);
+                data->jvms[1] = NULL;
+                data->jnum = 1;
+                return (data);
             }
             x++;
         }
 
-        return(data);
+        return (data);
     }
 
     /* If we got here, we most definitely found a jvm.cfg file */
-    if (parse(data)==false) {
-        log_error("Cannot parse VM configuration file %s",data->cfgf);
+    if (parse(data) == false) {
+        log_error("Cannot parse VM configuration file %s", data->cfgf);
     }
 
-    return(data);
+    return (data);
 }
 
 /* Find the Java Home */
-static home_data *find(char *path) {
-    home_data *data=NULL;
-    int x=0;
+static home_data *find(char *path)
+{
+    home_data *data = NULL;
+    int x = 0;
 
-    if (path==NULL) {
+    if (path == NULL) {
         log_debug("Home not specified on command line, using environment");
-        path=getenv("JAVA_HOME");
+        path = getenv("JAVA_HOME");
     }
 
-    if (path==NULL) {
+    if (path == NULL) {
         log_debug("Home not on command line or in environment, searching");
-        while (location_home[x]!=NULL) {
-            if ((data=build(location_home[x]))!=NULL) {
-                log_debug("Java Home located in %s",data->path);
-                return(data);
+        while (location_home[x] != NULL) {
+            if ((data = build(location_home[x])) != NULL) {
+                log_debug("Java Home located in %s", data->path);
+                return (data);
             }
             x++;
         }
-    } else {
-        if ((data=build(path))!=NULL) {
-            log_debug("Java Home located in %s",data->path);
-            return(data);
+    }
+    else {
+        if ((data = build(path)) != NULL) {
+            log_debug("Java Home located in %s", data->path);
+            return (data);
         }
     }
 
-    return(NULL);
+    return (NULL);
 }
 
 /* Main entry point: locate home and dump structure */
-home_data *home(char *path) {
-    home_data *data=find(path);
-    int x=0;
+home_data *home(char *path)
+{
+    home_data *data = find(path);
+    int x = 0;
 
-    if (data==NULL) {
+    if (data == NULL) {
         log_error("Cannot locate Java Home");
-        return(NULL);
+        return (NULL);
     }
 
-    if (log_debug_flag==true) {
+    if (log_debug_flag == true) {
         log_debug("+-- DUMPING JAVA HOME STRUCTURE ------------------------");
-        log_debug("| Java Home:       \"%s\"",PRINT_NULL(data->path));
-        log_debug("| Java VM Config.: \"%s\"",PRINT_NULL(data->cfgf));
-        log_debug("| Found JVMs:      %d",data->jnum);
-        for (x=0; x<data->jnum; x++) {
-            home_jvm *jvm=data->jvms[x];
-            log_debug("| JVM Name:        \"%s\"",PRINT_NULL(jvm->name));
-            log_debug("|                  \"%s\"",PRINT_NULL(jvm->libr));
+        log_debug("| Java Home:       \"%s\"", PRINT_NULL(data->path));
+        log_debug("| Java VM Config.: \"%s\"", PRINT_NULL(data->cfgf));
+        log_debug("| Found JVMs:      %d", data->jnum);
+        for (x = 0; x < data->jnum; x++) {
+            home_jvm *jvm = data->jvms[x];
+            log_debug("| JVM Name:        \"%s\"", PRINT_NULL(jvm->name));
+            log_debug("|                  \"%s\"", PRINT_NULL(jvm->libr));
         }
         log_debug("+-------------------------------------------------------");
     }
 
-    return(data);
+    return (data);
 }

Modified: commons/proper/daemon/trunk/src/native/unix/native/home.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/home.h?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/home.h (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/home.h Thu Mar 11 10:03:32 2010
@@ -21,12 +21,14 @@
 typedef struct home_jvm home_jvm;
 typedef struct home_data home_data;
 
-struct home_jvm {
+struct home_jvm
+{
     char *name;
     char *libr;
 };
 
-struct home_data {
+struct home_data
+{
     char *path;
     char *cfgf;
     home_jvm **jvms;

Modified: commons/proper/daemon/trunk/src/native/unix/native/java.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/java.c?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/java.c (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/java.c Thu Mar 11 10:03:32 2010
@@ -1,19 +1,19 @@
-/*
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /* @version $Id$ */
 #include "jsvc.h"
 
@@ -29,101 +29,109 @@ typedef long long __int64;
 #define jsvc_xlate_from_ascii(b) _a2e(b)
 #endif
 #else
-#define jsvc_xlate_to_ascii(b) /* NOOP */
-#define jsvc_xlate_from_ascii(b) /* NOOP */
+#define jsvc_xlate_to_ascii(b)  /* NOOP */
+#define jsvc_xlate_from_ascii(b)        /* NOOP */
 #endif
 
-static JavaVM *jvm=NULL;
-static JNIEnv *env=NULL;
-static jclass cls=NULL;
+static JavaVM *jvm = NULL;
+static JNIEnv *env = NULL;
+static jclass cls  = NULL;
 
 #define FALSE 0
 #define TRUE !FALSE
 
-static void shutdown(JNIEnv *env, jobject source, jboolean reload) {
-    log_debug("Shutdown requested (reload is %d)",reload);
-    if (reload==TRUE) main_reload();
-    else main_shutdown();
+static void shutdown(JNIEnv * env, jobject source, jboolean reload)
+{
+    log_debug("Shutdown requested (reload is %d)", reload);
+    if (reload == TRUE)
+        main_reload();
+    else
+        main_shutdown();
 }
+
 /* Automatically restart when the JVM crashes */
 static void java_abort123(void)
 {
     exit(123);
 }
 
-char *java_library(arg_data *args, home_data *data) {
-    char *libf=NULL;
+char *java_library(arg_data *args, home_data *data)
+{
+    char *libf = NULL;
 
     /* Did we find ANY virtual machine? */
-    if (data->jnum==0) {
-        log_error("Cannot find any VM in Java Home %s",data->path);
-        return(NULL);
+    if (data->jnum == 0) {
+        log_error("Cannot find any VM in Java Home %s", data->path);
+        return NULL;
     }
 
     /* Select the VM */
-    if (args->name==NULL) {
-        libf=data->jvms[0]->libr;
-        log_debug("Using default JVM in %s",libf);
-    } else {
+    if (args->name == NULL) {
+        libf = data->jvms[0]->libr;
+        log_debug("Using default JVM in %s", libf);
+    }
+    else {
         int x;
-        for (x=0; x<data->jnum; x++) {
-            if (data->jvms[x]->name==NULL) continue;
-            if (strcmp(args->name,data->jvms[x]->name)==0) {
-                libf=data->jvms[x]->libr;
-                log_debug("Using specific JVM in %s",libf);
+        for (x = 0; x < data->jnum; x++) {
+            if (data->jvms[x]->name == NULL)
+                continue;
+            if (strcmp(args->name, data->jvms[x]->name) == 0) {
+                libf = data->jvms[x]->libr;
+                log_debug("Using specific JVM in %s", libf);
                 break;
             }
         }
-        if (libf==NULL) {
-            log_error("Invalid JVM name specified %s",args->name);
-            return(NULL);
+        if (libf == NULL) {
+            log_error("Invalid JVM name specified %s", args->name);
+            return NULL;
         }
     }
-    return(libf);
+    return libf;
 }
 
 /* Initialize the JVM and its environment, loading libraries and all */
-bool java_init(arg_data *args, home_data *data) {
+bool java_init(arg_data *args, home_data *data)
+{
 #ifdef OS_DARWIN
-    dso_handle apph=NULL;
+    dso_handle apph = NULL;
     char appf[1024];
     struct stat sb;
 #endif /* ifdef OS_DARWIN */
-    jint (*symb)(JavaVM **, JNIEnv **, JavaVMInitArgs *);
+    jint(*symb) (JavaVM **, JNIEnv **, JavaVMInitArgs *);
     JNINativeMethod nativemethod;
-    JavaVMOption *opt=NULL;
-    dso_handle libh=NULL;
+    JavaVMOption *opt = NULL;
+    dso_handle libh   = NULL;
     JavaVMInitArgs arg;
-    char *libf=NULL;
+    char *libf = NULL;
     jint ret;
     int x;
-    char loaderclass[]=LOADER;
-    char shutdownclass[]="shutdown";
-    char shutdownparams[]="(Z)V";
+    char loaderclass[]    = LOADER;
+    char shutdownclass[]  = "shutdown";
+    char shutdownparams[] = "(Z)V";
 
     /* Decide WHAT virtual machine we need to use */
-    libf=java_library(args,data);
-    if (libf==NULL) {
+    libf = java_library(args, data);
+    if (libf == NULL) {
         log_error("Cannot locate JVM library file");
-        return(false);
+        return false;
     }
 
     /* Initialize the DSO library */
-    if (dso_init()!=true) {
+    if (dso_init() != true) {
         log_error("Cannot initialize the dynamic library loader");
-        return(false);
+        return false;
     }
 
     /* Load the JVM library */
 #if defined(OSD_POSIX) || defined(HAVE_KAFFEVM)
 #else
-    libh=dso_link(libf);
-    if (libh==NULL) {
-        log_error("Cannot dynamically link to %s",libf);
-        log_error("%s",dso_error());
-        return(false);
+    libh = dso_link(libf);
+    if (libh == NULL) {
+        log_error("Cannot dynamically link to %s", libf);
+        log_error("%s", dso_error());
+        return false;
     }
-    log_debug("JVM library %s loaded",libf);
+    log_debug("JVM library %s loaded", libf);
 #endif
 
 #ifdef OS_DARWIN
@@ -133,62 +141,62 @@ bool java_init(arg_data *args, home_data
        before JVM 1.4.1 The first one (libappshell.dyld) contains CreateVM
        JVM 1.4.1 through 1.5.* The library name is libjvm_compat.dylib
        starting with JVM 1.6 on OS X 10.6 the library name is libverify.dylib.
-    */
-        if (replace(appf,1024,"$JAVA_HOME/../Libraries/libappshell.dylib",
-                 "$JAVA_HOME",data->path)!=0) {
+     */
+    if (replace(appf, 1024, "$JAVA_HOME/../Libraries/libappshell.dylib",
+                "$JAVA_HOME", data->path) != 0) {
         log_error("Cannot replace values in loader library");
-        return(false);
+        return false;
     }
     if (stat(appf, &sb)) {
-        if (replace(appf,1024,"$JAVA_HOME/../Libraries/libjvm_compat.dylib",
-                    "$JAVA_HOME",data->path)!=0) {
+        if (replace(appf, 1024, "$JAVA_HOME/../Libraries/libjvm_compat.dylib",
+                    "$JAVA_HOME", data->path) != 0) {
             log_error("Cannot replace values in loader library");
-            return(false);
+            return false;
         }
     }
     if (stat(appf, &sb)) {
-        if (replace(appf,1024,"$JAVA_HOME/../Libraries/libverify.dylib",
-                    "$JAVA_HOME",data->path)!=0) {
+        if (replace(appf, 1024, "$JAVA_HOME/../Libraries/libverify.dylib",
+                    "$JAVA_HOME", data->path) != 0) {
             log_error("Cannot replace values in loader library");
-            return(false);
+            return false;
         }
     }
-    apph=dso_link(appf);
-    if (apph==NULL) {
-        log_error("Cannot load required shell library %s",appf);
-        return(false);
+    apph = dso_link(appf);
+    if (apph == NULL) {
+        log_error("Cannot load required shell library %s", appf);
+        return false;
     }
-    log_debug("Shell library %s loaded",appf);
+    log_debug("Shell library %s loaded", appf);
 #endif /* ifdef OS_DARWIN */
 #if defined(OSD_POSIX) || defined(HAVE_KAFFEVM)
     /* BS2000 and kaffe does not allow to call JNI_CreateJavaVM indirectly */
 #else
-    symb=dso_symbol(libh,"JNI_CreateJavaVM");
-    if (symb==NULL) {
+    symb = dso_symbol(libh, "JNI_CreateJavaVM");
+    if (symb == NULL) {
 #ifdef OS_DARWIN
-        symb=dso_symbol(apph,"JNI_CreateJavaVM");
-        if (symb==NULL) {
+        symb = dso_symbol(apph, "JNI_CreateJavaVM");
+        if (symb == NULL) {
 #endif /* ifdef OS_DARWIN */
             log_error("Cannot find JVM library entry point");
-            return(false);
+            return false;
 #ifdef OS_DARWIN
         }
 #endif /* ifdef OS_DARWIN */
     }
-    log_debug("JVM library entry point found (0x%08X)",symb);
+    log_debug("JVM library entry point found (0x%08X)", symb);
 #endif
 
     /* Prepare the VM initialization arguments */
-    
+
     /*
-        Mac OS X Java will load JVM 1.3.1 instead of 1.4.2 if JNI_VERSION_1_2
-        is specified. So use JNI_VERSION_1_4 if we can.
-    */
-    #if defined(JNI_VERSION_1_4)
-        arg.version=JNI_VERSION_1_4;
-    #else
-        arg.version=JNI_VERSION_1_2;
-    #endif
+     * Mac OS X Java will load JVM 1.3.1 instead of 1.4.2 if JNI_VERSION_1_2
+     * is specified. So use JNI_VERSION_1_4 if we can.
+     */
+#if defined(JNI_VERSION_1_4)
+    arg.version = JNI_VERSION_1_4;
+#else
+    arg.version = JNI_VERSION_1_2;
+#endif
 #if defined(OSD_POSIX) || defined(HAVE_KAFFEVM)
 
 #if defined(HAVE_KAFFEVM)
@@ -196,36 +204,36 @@ bool java_init(arg_data *args, home_data
     arg.version = JNI_VERSION_1_4;
 #endif
 
-    if (JNI_GetDefaultJavaVMInitArgs(&arg)<0) {
+    if (JNI_GetDefaultJavaVMInitArgs(&arg) < 0) {
         log_error("Cannot init default JVM default args");
-        return(false);
+        return false;
     }
 #endif
-    arg.ignoreUnrecognized=FALSE;
-    arg.nOptions=args->onum;
-    arg.nOptions++; /* Add abort code */
-    opt=(JavaVMOption *)malloc(arg.nOptions*sizeof(JavaVMOption));
-    for (x=0; x<args->onum; x++) {
-        opt[x].optionString=strdup(args->opts[x]);
+    arg.ignoreUnrecognized = FALSE;
+    arg.nOptions = args->onum;
+    arg.nOptions++;             /* Add abort code */
+    opt = (JavaVMOption *) malloc(arg.nOptions * sizeof(JavaVMOption));
+    for (x = 0; x < args->onum; x++) {
+        opt[x].optionString = strdup(args->opts[x]);
         jsvc_xlate_to_ascii(opt[x].optionString);
-        opt[x].extraInfo=NULL;
+        opt[x].extraInfo = NULL;
     }
-    opt[x].optionString=strdup("abort");
+    opt[x].optionString = strdup("abort");
     jsvc_xlate_to_ascii(opt[x].optionString);
-    opt[x].extraInfo=java_abort123;
-    arg.options=opt;
+    opt[x].extraInfo = java_abort123;
+    arg.options = opt;
 
     /* Do some debugging */
-    if (log_debug_flag==true) {
+    if (log_debug_flag == true) {
         log_debug("+-- DUMPING JAVA VM CREATION ARGUMENTS -----------------");
-        log_debug("| Version:                       %#08x",arg.version);
+        log_debug("| Version:                       %#08x", arg.version);
         log_debug("| Ignore Unrecognized Arguments: %s",
-                  arg.ignoreUnrecognized==TRUE?"True":"False");
-        log_debug("| Extra options:                 %d",arg.nOptions);
+                  arg.ignoreUnrecognized == TRUE ? "True" : "False");
+        log_debug("| Extra options:                 %d", arg.nOptions);
 
-        for (x=0; x<args->onum; x++) {
+        for (x = 0; x < args->onum; x++) {
             jsvc_xlate_from_ascii(opt[x].optionString);
-            log_debug("|   \"%s\" (0x%08x)",opt[x].optionString,
+            log_debug("|   \"%s\" (0x%08x)", opt[x].optionString,
                       opt[x].extraInfo);
             jsvc_xlate_to_ascii(opt[x].optionString);
         }
@@ -234,295 +242,306 @@ bool java_init(arg_data *args, home_data
 
     /* And finally create the Java VM */
 #if defined(OSD_POSIX) || defined(HAVE_KAFFEVM)
-    ret=JNI_CreateJavaVM(&jvm, &env, &arg);
+    ret = JNI_CreateJavaVM(&jvm, &env, &arg);
 #else
-    ret=(*symb)(&jvm, &env, &arg);
+    ret = (*symb) (&jvm, &env, &arg);
 #endif
-    if (ret<0) {
+    if (ret < 0) {
         log_error("Cannot create Java VM");
-        return(false);
+        return false;
     }
     log_debug("Java VM created successfully");
 
     jsvc_xlate_to_ascii(loaderclass);
-    cls=(*env)->FindClass(env,loaderclass);
+    cls = (*env)->FindClass(env, loaderclass);
     jsvc_xlate_from_ascii(loaderclass);
-    if (cls==NULL) {
-        log_error("Cannot find daemon loader %s",loaderclass);
-        return(false);
+    if (cls == NULL) {
+        log_error("Cannot find daemon loader %s", loaderclass);
+        return false;
     }
-    log_debug("Class %s found",loaderclass);
+    log_debug("Class %s found", loaderclass);
 
 #if defined(HAVE_SABLEVM)
     log_debug("sableVM doesn't support RegisterNatives");
 #else
     jsvc_xlate_to_ascii(shutdownclass);
-    nativemethod.name=shutdownclass;
+    nativemethod.name = shutdownclass;
     jsvc_xlate_to_ascii(shutdownparams);
-    nativemethod.signature=shutdownparams;
-    nativemethod.fnPtr=shutdown;
-    if((*env)->RegisterNatives(env,cls,&nativemethod,1)!=0) {
+    nativemethod.signature = shutdownparams;
+    nativemethod.fnPtr = shutdown;
+    if ((*env)->RegisterNatives(env, cls, &nativemethod, 1) != 0) {
         log_error("Cannot register native methods");
-        return(false);
+        return false;
     }
     log_debug("Native methods registered");
 #endif
 
-    return(true);
+    return true;
 }
 
 /* Destroy the Java VM */
-bool JVM_destroy(int exit) {
-    jclass system=NULL;
+bool JVM_destroy(int exit)
+{
+    jclass system = NULL;
     jmethodID method;
-    char System[]="java/lang/System";
-    char exitclass[]="exit";
-    char exitparams[]="(I)V"; 
+    char System[] = "java/lang/System";
+    char exitclass[] = "exit";
+    char exitparams[] = "(I)V";
 
-    jsvc_xlate_to_ascii(System); 
-    system=(*env)->FindClass(env,System);
+    jsvc_xlate_to_ascii(System);
+    system = (*env)->FindClass(env, System);
     jsvc_xlate_from_ascii(System);
-    if (system==NULL) {
-        log_error("Cannot find class %s",System);
-        return(false);
+    if (system == NULL) {
+        log_error("Cannot find class %s", System);
+        return false;
     }
 
     jsvc_xlate_to_ascii(exitclass);
     jsvc_xlate_to_ascii(exitparams);
-    method=(*env)->GetStaticMethodID(env,system,exitclass,exitparams);
-    if (method==NULL) {
+    method = (*env)->GetStaticMethodID(env, system, exitclass, exitparams);
+    if (method == NULL) {
         log_error("Cannot find \"System.exit(int)\" entry point");
-        return(false);
+        return false;
     }
 
-    log_debug("Calling System.exit(%d)",exit);
-    (*env)->CallStaticVoidMethod(env,system,method,(jint)exit);
+    log_debug("Calling System.exit(%d)", exit);
+    (*env)->CallStaticVoidMethod(env, system, method, (jint) exit);
 
     /* We shouldn't get here, but just in case... */
     log_debug("Destroying the Java VM");
-    if ((*jvm)->DestroyJavaVM(jvm)!=0) return(false);
+    if ((*jvm)->DestroyJavaVM(jvm) != 0)
+        return false;
     log_debug("Java VM destroyed");
-    return(true);
+    return true;
 }
 
 /* Call the load method in our DaemonLoader class */
-bool java_load(arg_data *args) {
-    jclass stringClass=NULL;
-    jstring className=NULL;
-    jstring currentArgument=NULL;
-    jobjectArray stringArray=NULL;
-    jmethodID method=NULL;
-    jboolean ret=FALSE;
+bool java_load(arg_data *args)
+{
+    jclass stringClass       = NULL;
+    jstring className        = NULL;
+    jstring currentArgument  = NULL;
+    jobjectArray stringArray = NULL;
+    jmethodID method         = NULL;
+    jboolean ret             = FALSE;
     int x;
-    char lang[]="java/lang/String";
-    char load[]="load";
-    char loadparams[]="(Ljava/lang/String;[Ljava/lang/String;)Z";
+    char lang[] = "java/lang/String";
+    char load[] = "load";
+    char loadparams[] = "(Ljava/lang/String;[Ljava/lang/String;)Z";
 
     jsvc_xlate_to_ascii(args->clas);
-    className=(*env)->NewStringUTF(env,args->clas);
+    className = (*env)->NewStringUTF(env, args->clas);
     jsvc_xlate_from_ascii(args->clas);
-    if (className==NULL) {
+    if (className == NULL) {
         log_error("Cannot create string for class name");
-        return(false);
+        return false;
     }
 
     jsvc_xlate_to_ascii(lang);
-    stringClass=(*env)->FindClass(env,lang);
+    stringClass = (*env)->FindClass(env, lang);
     jsvc_xlate_from_ascii(lang);
-    if (stringClass==NULL) {
+    if (stringClass == NULL) {
         log_error("Cannot find class java/lang/String");
-        return(false);
+        return false;
     }
 
-    stringArray=(*env)->NewObjectArray(env,args->anum,stringClass,NULL);
-    if (stringArray==NULL) {
+    stringArray = (*env)->NewObjectArray(env, args->anum, stringClass, NULL);
+    if (stringArray == NULL) {
         log_error("Cannot create arguments array");
-        return(false);
+        return false;
     }
 
-    for (x=0; x<args->anum; x++) {
+    for (x = 0; x < args->anum; x++) {
         jsvc_xlate_to_ascii(args->args[x]);
-        currentArgument=(*env)->NewStringUTF(env,args->args[x]);
+        currentArgument = (*env)->NewStringUTF(env, args->args[x]);
         jsvc_xlate_from_ascii(args->args[x]);
-        if (currentArgument==NULL) {
-            log_error("Cannot create string for argument %s",args->args[x]);
-            return(false);
+        if (currentArgument == NULL) {
+            log_error("Cannot create string for argument %s", args->args[x]);
+            return false;
         }
-        (*env)->SetObjectArrayElement(env,stringArray,x,currentArgument);
+        (*env)->SetObjectArrayElement(env, stringArray, x, currentArgument);
     }
 
     jsvc_xlate_to_ascii(load);
     jsvc_xlate_to_ascii(loadparams);
-    method=(*env)->GetStaticMethodID(env,cls,load,loadparams);
-    if (method==NULL) {
+    method = (*env)->GetStaticMethodID(env, cls, load, loadparams);
+    if (method == NULL) {
         log_error("Cannot find Daemon Loader \"load\" entry point");
-        return(false);
+        return false;
     }
 
     log_debug("Daemon loading...");
-    ret=(*env)->CallStaticBooleanMethod(env,cls,method,className,stringArray);
-    if (ret==FALSE) {
+    ret = (*env)->CallStaticBooleanMethod(env, cls, method, className,
+                                          stringArray);
+    if (ret == FALSE) {
         log_error("Cannot load daemon");
-        return(false);
+        return false;
     }
 
     log_debug("Daemon loaded successfully");
-    return(true);
+    return true;
 }
 
 /* Call the start method in our daemon loader */
-bool java_start(void) {
+bool java_start(void)
+{
     jmethodID method;
     jboolean ret;
-    char start[]="start";
-    char startparams[]="()Z";
+    char start[] = "start";
+    char startparams[] = "()Z";
 
     jsvc_xlate_to_ascii(start);
-    jsvc_xlate_to_ascii(startparams); 
-    method=(*env)->GetStaticMethodID(env,cls,start,startparams);
-    if (method==NULL) {
+    jsvc_xlate_to_ascii(startparams);
+    method = (*env)->GetStaticMethodID(env, cls, start, startparams);
+    if (method == NULL) {
         log_error("Cannot find Daemon Loader \"start\" entry point");
-        return(false);
+        return false;
     }
 
-    ret=(*env)->CallStaticBooleanMethod(env,cls,method);
-    if (ret==FALSE) {
+    ret = (*env)->CallStaticBooleanMethod(env, cls, method);
+    if (ret == FALSE) {
         log_error("Cannot start daemon");
-        return(false);
+        return false;
     }
 
     log_debug("Daemon started successfully");
-    return(true);
+    return true;
 }
 
 /*
  * call the java sleep to prevent problems with threads
  */
-void java_sleep(int wait) {
+void java_sleep(int wait)
+{
     jclass clsThread;
     jmethodID method;
-    char jsleep[]="sleep";
-    char jsleepparams[]="(J)V";
-    char jthread[]="java/lang/Thread"; 
- 
+    char jsleep[] = "sleep";
+    char jsleepparams[] = "(J)V";
+    char jthread[] = "java/lang/Thread";
+
     jsvc_xlate_to_ascii(jsleep);
     jsvc_xlate_to_ascii(jsleepparams);
     jsvc_xlate_to_ascii(jthread);
 
-    clsThread = (*env)->FindClass(env,jthread);
-    if (clsThread==NULL) {
+    clsThread = (*env)->FindClass(env, jthread);
+    if (clsThread == NULL) {
         log_error("Cannot find java/lang/Thread class");
         return;
     }
-    method=(*env)->GetStaticMethodID(env,clsThread,jsleep,jsleepparams);
-    if (method==NULL) {
+    method = (*env)->GetStaticMethodID(env, clsThread, jsleep, jsleepparams);
+    if (method == NULL) {
         log_error("Cannot found the sleep entry point");
         return;
     }
- 
-    (*env)->CallStaticVoidMethod(env,clsThread,method,(jlong)wait*1000);
+
+    (*env)->CallStaticVoidMethod(env, clsThread, method, (jlong) wait * 1000);
 }
 
 /* Call the stop method in our daemon loader */
-bool java_stop(void) {
+bool java_stop(void)
+{
     jmethodID method;
     jboolean ret;
-    char stop[]="stop";
-    char stopparams[]="()Z";
+    char stop[] = "stop";
+    char stopparams[] = "()Z";
 
     jsvc_xlate_to_ascii(stop);
-    jsvc_xlate_to_ascii(stopparams); 
-    method=(*env)->GetStaticMethodID(env,cls,stop,stopparams);
-    if (method==NULL) {
+    jsvc_xlate_to_ascii(stopparams);
+    method = (*env)->GetStaticMethodID(env, cls, stop, stopparams);
+    if (method == NULL) {
         log_error("Cannot found Daemon Loader \"stop\" entry point");
-        return(false);
+        return false;
     }
 
-    ret=(*env)->CallStaticBooleanMethod(env,cls,method);
-    if (ret==FALSE) {
+    ret = (*env)->CallStaticBooleanMethod(env, cls, method);
+    if (ret == FALSE) {
         log_error("Cannot stop daemon");
-        return(false);
+        return false;
     }
 
     log_debug("Daemon stopped successfully");
-    return(true);
+    return true;
 }
 
 /* Call the version method in our daemon loader */
-bool java_version(void) {
+bool java_version(void)
+{
     jmethodID method;
-    char version[]="version";
-    char versionparams[]="()Z";
+    char version[] = "version";
+    char versionparams[] = "()Z";
 
     jsvc_xlate_to_ascii(version);
-    jsvc_xlate_to_ascii(versionparams); 
-    method=(*env)->GetStaticMethodID(env,cls,version,versionparams);
-    if (method==NULL) {
+    jsvc_xlate_to_ascii(versionparams);
+    method = (*env)->GetStaticMethodID(env, cls, version, versionparams);
+    if (method == NULL) {
         log_error("Cannot found Daemon Loader \"version\" entry point");
-        return(false);
+        return false;
     }
 
-    (*env)->CallStaticVoidMethod(env,cls,method);
-    return(true);
+    (*env)->CallStaticVoidMethod(env, cls, method);
+    return true;
 }
 
 /* Call the check method in our DaemonLoader class */
-bool java_check(arg_data *args) {
-    jstring className=NULL;
-    jmethodID method=NULL;
-    jboolean ret=FALSE;
-    char check[]="check";
-    char checkparams[]="(Ljava/lang/String;)Z";
+bool java_check(arg_data *args)
+{
+    jstring className = NULL;
+    jmethodID method = NULL;
+    jboolean ret = FALSE;
+    char check[] = "check";
+    char checkparams[] = "(Ljava/lang/String;)Z";
 
     log_debug("Checking daemon");
 
     jsvc_xlate_to_ascii(args->clas);
-    className=(*env)->NewStringUTF(env,args->clas);
+    className = (*env)->NewStringUTF(env, args->clas);
     jsvc_xlate_from_ascii(args->clas);
-    if (className==NULL) {
+    if (className == NULL) {
         log_error("Cannot create string for class name");
-        return(false);
+        return false;
     }
 
     jsvc_xlate_to_ascii(check);
     jsvc_xlate_to_ascii(checkparams);
-    method=(*env)->GetStaticMethodID(env,cls,check,checkparams);
-    if (method==NULL) {
+    method = (*env)->GetStaticMethodID(env, cls, check, checkparams);
+    if (method == NULL) {
         log_error("Cannot found Daemon Loader \"check\" entry point");
-        return(false);
+        return false;
     }
 
-    ret=(*env)->CallStaticBooleanMethod(env,cls,method,className);
-    if (ret==FALSE) {
-        log_error("An error was detected checking the %s daemon",args->clas);
-        return(false);
+    ret = (*env)->CallStaticBooleanMethod(env, cls, method, className);
+    if (ret == FALSE) {
+        log_error("An error was detected checking the %s daemon", args->clas);
+        return false;
     }
 
     log_debug("Daemon checked successfully");
-    return(true);
+    return true;
 }
 
 /* Call the destroy method in our daemon loader */
-bool java_destroy(void) {
+bool java_destroy(void)
+{
     jmethodID method;
     jboolean ret;
-    char destroy[]="destroy";
-    char destroyparams[]="()Z";
+    char destroy[] = "destroy";
+    char destroyparams[] = "()Z";
 
     jsvc_xlate_to_ascii(destroy);
-    jsvc_xlate_to_ascii(destroyparams); 
-    method=(*env)->GetStaticMethodID(env,cls,destroy,destroyparams);
-    if (method==NULL) {
+    jsvc_xlate_to_ascii(destroyparams);
+    method = (*env)->GetStaticMethodID(env, cls, destroy, destroyparams);
+    if (method == NULL) {
         log_error("Cannot found Daemon Loader \"destroy\" entry point");
-        return(false);
+        return false;
     }
 
-    ret=(*env)->CallStaticBooleanMethod(env,cls,method);
-    if (ret==FALSE) {
+    ret = (*env)->CallStaticBooleanMethod(env, cls, method);
+    if (ret == FALSE) {
         log_error("Cannot destroy daemon");
-        return(false);
+        return false;
     }
 
     log_debug("Daemon destroyed successfully");
-    return(true);
+    return true;
 }
+

Modified: commons/proper/daemon/trunk/src/native/unix/native/java.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/java.h?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/java.h (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/java.h Thu Mar 11 10:03:32 2010
@@ -1,19 +1,19 @@
-/*
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /* @version $Id$ */
 #ifndef __JSVC_JAVA_H__
 #define __JSVC_JAVA_H__

Modified: commons/proper/daemon/trunk/src/native/unix/native/location.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/location.c?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/location.c (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/location.c Thu Mar 11 10:03:32 2010
@@ -1,31 +1,33 @@
-/*
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /* @version $Id$ */
 #include "jsvc.h"
 
 /* Locations of various JVM files. We have to deal with all this madness since
-   we're not distributed togheter (yet!) with an official VM distribution. All
-   this CRAP needs improvement, and based on the observation of default
-   distributions of VMs and OSes. If it doesn't work for you, please report
-   your VM layout (ls -laR) and system details (build/config.guess) so that we
-   can improve the search algorithms. */
+ * we're not distributed togheter (yet!) with an official VM distribution. All
+ * this CRAP needs improvement, and based on the observation of default
+ * distributions of VMs and OSes. If it doesn't work for you, please report
+ * your VM layout (ls -laR) and system details (build/config.guess) so that we
+ * can improve the search algorithms.
+ */
 
 /* If JAVA_HOME is not defined we search this list of paths (OS-dependant)
-   to find the default location of the JVM. */
+ * to find the default location of the JVM.
+ */
 char *location_home[] = {
 #if defined(OS_DARWIN)
     "/System/Library/Frameworks/JavaVM.framework/Home",
@@ -49,45 +51,48 @@ char *location_home[] = {
 };
 
 /* The jvm.cfg file defines the VMs available for invocation. So far, on all
-   all systems I've seen it's in $JAVA_HOME/lib. If this file is not found,
-   then the "default" VMs (from location_jvm_default) is searched, otherwise,
-   we're going to look thru the "configured" VMs (from lod_cfgvm) lying
-   somewhere around JAVA_HOME. (Only two, I'm happy) */
+ * all systems I've seen it's in $JAVA_HOME/lib. If this file is not found,
+ * then the "default" VMs (from location_jvm_default) is searched, otherwise,
+ * we're going to look thru the "configured" VMs (from lod_cfgvm) lying
+ * somewhere around JAVA_HOME. (Only two, I'm happy)
+ */
 char *location_jvm_cfg[] = {
-    "$JAVA_HOME/jre/lib/jvm.cfg", /* JDK */
-    "$JAVA_HOME/lib/jvm.cfg",     /* JRE */
-    "$JAVA_HOME/jre/lib/" CPU "/jvm.cfg", /* JDK */
-    "$JAVA_HOME/lib/" CPU "/jvm.cfg",     /* JRE */
+    "$JAVA_HOME/jre/lib/jvm.cfg",           /* JDK */
+    "$JAVA_HOME/lib/jvm.cfg",               /* JRE */
+    "$JAVA_HOME/jre/lib/" CPU "/jvm.cfg",   /* JDK */
+    "$JAVA_HOME/lib/" CPU "/jvm.cfg",       /* JRE */
     NULL,
 };
 
 /* This is the list of "defaults" VM (searched when jvm.cfg is not found, as
-   in the case of most JDKs 1.2.2 */
+ * in the case of most JDKs 1.2.2
+ */
 char *location_jvm_default[] = {
 #if defined(OS_DARWIN)
     "$JAVA_HOME/../Libraries/libjvm.dylib",
 #elif defined(OS_CYGWIN)
-    "$JAVA_HOME/jre/bin/classic/jvm.dll",           /* Sun JDK 1.3 */
-    "$JAVA_HOME/jre/bin/client/jvm.dll",            /* Sun JDK 1.4 */
+    "$JAVA_HOME/jre/bin/classic/jvm.dll",               /* Sun JDK 1.3 */
+    "$JAVA_HOME/jre/bin/client/jvm.dll",                /* Sun JDK 1.4 */
 #elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD) || defined(OS_SYSV) || defined(OS_FREEBSD) || defined(OS_TRU64)
 #if defined(HAVE_SABLEVM)
-     "$JAVA_HOME/lib/libsablevm.so",                /* sableVM */
+    "$JAVA_HOME/lib/libsablevm.so",                     /* sableVM */
 #endif
 #if defined(HAVE_KAFFEVM)
-     "$JAVA_HOME/jre/lib/" CPU "/libkaffevm.so",    /* kaffe */
+    "$JAVA_HOME/jre/lib/" CPU "/libkaffevm.so",         /* kaffe */
 #endif
-    "$JAVA_HOME/jre/lib/" CPU "/classic/libjvm.so", /* Sun JDK 1.2 */
-    "$JAVA_HOME/jre/lib/" CPU "/client/libjvm.so",  /* Sun JDK 1.3 */
-    "$JAVA_HOME/jre/lib/" CPU "/libjvm.so",         /* Sun JDK */
-    "$JAVA_HOME/lib/" CPU "/classic/libjvm.so",     /* Sun JRE 1.2 */
-    "$JAVA_HOME/lib/" CPU "/client/libjvm.so",      /* Sun JRE 1.3 */
-    "$JAVA_HOME/lib/" CPU "/libjvm.so",             /* Sun JRE */
-    "$JAVA_HOME/jre/bin/" CPU "/classic/libjvm.so", /* IBM JDK 1.3 */
-    "$JAVA_HOME/jre/bin/" CPU "/libjvm.so",         /* IBM JDK */
-    "$JAVA_HOME/bin/" CPU "/classic/libjvm.so",     /* IBM JRE 1.3 */
-    "$JAVA_HOME/bin/" CPU "/libjvm.so",             /* IBM JRE */
+    "$JAVA_HOME/jre/lib/" CPU "/classic/libjvm.so",     /* Sun JDK 1.2 */
+    "$JAVA_HOME/jre/lib/" CPU "/client/libjvm.so",      /* Sun JDK 1.3 */
+    "$JAVA_HOME/jre/lib/" CPU "/libjvm.so",             /* Sun JDK */
+    "$JAVA_HOME/lib/" CPU "/classic/libjvm.so",         /* Sun JRE 1.2 */
+    "$JAVA_HOME/lib/" CPU "/client/libjvm.so",          /* Sun JRE 1.3 */
+    "$JAVA_HOME/lib/" CPU "/libjvm.so",                 /* Sun JRE */
+    "$JAVA_HOME/jre/bin/" CPU "/classic/libjvm.so",     /* IBM JDK 1.3 */
+    "$JAVA_HOME/jre/bin/" CPU "/libjvm.so",             /* IBM JDK */
+    "$JAVA_HOME/bin/" CPU "/classic/libjvm.so",         /* IBM JRE 1.3 */
+    "$JAVA_HOME/bin/" CPU "/libjvm.so",                 /* IBM JRE */
     /* Those are "weirdos: if we got here, we're probably in troubles and
-       we're not going to find anything, but hope never dies... */
+     *  we're not going to find anything, but hope never dies...
+     */
     "$JAVA_HOME/jre/lib/" CPU "/classic/green_threads/libjvm.so",
 #if defined(OSD_POSIX)
     "$JAVA_HOME/lib/s390/client/green_threads/libjvm.so",
@@ -115,22 +120,23 @@ char *location_jvm_default[] = {
     "$JAVA_HOME/jre/lib/" CPU "/hotspot/libjvm.sl",
     "$JAVA_HOME/jre/lib/" CPU "/classic/libjvm.sl",
 #endif
-    "/usr/lib/libgcj.so.7", /* gcc java libraries */
+    "/usr/lib/libgcj.so.7",     /* gcc java libraries */
     "/usr/lib/libgcj.so.6",
     NULL,
 };
 
 /* This is the list of "configured" VM (searched when jvm.cfg is found, as
-   in the case of most JDKs 1.3 (not IBM, for example), way easier than
-   before, and lovely, indeed... */
+ * in the case of most JDKs 1.3 (not IBM, for example), way easier than
+ * before, and lovely, indeed...
+ */
 char *location_jvm_configured[] = {
 #if defined(OS_DARWIN)
     "$JAVA_HOME/../Libraries/lib$VM_NAME.dylib",
 #elif defined(OS_CYGWIN)
-    "$JAVA_HOME/jre/bin/$VM_NAME/jvm.dll",          /* Sun JDK 1.3 */
+    "$JAVA_HOME/jre/bin/$VM_NAME/jvm.dll",              /* Sun JDK 1.3 */
 #elif defined(OS_LINUX) || defined(OS_SOLARIS) || defined(OS_BSD) || defined(OS_FREEBSD) || defined(OS_TRU64)
-    "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/libjvm.so",/* Sun JDK 1.3 */
-    "$JAVA_HOME/lib/" CPU "/$VM_NAME/libjvm.so",    /* Sun JRE 1.3 */
+    "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/libjvm.so",    /* Sun JDK 1.3 */
+    "$JAVA_HOME/lib/" CPU "/$VM_NAME/libjvm.so",        /* Sun JRE 1.3 */
 #elif defined(OS_HPUX)
     "$JAVA_HOME/jre/lib/" CPU "/$VM_NAME/libjvm.sl",
     "$JAVA_HOME/lib/" CPU "/$VM_NAME/libjvm.sl",
@@ -142,3 +148,4 @@ char *location_jvm_configured[] = {
 #endif
     NULL,
 };
+

Modified: commons/proper/daemon/trunk/src/native/unix/native/location.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/location.h?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/location.h (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/location.h Thu Mar 11 10:03:32 2010
@@ -1,19 +1,19 @@
-/*
-   Licensed to the Apache Software Foundation (ASF) under one or more
-   contributor license agreements.  See the NOTICE file distributed with
-   this work for additional information regarding copyright ownership.
-   The ASF licenses this file to You under the Apache License, Version 2.0
-   (the "License"); you may not use this file except in compliance with
-   the License.  You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /* @version $Id$ */
 #ifndef __JSVC_LOCATION_H__
 #define __JSVC_LOCATION_H__

Modified: commons/proper/daemon/trunk/src/native/unix/native/locks.c
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/locks.c?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/locks.c (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/locks.c Thu Mar 11 10:03:32 2010
@@ -1,19 +1,20 @@
-/*
-   Copyright 2001-2004 The Apache Software Foundation.
- 
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
-/* @version $Id$ */
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/* @version $Id: java.c 909069 2010-02-11 16:43:36Z mturk $ */
 
 /*
  * as Cygwin does not support lockf, jsvc uses fcntl to emulate it.
@@ -30,13 +31,13 @@ int lockf(int fildes, int function, off_
     struct flock buf;
 
     switch (function) {
-    case F_LOCK:
-        buf.l_type = F_WRLCK;
+        case F_LOCK:
+            buf.l_type = F_WRLCK;
         break;
-    case F_ULOCK:
-        buf.l_type = F_UNLCK;
+        case F_ULOCK:
+            buf.l_type = F_UNLCK;
         break;
-    default:
+        default:
         return -1;
     }
     buf.l_whence = 0;
@@ -47,3 +48,4 @@ int lockf(int fildes, int function, off_
 }
 
 #endif
+

Modified: commons/proper/daemon/trunk/src/native/unix/native/locks.h
URL: http://svn.apache.org/viewvc/commons/proper/daemon/trunk/src/native/unix/native/locks.h?rev=921765&r1=921764&r2=921765&view=diff
==============================================================================
--- commons/proper/daemon/trunk/src/native/unix/native/locks.h (original)
+++ commons/proper/daemon/trunk/src/native/unix/native/locks.h Thu Mar 11 10:03:32 2010
@@ -1,18 +1,19 @@
-/*
-   Copyright 2001-2004 The Apache Software Foundation.
- 
-   Licensed under the Apache License, Version 2.0 (the "License");
-   you may not use this file except in compliance with the License.
-   You may obtain a copy of the License at
- 
-       http://www.apache.org/licenses/LICENSE-2.0
- 
-   Unless required by applicable law or agreed to in writing, software
-   distributed under the License is distributed on an "AS IS" BASIS,
-   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-   See the License for the specific language governing permissions and
-   limitations under the License.
-*/
+/* Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
 /* @version $Id$ */
 #ifndef __JSVC_LOCKS_H__
 #define __JSVC_LOCKS_H__
@@ -22,8 +23,8 @@
  */
 #ifdef OS_CYGWIN
 
-#define F_ULOCK 0       /* Unlock a previously locked region */
-#define F_LOCK  1       /* Lock a region for exclusive use */
+#define F_ULOCK 0               /* Unlock a previously locked region */
+#define F_LOCK  1               /* Lock a region for exclusive use */
 
 /*
  * allow a file to be locked



Mime
View raw message