You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by na...@apache.org on 2006/02/07 09:32:24 UTC

svn commit: r375546 - in /webservices/axis2/trunk/c/modules: core/clientapi/ core/transport/http/server/ platforms/unix/ platforms/windows/

Author: nandika
Date: Tue Feb  7 00:32:22 2006
New Revision: 375546

URL: http://svn.apache.org/viewcvs?rev=375546&view=rev
Log: (empty)

Added:
    webservices/axis2/trunk/c/modules/platforms/windows/axis2_getopt_windows.h
    webservices/axis2/trunk/c/modules/platforms/windows/getopt_windows.c
Modified:
    webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c
    webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c
    webservices/axis2/trunk/c/modules/platforms/unix/axis2_unix.h
    webservices/axis2/trunk/c/modules/platforms/windows/axis2_windows.h

Modified: webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c?rev=375546&r1=375545&r2=375546&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c (original)
+++ webservices/axis2/trunk/c/modules/core/clientapi/mep_client.c Tue Feb  7 00:32:22 2006
@@ -20,6 +20,7 @@
 #include <axis2_engine.h>
 #include <axis2_soap.h>
 #include <axis2_soap_body.h>
+#include <axis2_http_transport_utils.h>
 
 typedef struct axis2_mep_client_impl
 {
@@ -542,6 +543,7 @@
     /* TODO response_envelope = TransportUtils.createSOAPMessage(response, msg_ctx.getEnvelope().getNamespace().getName());*/
     soap_ns_uri = AXIS2_MSG_CTX_GET_IS_SOAP_11(msg_ctx, env) ?
         AXIS2_SOAP11_SOAP_ENVELOPE_NAMESPACE_URI:AXIS2_SOAP12_SOAP_ENVELOPE_NAMESPACE_URI;
+    
     response_envelope = axis2_http_transport_utils_create_soap_msg(env, 
                             msg_ctx, soap_ns_uri);
     if (response_envelope) 

Modified: webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c?rev=375546&r1=375545&r2=375546&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c (original)
+++ webservices/axis2/trunk/c/modules/core/transport/http/server/http_server_main.c Tue Feb  7 00:32:22 2006
@@ -55,14 +55,16 @@
     extern char *optarg;
     extern int optopt;
 	char tmp_str[512];
+    int c;
+
+    axis2_log_levels_t log_level = AXIS2_LOG_LEVEL_DEBUG;
 	int port = 9090;
     axis2_char_t *repo_path = "../";
 	axis2_http_socket_read_timeout = AXIS2_HTTP_DEFAULT_SO_TIMEOUT;
-    axis2_log_levels_t log_level = AXIS2_LOG_LEVEL_DEBUG;
-    int c;
 
     while ((c = getopt(argc, argv, ":p:r:ht:l:")) != -1)
     {
+        
         switch(c)
         {
             case 'p':

Modified: webservices/axis2/trunk/c/modules/platforms/unix/axis2_unix.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/platforms/unix/axis2_unix.h?rev=375546&r1=375545&r2=375546&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/platforms/unix/axis2_unix.h (original)
+++ webservices/axis2/trunk/c/modules/platforms/unix/axis2_unix.h Tue Feb  7 00:32:22 2006
@@ -221,6 +221,8 @@
 #define AXIS2_CLOSE_SOCKET_ON_EXIT(sock)    fcntl(sock,F_SETFD, FD_CLOEXEC);
 #define axis2_socket_len_t                  socklen_t
 
+/** getopt function */
+#define AXIS2_GETOPT getopt
 
 /**
   * handling variable number of arguments (for log.c)

Added: webservices/axis2/trunk/c/modules/platforms/windows/axis2_getopt_windows.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/platforms/windows/axis2_getopt_windows.h?rev=375546&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/platforms/windows/axis2_getopt_windows.h (added)
+++ webservices/axis2/trunk/c/modules/platforms/windows/axis2_getopt_windows.h Tue Feb  7 00:32:22 2006
@@ -0,0 +1,46 @@
+#ifndef _AXIS2_GETOPT_WINDOWS_H_
+#define _AXIS2_GETOPT_WINDOWS_H_
+
+/**
+ * @file axis2_getopt_windows.h
+ * @brief windows cutdown version of getopt function in unix
+ */
+
+#ifdef	__cplusplus
+extern "C" {
+#endif
+
+/** @defgroup axis2_getopt_windows getopt
+ * @ingroup axis2_windows
+ * @{
+ */
+
+extern int	opterr;
+extern int 	optopt;	
+extern char	*optarg;
+
+/**
+  * return and log error
+  * @param __optopt option
+  * @param __err error code
+  * @param __showerr whether or not send to stderr
+  * @return ':' or '?'
+  */
+int _axis2_opt_error(int __optopt, int __err, int __showerr);
+
+/**
+  * cutdown version of getopt in unix
+  * @param __argc no of arguments
+  * @param __argv list of arguments
+  * @param __shortopts options
+  * @return option char if successful, -1 if over, ':' or '?' if error
+  */
+int axis2_getopt(int __argc, char * const *__argv, const char *__shortopts);
+
+/** @} */
+
+#ifdef	__cplusplus
+}
+#endif
+
+#endif
\ No newline at end of file

Modified: webservices/axis2/trunk/c/modules/platforms/windows/axis2_windows.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/platforms/windows/axis2_windows.h?rev=375546&r1=375545&r2=375546&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/platforms/windows/axis2_windows.h (original)
+++ webservices/axis2/trunk/c/modules/platforms/windows/axis2_windows.h Tue Feb  7 00:32:22 2006
@@ -51,7 +51,8 @@
 /* for time */
 #include <time.h>
 #include <sys/timeb.h>
-
+/* get opt */
+#include <axis2_getopt_windows.h>
 /***************************************************************
  * Default paths to shared library/DLLs and files
  ***************************************************************
@@ -193,6 +194,8 @@
   * handling variable number of arguments (for log.c)
   */
   
+/** getopt function */
+#define AXIS2_GETOPT axis2_getopt  
   
 #define AXIS2_VSNPRINTF		_vsnprintf
 

Added: webservices/axis2/trunk/c/modules/platforms/windows/getopt_windows.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/platforms/windows/getopt_windows.c?rev=375546&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/platforms/windows/getopt_windows.c (added)
+++ webservices/axis2/trunk/c/modules/platforms/windows/getopt_windows.c Tue Feb  7 00:32:22 2006
@@ -0,0 +1,98 @@
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "axis2_getopt_windows.h"
+
+int		opterr = 1; /*default - log error*/
+int		optind = 1;
+int		optopt;
+char	*optarg;
+
+#define AXIS2_OPT_ERR_NO_ARG			1
+#define	AXIS2_OPT_ERR_INVALID_OPTION	2
+#define AXIS2_OPT_ERR_BAD_ARG			3
+
+
+
+int _axis2_opt_error(int __optopt, int __err, int __showerr)
+{
+	switch(__err)
+	{
+	case AXIS2_OPT_ERR_NO_ARG:
+		if (__showerr)
+			fprintf(stderr," option requires an argument -- %c\n", __optopt);
+		break;
+	case AXIS2_OPT_ERR_INVALID_OPTION:
+		if (__showerr)
+			fprintf(stderr," illegal option -- %c\n", __optopt);
+		 break;
+	case AXIS2_OPT_ERR_BAD_ARG:
+		return (int)':';
+	default:
+		if (__showerr)
+			fprintf(stderr, "unknown\n");
+	}
+	return (int)'?';
+}
+
+int axis2_getopt(int __argc, char * const *__argv, const char *__shortopts)
+{
+	static char *pos = "";
+	char *olstindex;	
+
+	if (!*pos) 
+	{	
+		/* no option or invalid option*/
+		if (optind >= __argc || *(pos = __argv[optind]) != '-') 
+		{
+			pos = "";
+			return -1;
+		}
+		/*-- option*/
+		if (pos[1] && *++pos == '-') 
+		{
+			++optind;
+			pos = "";
+			return -1;
+		}
+	}
+
+	if ((optopt = (int)*pos++) == (int)':' ||
+	    !(olstindex = strchr(__shortopts, optopt))) 
+	{
+
+		if (optopt == (int)'-')
+			return -1;
+		if (!*pos)
+			++optind;
+		if (*__shortopts != ':')
+			return _axis2_opt_error(optopt,AXIS2_OPT_ERR_BAD_ARG,opterr);
+		_axis2_opt_error(optopt,AXIS2_OPT_ERR_INVALID_OPTION,opterr);
+	}
+
+	if (*++olstindex != ':') 
+	{
+		optarg = NULL;
+		if (!*pos)
+			++optind;
+	}
+	else 
+	{					
+		if (*pos)
+			optarg = pos;
+		else if (__argc <= ++optind) 
+		{	
+			pos = "";
+			if (*__shortopts == ':')
+				return _axis2_opt_error(-1,AXIS2_OPT_ERR_BAD_ARG,opterr);
+			return _axis2_opt_error(optopt,AXIS2_OPT_ERR_NO_ARG,opterr);
+		}
+	 	else
+			optarg = __argv[optind];
+		pos = "";
+		++optind;
+	}
+	return optopt;
+}
+