You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by pi...@apache.org on 2006/05/24 17:12:41 UTC

svn commit: r409186 - in /webservices/axis2/trunk/c/util/src: Makefile.am dir_handler.c

Author: pini
Date: Wed May 24 08:12:41 2006
New Revision: 409186

URL: http://svn.apache.org/viewvc?rev=409186&view=rev
Log:
Changes to archive based deployment model

Modified:
    webservices/axis2/trunk/c/util/src/Makefile.am
    webservices/axis2/trunk/c/util/src/dir_handler.c

Modified: webservices/axis2/trunk/c/util/src/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/Makefile.am?rev=409186&r1=409185&r2=409186&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/util/src/Makefile.am Wed May 24 08:12:41 2006
@@ -30,6 +30,8 @@
                         stack.c \
 						generic_obj.c
 
+libaxis2_util_la_LIBADD = minizip/libaxis2_minizip.la 
+
 INCLUDES = -I$(top_builddir)/include \
            -I$(top_builddir)/include/platforms \
            -I$(top_builddir)/include/platforms/unix

Modified: webservices/axis2/trunk/c/util/src/dir_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/dir_handler.c?rev=409186&r1=409185&r2=409186&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/dir_handler.c (original)
+++ webservices/axis2/trunk/c/util/src/dir_handler.c Wed May 24 08:12:41 2006
@@ -18,13 +18,6 @@
 #include <axis2_file.h>
 #include <platforms/axis2_platform_auto_sense.h>
 #include <axis2_string.h>
-/*#include <zlib.h>
-#include <fcntl.h>
-#include <minizip/unzip.h>
-
-#define CASESENSITIVITY (0)
-#define WRITEBUFFERSIZE (8192)
-#define MAXFILENAME (256)*/
 
 #ifndef S_ISDIR
 #   define S_ISDIR(m) ((m & S_IFMT) == S_IFDIR)
@@ -34,7 +27,6 @@
 
 int dir_select(struct dirent *entry);
 
-/* int aar_select();*/
 
 /**
  * List the dll files in the given service or module folder path
@@ -208,7 +200,6 @@
  * errno after getwcd() on Windows is figured out.
  */
 
-	/*int dir_select();*/
     axis2_status_t status = AXIS2_FAILURE;
     AXIS2_ENV_CHECK(env, NULL);
 	/*if ((handle = opendir(pathname)) != NULL && (handle->finished == 1))
@@ -219,7 +210,8 @@
     file_list = axis2_array_list_create(env, 0);
 	if (!getcwd(cwd, 500)) exit(1);
 	chdir(pathname);
-/*    aar_select();*/
+	axis2_aar_extract(pathname);
+
 	count = AXIS2_SCANDIR(pathname, &files, dir_select, AXIS2_ALPHASORT);
 	chdir(cwd);
 
@@ -404,307 +396,3 @@
 	return AXIS2_TRUE;
 }
 
