pier 01/04/24 13:20:33 Modified: connectors/lib Makefile.in wa_general.c wa_request.c Log: Formatted source code Revision Changes Path 1.2 +6 -6 jakarta-tomcat-4.0/connectors/lib/Makefile.in Index: Makefile.in =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/lib/Makefile.in,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- Makefile.in 2001/04/17 13:14:50 1.1 +++ Makefile.in 2001/04/24 20:20:33 1.2 @@ -56,7 +56,7 @@ # ========================================================================= # # @author Pier Fumagalli <mailto:[EMAIL PROTECTED]> -# @version $Id: Makefile.in,v 1.1 2001/04/17 13:14:50 pier Exp $ +# @version $Id: Makefile.in,v 1.2 2001/04/24 20:20:33 pier Exp $ include ../Makedefs @@ -67,10 +67,10 @@ all: $(LIB) $(LIB): $(OBJS) - @echo - Linking library $(LIB) - @$(AR) -cr $(LIB) $(OBJS) - @$(RANLIB) $(LIB) + @echo - Linking library $(LIB) + @$(AR) -cr $(LIB) $(OBJS) + @$(RANLIB) $(LIB) clean: - @echo Removing object files $(OBJS) $(LIB) - @rm -f $(OBJS) $(LIB) + @echo Removing object files $(OBJS) $(LIB) + @rm -f $(OBJS) $(LIB) 1.2 +57 -57 jakarta-tomcat-4.0/connectors/lib/wa_general.c Index: wa_general.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/lib/wa_general.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- wa_general.c 2001/04/17 13:14:51 1.1 +++ wa_general.c 2001/04/24 20:20:33 1.2 @@ -55,7 +55,7 @@ * * * ========================================================================= */ -/* @version $Id: wa_general.c,v 1.1 2001/04/17 13:14:51 pier Exp $ */ +/* @version $Id: wa_general.c,v 1.2 2001/04/24 20:20:33 pier Exp $ */ #include <wa.h> /* The current APR memory pool. */ @@ -63,48 +63,48 @@ /* Initialize the WebApp Library. */ const char *wa_init(void) { - if (pool==NULL) { - if (apr_initialize()!=APR_SUCCESS) - return("Cannot initialize APR"); - if (apr_pool_create(&pool,NULL)!=APR_SUCCESS) - return("Cannot create WebApp Library memory pool"); - if (pool==NULL) - return("Invalid WebApp Library memory pool created"); - } - return(NULL); + if (pool==NULL) { + if (apr_initialize()!=APR_SUCCESS) + return("Cannot initialize APR"); + if (apr_pool_create(&pool,NULL)!=APR_SUCCESS) + return("Cannot create WebApp Library memory pool"); + if (pool==NULL) + return("Invalid WebApp Library memory pool created"); + } + return(NULL); } /* Clean up the WebApp Library. */ const char *wa_destroy(void) { - if (pool==NULL) return("WebApp Library not initialized"); - apr_pool_destroy(pool); - pool=NULL; - apr_terminate(); - return(NULL); + if (pool==NULL) return("WebApp Library not initialized"); + apr_pool_destroy(pool); + pool=NULL; + apr_terminate(); + return(NULL); } /* Allocate and setup a connection */ const char *wa_connect(wa_connection **c, const char *p, const char *a) { - wa_connection *conn=NULL; - const char *msg=NULL; + wa_connection *conn=NULL; + const char *msg=NULL; - /* Check parameters */ - if (c==NULL) return("Invalid storage location specified"); + /* Check parameters */ + if (c==NULL) return("Invalid storage location specified"); - /* Allocate some memory */ - conn=(wa_connection *)apr_palloc(pool,sizeof(wa_connection)); - if (conn==NULL) return("Cannot allocate memory"); - conn->pool=pool; - - /* Retrieve the provider and set up the conection */ - conn->conf=NULL; - // if ((conn->prov=wa_provider_get(p))==NULL) - // return("Invalid provider name specified"); - // if ((msg=conn->prov->configure(conn,a))!=NULL) return(msg); - - /* Done! :) */ - *c=conn; - return(NULL); + /* Allocate some memory */ + conn=(wa_connection *)apr_palloc(pool,sizeof(wa_connection)); + if (conn==NULL) return("Cannot allocate memory"); + conn->pool=pool; + + /* Retrieve the provider and set up the conection */ + conn->conf=NULL; + // if ((conn->prov=wa_provider_get(p))==NULL) + // return("Invalid provider name specified"); + // if ((msg=conn->prov->configure(conn,a))!=NULL) return(msg); + + /* Done! :) */ + *c=conn; + return(NULL); } /* Allocate, set up and deploy an application. */ @@ -114,33 +114,33 @@ const char *msg=NULL; char *buf=NULL; int l=0; - - /* Check parameters */ - if (a==NULL) return("Invalid storage location specified"); - if (c==NULL) return("Invalid connection specified"); - if (n==NULL) return("Invalid application name"); - if (p==NULL) return("Invalid application path"); + + /* Check parameters */ + if (a==NULL) return("Invalid storage location specified"); + if (c==NULL) return("Invalid connection specified"); + if (n==NULL) return("Invalid application name"); + if (p==NULL) return("Invalid application path"); - /* Allocate some memory */ + /* Allocate some memory */ appl=(wa_application *)apr_palloc(pool,sizeof(wa_application)); if (appl==NULL) return("Cannot allocate memory"); appl->pool=pool; - /* Set up application structure */ - appl->conn=c; - appl->name=apr_pstrdup(pool,n); - buf=apr_pstrdup(appl->pool,p); - l=strlen(buf)-1; - if (buf[l]=='/') buf[l]='\0'; - if (buf[0]=='/') appl->rpth=apr_pstrcat(pool,buf,"/"); - else appl->rpth=apr_pstrcat(pool,"/",buf,"/"); - appl->lpth=NULL; - - /* Tell the connector provider we're deploying an application */ - appl->conf=NULL; - // if ((msg=appl->conn->prov->deploy(a))!=NULL) return(msg); - - /* Done! :) */ - *a=appl; - return(NULL); + /* Set up application structure */ + appl->conn=c; + appl->name=apr_pstrdup(pool,n); + buf=apr_pstrdup(appl->pool,p); + l=strlen(buf)-1; + if (buf[l]=='/') buf[l]='\0'; + if (buf[0]=='/') appl->rpth=apr_pstrcat(pool,buf,"/"); + else appl->rpth=apr_pstrcat(pool,"/",buf,"/"); + appl->lpth=NULL; + + /* Tell the connector provider we're deploying an application */ + appl->conf=NULL; + // if ((msg=appl->conn->prov->deploy(a))!=NULL) return(msg); + + /* Done! :) */ + *a=appl; + return(NULL); } 1.3 +9 -9 jakarta-tomcat-4.0/connectors/lib/wa_request.c Index: wa_request.c =================================================================== RCS file: /home/cvs/jakarta-tomcat-4.0/connectors/lib/wa_request.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- wa_request.c 2001/04/24 16:31:35 1.2 +++ wa_request.c 2001/04/24 20:20:33 1.3 @@ -55,27 +55,27 @@ * * * ========================================================================= */ -/* @version $Id: wa_request.c,v 1.2 2001/04/24 16:31:35 pier Exp $ */ +/* @version $Id: wa_request.c,v 1.3 2001/04/24 20:20:33 pier Exp $ */ #include <wa.h> /* Attempt to match an URL against a web application. */ boolean wa_match(const char *u, wa_application *a) { - if (u==NULL) return(FALSE); - if (a==NULL) return(FALSE); + if (u==NULL) return(FALSE); + if (a==NULL) return(FALSE); - if (strncmp(u,a->rpth,strlen(a->rpth))==0) return(TRUE); - else return(FALSE); + if (strncmp(u,a->rpth,strlen(a->rpth))==0) return(TRUE); + else return(FALSE); } /* Invoke a request in a web application. */ int wa_invoke(wa_request *r, wa_application *a) { - return(404); + return(404); } /* Display an informative status page. */ int wa_status(wa_request *r, wa_application **appl, wa_connection **conn, - int anum, int cnum) { - int x; + int anum, int cnum) { + int x; - return(404); + return(404); }