Commits

Anonymous committed fcc5d5f

r2495@LENOVO-6D4C2336: sugawara | 2008-09-14 09:56:30 +0900

Comments (0)

Files changed (13)

ext/libtar/compat/basename.c

 
 	/* Strip trailing slashes */
 	endp = path + strlen(path) - 1;
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	while (endp > path && *endp == '/')
 		endp--;
 #else
 #endif
 
 	/* All slashes becomes "/" */
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	if (endp == path && *endp == '/') {
 		(void)strcpy(bname, "/");
 		return(bname);
 #endif
 	/* Find the start of the base */
 	startp = endp;
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	while (startp > path && *(startp - 1) != '/')
 		startp--;
 #else

ext/libtar/compat/dirname.c

 
 	/* Strip trailing slashes */
 	endp = path + strlen(path) - 1;
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	while (endp > path && *endp == '/')
 		endp--;
 #else
 #endif
 
 	/* Find the start of the dir */
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	while (endp > path && *endp != '/')
 		endp--;
 #else
 
 	/* Either the dir is "/" or there are no slashes */
 	if (endp == path) {
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 		(void)strcpy(bname, *endp == '/' ? "/" : ".");
 #else
 		(void)strcpy(bname, (*endp == '/' || *endp == '\\') ? "/" : ".");
 #endif
 		return(bname);
 	} else {
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 		do {
 			endp--;
 		} while (endp > path && *endp == '/');

ext/libtar/compat/glob.c

  * SUCH DAMAGE.
  */
 
-// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
 #ifdef _WIN32
 #pragma warning(disable:4101)
 #pragma warning(disable:4244)
 #define	M_SET		META('[')
 #define	ismeta(c)	(((c)&M_QUOTE) != 0)
 
-// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
 #ifdef _WIN32
 #define __P(protos) protos
 #define S_ISDIR(m)  (((m) & (_S_IFMT)) == (_S_IFDIR))
 #ifdef HAVE_ISSETUGID
 		if (issetugid() != 0 || (h = getenv("HOME")) == NULL) {
 #endif
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 			if ((pwd = getpwuid(getuid())) == NULL)
 				return pattern;
 			else
 		/*
 		 * Expand a ~user
 		 */
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 		if ((pwd = getpwnam((char*) patbuf)) == NULL)
 			return pattern;
 		else

ext/libtar/compat/strmode.c

 #include <sys/stat.h>
 #include <string.h>
 
-// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
 #ifdef _WIN32
 #include "win32/types.h"
 #endif
 	case S_IFCHR:			/* character special */
 		*p++ = 'c';
 		break;
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	case S_IFBLK:			/* block special */
 		*p++ = 'b';
 		break;
 	case S_IFREG:			/* regular */
 		*p++ = '-';
 		break;
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	case S_IFLNK:			/* symbolic link */
 		*p++ = 'l';
 		break;
 #endif
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	case S_IFSOCK:			/* socket */
 		*p++ = 's';
 		break;
 		break;
 	}
 	/* usr */
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	if (mode & S_IRUSR)
 		*p++ = 'r';
 	else
 #else
 	*p++ = '-';
 #endif
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	if (mode & S_IWUSR)
 		*p++ = 'w';
 	else
 #else
 	*p++ = '-';
 #endif
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	switch (mode & (S_IXUSR | S_ISUID)) {
 	case 0:
 		*p++ = '-';
 	*p++ = '-';
 #endif
 	/* group */
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	if (mode & S_IRGRP)
 		*p++ = 'r';
 	else
 #else
 	*p++ = '-';
 #endif
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	if (mode & S_IWGRP)
 		*p++ = 'w';
 	else
 #else
 	*p++ = '-';
 #endif
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	switch (mode & (S_IXGRP | S_ISGID)) {
 	case 0:
 		*p++ = '-';
 	*p++ = '-';
 #endif
 	/* other */
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	if (mode & S_IROTH)
 		*p++ = 'r';
 	else
 #else
 	*p++ = '-';
 #endif
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	if (mode & S_IWOTH)
 		*p++ = 'w';
 	else
 #else
 	*p++ = '-';
 #endif
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	switch (mode & (S_IXOTH | S_ISVTX)) {
 	case 0:
 		*p++ = '-';

ext/libtar/lib/append.c

 **  University of Illinois at Urbana-Champaign
 */
 
-// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
 #ifdef _WIN32
 #pragma warning(disable:4101)
 #endif
 		if (libtar_hash_add(t->h, td) == -1)
 			return -1;
 	}
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	libtar_hashptr_reset(&hp);
 	if (libtar_hash_getkey(td->td_h, &hp, &(s.st_ino),
 			       (libtar_matchfunc_t)ino_match) != 0)
 	}
 #endif /* #ifndef _WIN32 */
 
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	/* check if it's a symlink */
 	if (TH_ISSYM(t))
 	{
 	int i, j;
 	size_t size;
 
-	// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
-	//filefd = open(realname, O_RDONLY);
 	filefd = open(realname, O_RDONLY
 #ifdef O_BINARY
 			| O_BINARY

ext/libtar/lib/decode.c

 th_get_uid(TAR *t)
 {
 	int uid;
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	struct passwd *pw;
 
 	pw = getpwnam(t->th_buf.uname);
 th_get_gid(TAR *t)
 {
 	int gid;
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	struct group *gr;
 
 	gr = getgrnam(t->th_buf.gname);
 	{
 		switch (t->th_buf.typeflag)
 		{
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 		case SYMTYPE:
 			mode |= S_IFLNK;
 			break;
 		case CHRTYPE:
 			mode |= S_IFCHR;
 			break;
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 		case BLKTYPE:
 			mode |= S_IFBLK;
 			break;
 		case DIRTYPE:
 			mode |= S_IFDIR;
 			break;
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 		case FIFOTYPE:
 			mode |= S_IFIFO;
 			break;

ext/libtar/lib/encode.c

 **  University of Illinois at Urbana-Champaign
 */
 
-// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
 #ifdef _WIN32
 #pragma warning(disable:4244)
 #endif
 		strncpy(t->th_buf.magic, TMAGIC, TMAGLEN);
 	}
 
-	// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
 	for (i = 0; i < T_BLOCKSIZE; i++) {
-		//sum += ((char *)(&(t->th_buf)))[i];
 		sum += ((unsigned char *)(&(t->th_buf)))[i];
 	}
 	for (i = 0; i < 8; i++)
 		sum += (' ' - t->th_buf.chksum[i]);
-	// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
-	//int_to_oct(sum, t->th_buf.chksum, 8);
 	snprintf(t->th_buf.chksum, 8, "%06lo", (unsigned long)(sum));
 	t->th_buf.chksum[6] = 0;
 	t->th_buf.chksum[7] = ' ';
 		t->th_buf.typeflag = DIRTYPE;
 	if (S_ISCHR(mode))
 		t->th_buf.typeflag = CHRTYPE;
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	if (S_ISBLK(mode))
 		t->th_buf.typeflag = BLKTYPE;
 #endif
 void
 th_set_link(TAR *t, char *linkname)
 {
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 #ifdef DEBUG
 	printf("==> th_set_link(th, linkname=\"%s\")\n", linkname);
 #endif
 void
 th_set_device(TAR *t, dev_t device)
 {
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 #ifdef DEBUG
 	printf("th_set_device(): major = %d, minor = %d\n",
 	       major(device), minor(device));
 void
 th_set_user(TAR *t, uid_t uid)
 {
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	struct passwd *pw;
 
 	pw = getpwuid(uid);
 void
 th_set_group(TAR *t, gid_t gid)
 {
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	struct group *gr;
 
 	gr = getgrgid(gid);
 void
 th_set_mode(TAR *t, mode_t fmode)
 {
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	if (S_ISSOCK(fmode))
 	{
 		fmode &= ~S_IFSOCK;
 		fmode |= S_IFIFO;
 	}
 #endif
-	// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
-	//int_to_oct(fmode, (t)->th_buf.mode, 8);
 	int_to_oct((fmode & 0xFFF), (t)->th_buf.mode, 8);
 }
 

ext/libtar/lib/extract.c

 		if (i == 1)
 			i = 0;
 	}
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	else if (TH_ISLNK(t))
 		i = tar_extract_hardlink(t, realname);
 #endif
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	else if (TH_ISSYM(t))
 		i = tar_extract_symlink(t, realname);
 #endif
 	else if (TH_ISCHR(t))
 		i = tar_extract_chardev(t, realname);
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	else if (TH_ISBLK(t))
 		i = tar_extract_blockdev(t, realname);
 #endif
 	return 0;
 }
 
-// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
 int tar_extract_function(TAR *t, void *data, int (*f)(char *b, int l, void *d)) {
   size_t size;
   int i, k;
 int
 tar_extract_hardlink(TAR * t, char *realname)
 {
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	char *filename;
 	char *linktgt = NULL;
 	linkname_t *lnp;
 int
 tar_extract_symlink(TAR *t, char *realname)
 {
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	char *filename;
 	char buf[T_BLOCKSIZE];
 
 int
 tar_extract_blockdev(TAR *t, char *realname)
 {
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	mode_t mode;
 	unsigned long devmaj, devmin;
 	char *filename;

ext/libtar/lib/internal.h

 
 #include <libtar.h>
 
-// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
 #ifdef _WIN32
 
 #include <direct.h>

ext/libtar/lib/libtar.h

 
 #include <libtar_listhash.h>
 
-// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
 #ifdef _WIN32
 #include "win32/types.h"
 #define S_ISDIR(m)  (((m) & (_S_IFMT)) == (_S_IFDIR))
 /* sequentially extract next file from t */
 int tar_extract_file(TAR *t, char *realname);
 
-// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
 int tar_extract_function(TAR *t, void *data, int (*f)(char *b, int l, void *d));
 
 /* extract different file types */
 int oct_to_int(char *oct);
 
 /* integer to NULL-terminated string-octal conversion */
-// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
-//#define int_to_oct(num, oct, octlen) \
-//	snprintf((oct), (octlen), "%*lo ", (octlen) - 2, (unsigned long)(num))
 #define int_to_oct(num, oct, octlen) \
 	snprintf((oct), (octlen), "%0*lo", (octlen) - 1, (unsigned long)(num))
 

ext/libtar/lib/output.c

 {
 	char *filename;
 	char modestring[12];
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	struct passwd *pw;
 	struct group *gr;
 #endif
 #endif
 
 	uid = th_get_uid(t);
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	pw = getpwuid(uid);
 	if (pw == NULL)
 		snprintf(username, sizeof(username), "%d", uid);
 #endif
 
 	gid = th_get_gid(t);
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	gr = getgrgid(gid);
 	if (gr == NULL)
 		snprintf(groupname, sizeof(groupname), "%d", gid);

ext/libtar/lib/util.c

 void
 int_to_oct_nonull(int num, char *oct, size_t octlen)
 {
-	// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
-	//snprintf(oct, octlen, "%*lo", octlen - 1, (unsigned long)num);
-	//oct[octlen - 1] = ' ';
 	snprintf(oct, octlen, "%0*lo", octlen - 1, (unsigned long)num);
 	oct[octlen - 1] = 0;
 }

ext/libtar/lib/wrapper.c

 #endif
 
 #ifdef _WIN32
-static int __tarruby_is_interrupted__ = 0;
+static int __tarruby_interrupted__ = 0;
 
 static BOOL WINAPI interrupted_handler(DWORD CtrlType) {
 	if (CTRL_C_EVENT == CtrlType) {
-		__tarruby_is_interrupted__ = 1;
+		__tarruby_interrupted__ = 1;
 		return FALSE;
 	} else {
 		return TRUE;
 	char buf[MAXPATHLEN];
 	int i;
 
+#ifdef _WIN32
+	__tarruby_interrupted__ = 0;
+#endif
+
 	while ((i = th_read(t)) == 0)
 	{
 #ifdef _WIN32
-		if (__tarruby_is_interrupted__) {
+		if (__tarruby_interrupted__) {
 			errno = EINTR;
-			__tarruby_is_interrupted__ = 0;
+			__tarruby_interrupted__ = 0;
 			return -1;
 		}
 #endif
 			snprintf(buf, sizeof(buf), "%s/%s", prefix, filename);
 		else
 			strlcpy(buf, filename, sizeof(buf));
-		// modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
-		//if (tar_extract_file(t, filename) != 0)
 		if (tar_extract_file(t, buf) != 0) {
 			free(filename);
 			return -1;
 	char buf[MAXPATHLEN];
 	int i;
 
+#ifdef _WIN32
+	__tarruby_interrupted__ = 0;
+#endif
+
 #ifdef DEBUG
 	printf("==> tar_extract_all(TAR *t, \"%s\")\n",
 	       (prefix ? prefix : "(null)"));
 		puts("    tar_extract_all(): calling th_get_pathname()");
 #endif
 #ifdef _WIN32
-		if (__tarruby_is_interrupted__) {
+		if (__tarruby_interrupted__) {
 			errno = EINTR;
-			__tarruby_is_interrupted__ = 0;
+			__tarruby_interrupted__ = 0;
 			return -1;
 		}
 #endif
 	struct dirent *dent;
 	DIR *dp;
 	struct stat s;
-#ifdef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifdef _WIN32
     int errorp = 0;
+	__tarruby_interrupted__ = 0;
 #endif
 
 #ifdef DEBUG
 	puts("    tar_append_tree(): done with tar_append_file()...");
 #endif
 
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 	dp = opendir(realdir);
 #else
 	dp = opendir0(realdir, &errorp);
 #endif
 	if (dp == NULL)
 	{
-#ifndef _WIN32 // modified by SUGAWARA Genki <sgwr_dts@yahoo.co.jp>
+#ifndef _WIN32
 		if (errno == ENOTDIR)
 			return 0;
 #else
 	while ((dent = readdir(dp)) != NULL)
 	{
 #ifdef _WIN32
-		if (__tarruby_is_interrupted__) {
+		if (__tarruby_interrupted__) {
 			errno = EINTR;
-			__tarruby_is_interrupted__ = 0;
+			__tarruby_interrupted__ = 0;
 			return -1;
 		}
 #endif