-/*int aar_select()
-{
-	struct dirent **namelist;
-	int n;
-	axis2_char_t *ptr;
-
-	n = scandir(".", &namelist, 0, alphasort);
-	if (n < 0)
-		perror("scandir");
-	else 
-	{
-		while(n--) 
-		{
-			if ((strcmp(namelist[n]->d_name, ".")== 0) ||
-			(strcmp(namelist[n]->d_name, "..") == 0))
-				return (AXIS2_FALSE);
-
-			ptr = AXIS2_RINDEX(namelist[n]->d_name, '.');
-
-			if ((ptr != NULL) &&
-			((strcmp(ptr, AXIS2_AAR_SUFFIX) == 0) ))
-			{
-				aar_extract(namelist[n]->d_name);
-			}
-			free(namelist[n]);
-		}
-	free(namelist);
-	}
-	return (AXIS2_TRUE);
-}
-
-int aar_extract(axis2_char_t *d_name)
-{
-	const axis2_char_t *zipfilename=NULL;
-	const axis2_char_t *filename_to_extract=NULL;
-	const axis2_char_t *password=NULL;
-	axis2_char_t filename_try[MAXFILENAME+16] = "";
-	int opt_do_extract_withoutpath=0;
-	int opt_overwrite=0;
-	int opt_extractdir=0;
-	const axis2_char_t *dir_name=NULL;
-	unzFile uf=NULL;
-
-	if (zipfilename == NULL)
-
-	zipfilename = d_name;
-	filename_to_extract = d_name;
-	if (zipfilename!=NULL)
-	{
-		#if defined( WIN32 )
-			zlib_filefunc_def ffunc;
-		#endif
-
-		strncpy(filename_try, zipfilename,MAXFILENAME-1);
-		filename_try[ MAXFILENAME ] = '\0';
-		
-		#if defined( WIN32 )
-			fill_win32_filefunc(&ffunc);
-			uf = unzOpen2(zipfilename,&ffunc);
-		#else
-			uf = unzOpen(zipfilename);
-		#endif
-		if (uf==NULL)
-		{
-			strcat(filename_try,".zip");
-
-			#if defined( WIN32 )
-				uf = unzOpen2(filename_try,&ffunc);
-			#else
-				uf = unzOpen(filename_try);
-			#endif
-		}
-	}
-
-	if (uf==NULL)
-		return -1;
-
-	if (opt_extractdir && chdir(dir_name))
-		exit(-1);
-
-	return axis2_extract(uf,opt_do_extract_withoutpath,opt_overwrite,password);
-	unzCloseCurrentFile(uf);
-	return 0;
-}
-
-int axis2_extract_onefile(uf,filename,opt_extract_without_path,opt_overwrite,password)
-	    unzFile uf;
-		const axis2_char_t* filename;
-		int opt_extract_without_path;
-		int opt_overwrite;
-		const axis2_char_t* password;
-{
-	if (unzLocateFile(uf,filename,CASESENSITIVITY)!=UNZ_OK)
-		return -1;
-
-	if (axis2_extract_currentfile(uf,&opt_extract_without_path,
-		&opt_overwrite,
-		password) == UNZ_OK)
-		return 0;
-	else
-		return -1;
-}
-
-
-
-int axis2_extract(uf,opt_extract_without_path,opt_overwrite,password)
-	    unzFile uf;
-		int opt_extract_without_path;
-		int opt_overwrite;
-		const axis2_char_t* password;
-{
-	uLong i;
-	unz_global_info gi;
-	int err;
-
-	err = unzGetGlobalInfo (uf,&gi);
-	if (err!=UNZ_OK)
-		return -1;
-
-	for (i=0;i<gi.number_entry;i++)
-	{
-		if (axis2_extract_currentfile(uf,&opt_extract_without_path,
-		&opt_overwrite,
-		password) != UNZ_OK)
-		break;
-
-		if ((i+1)<gi.number_entry)
-		{
-			err = unzGoToNextFile(uf);
-			if (err!=UNZ_OK)
-			{
-				return -1;
-				break;
-			}
-		}
-	}
-
-	return 0;
-}
-
-int axis2_extract_currentfile(uf,popt_extract_without_path,popt_overwrite,password)
-	unzFile uf;
-	const int* popt_extract_without_path;
-	int* popt_overwrite;
-	const axis2_char_t* password;
-{
-	axis2_char_t filename_inzip[256];
-	axis2_char_t* filename_withoutpath;
-	axis2_char_t* p;
-	int err=UNZ_OK;
-	FILE *fout=NULL;
-	void* buf;
-	uInt size_buf;
-
-	unz_file_info file_info;
-	err = unzGetCurrentFileInfo(uf,&file_info,filename_inzip,sizeof(filename_inzip),NULL,0,NULL,0);
-
-	if (err!=UNZ_OK)
-	{
-		return err;
-	}
-
-	size_buf = WRITEBUFFERSIZE;
-	buf = (void*)malloc(size_buf);
-	if (buf==NULL)
-		return UNZ_INTERNALERROR;
-
-    p = filename_withoutpath = filename_inzip;
-	while ((*p) != '\0')
-	{
-		if (((*p)=='/') || ((*p)=='\\'))
-		filename_withoutpath = p+1;
-		p++;
-	}
-
-	if ((*filename_withoutpath)=='\0')
-	{
-		if ((*popt_extract_without_path)==0)
-		{
-			axis2_mkdir(filename_inzip);
-		}
-	}
-	else
-	{
-		const axis2_char_t* write_filename;
-		int skip=0;
-
-		if ((*popt_extract_without_path)==0)
-		write_filename = filename_inzip;
-		else
-		write_filename = filename_withoutpath;
-
-		err = unzOpenCurrentFilePassword(uf,password);
-
-		if ((skip==0) && (err==UNZ_OK))
-		{
-			fout=fopen(write_filename,"wb");
-
-		if ((fout==NULL) && ((*popt_extract_without_path)==0) &&
-		(filename_withoutpath!=(axis2_char_t*)filename_inzip))
-		{
-			axis2_char_t c=*(filename_withoutpath-1);
-			*(filename_withoutpath-1)='\0';
-			axis2_create_dir(write_filename);
-			*(filename_withoutpath-1)=c;
-			fout=fopen(write_filename,"wb");
-		}
-
-	}
-
-	if (fout!=NULL)
-	{
-		do
-		{
-			err = unzReadCurrentFile(uf,buf,size_buf);
-			if (err<0)
-			{
-				break;
-			}
-			if (err>0)
-			if (fwrite(buf,err,1,fout)!=1)
-			{
-				err=UNZ_ERRNO;
-				break;
-			}
-		}
-		while (err>0);
-		if (fout)
-		fclose(fout);
-
-	}
-
-	if (err==UNZ_OK)
-	{
-		err = unzCloseCurrentFile (uf);
-	}
-	else
-		unzCloseCurrentFile(uf);
-	}
-
-	free(buf);
-	return err;
-}
-
-
-int axis2_create_dir (new_dir)
-	axis2_char_t *new_dir;
-{
-	axis2_char_t *buffer ;
-	axis2_char_t *p;
-	int  len = (int)strlen(new_dir);
-
-	if (len <= 0)
-	return 0;
-
-	buffer = (axis2_char_t*)malloc(len+1);
-	strcpy(buffer,new_dir);
-
-	if (buffer[len-1] == '/') 
-	{
-		buffer[len-1] = '\0';
-	}
-
-	if (axis2_mkdir(buffer) == 0)
-	{
-		free(buffer);
-		return 1;
-	}
-
-	p = buffer+1;
-	while (1)
-	{
-		axis2_char_t hold;
-
-		while(*p && *p != '\\' && *p != '/')
-		p++;
-		hold = *p;
-		*p = 0;
-		if ((axis2_mkdir(buffer) == -1))
-		{
-			free(buffer);
-			return 0;
-		}
-		if (hold == 0)
-		break;
-		*p++ = hold;
-	}
-	free(buffer);
-	return 1;
-}
-
-int axis2_mkdir(dir_name)
-	const axis2_char_t* dir_name;
-{
-
-    int value=0;
-	#ifdef WIN32
-	    value = mkdir(dir_name);
-	#else
-		    value = mkdir (dir_name,0775);
-	#endif
-	return value;
-}
-*/



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org