+2006-10-08 Koji Arai <arai@users.sourceforge.jp>
+
+ * configure.ac: updated version.
+
+ * configure.ac, src/header.c, src/lha_macro.h, src/lhadd.c, src/lhext.c, src/lhlist.c, tests/lha-test12:
+ re-applied the correct DJGPP patch. Thanks to Doug Kaufman.
+
2006-10-02 Koji Arai <arai@users.sourceforge.jp>
+ * configure.ac: updated version.
+
* src/header.c, src/lha.h, src/lha_macro.h, src/lhadd.c, src/lharc.c, src/lhext.c, src/lhlist.c, src/vsnprintf.c, tests/lha-test.in, tests/lha-test11, tests/lha-test12:
applied the patch for the DJGPP. Thanks to Doug Kaufman.
# Process this file with autoconf to produce a configure script.
-AC_INIT([LHa for UNIX], 1.14i-ac20061002, arai@users.sourceforge.jp, lha)
+AC_INIT([LHa for UNIX], 1.14i-ac20061008, arai@users.sourceforge.jp, lha)
AC_CANONICAL_HOST
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE
[Define to 1 if you want to ignore dot files with -X command line switch])
fi
+case $host_os in
+*msdosdjgpp*)
+CFLAGS="$CFLAGS -DNOT_COMPATIBLE_MODE"
+;;
+esac
+
AC_CONFIG_FILES([Makefile src/Makefile man/Makefile olddoc/Makefile])
AC_CONFIG_FILES([tests/Makefile tests/lha-test])
AC_OUTPUT
hdr->name[i] = '\0';
/* defaults for other type */
- hdr->unix_mode = S_IFREG | UNIX_RW_RW_RW;
+ hdr->unix_mode = UNIX_FILE_REGULAR | UNIX_RW_RW_RW;
hdr->unix_gid = 0;
hdr->unix_uid = 0;
hdr->name[i] = '\0';
/* defaults for other type */
- hdr->unix_mode = S_IFREG | UNIX_RW_RW_RW;
+ hdr->unix_mode = UNIX_FILE_REGULAR | UNIX_RW_RW_RW;
hdr->unix_gid = 0;
hdr->unix_uid = 0;
hdr->header_level = get_byte();
/* defaults for other type */
- hdr->unix_mode = S_IFREG | UNIX_RW_RW_RW;
+ hdr->unix_mode = UNIX_FILE_REGULAR | UNIX_RW_RW_RW;
hdr->unix_gid = 0;
hdr->unix_uid = 0;
hdr->header_level = get_byte();
/* defaults for other type */
- hdr->unix_mode = S_IFREG | UNIX_RW_RW_RW;
+ hdr->unix_mode = UNIX_FILE_REGULAR | UNIX_RW_RW_RW;
hdr->unix_gid = 0;
hdr->unix_uid = 0;
system_kanji_code,
archive_delim, system_delim, filename_case);
- if (S_ISLNK(hdr->unix_mode)) {
+ if ((hdr->unix_mode & UNIX_FILE_SYMLINK) == UNIX_FILE_SYMLINK) {
char *p;
/* split symbolic link */
p = strchr(hdr->name, '|');
/* since 00:00:00 JAN.1.1970 */
#ifdef NOT_COMPATIBLE_MODE
/* Please need your modification in this space. */
+#ifdef __DJGPP__
+ hdr->unix_mode = 0;
+ if (S_ISREG(v_stat->st_mode))
+ hdr->unix_mode = hdr->unix_mode | UNIX_FILE_REGULAR;
+ if (S_ISDIR(v_stat->st_mode))
+ hdr->unix_mode = hdr->unix_mode | UNIX_FILE_DIRECTORY;
+ if (S_ISLNK(v_stat->st_mode))
+ hdr->unix_mode = hdr->unix_mode | UNIX_FILE_SYMLINK;
+ if (v_stat->st_mode & S_IRUSR)
+ hdr->unix_mode = hdr->unix_mode | UNIX_OWNER_READ_PERM;
+ if (v_stat->st_mode & S_IRGRP)
+ hdr->unix_mode = hdr->unix_mode | UNIX_GROUP_READ_PERM;
+ if (v_stat->st_mode & S_IROTH)
+ hdr->unix_mode = hdr->unix_mode | UNIX_OTHER_READ_PERM;
+ if (v_stat->st_mode & S_IWUSR)
+ hdr->unix_mode = hdr->unix_mode | UNIX_OWNER_WRITE_PERM;
+ if (v_stat->st_mode & S_IWGRP)
+ hdr->unix_mode = hdr->unix_mode | UNIX_GROUP_WRITE_PERM;
+ if (v_stat->st_mode & S_IWOTH)
+ hdr->unix_mode = hdr->unix_mode | UNIX_OTHER_WRITE_PERM;
+ if (v_stat->st_mode & S_IXUSR)
+ hdr->unix_mode = hdr->unix_mode | UNIX_OWNER_EXEC_PERM;
+ if (v_stat->st_mode & S_IXGRP)
+ hdr->unix_mode = hdr->unix_mode | UNIX_GROUP_EXEC_PERM;
+ if (v_stat->st_mode & S_IXOTH)
+ hdr->unix_mode = hdr->unix_mode | UNIX_OTHER_EXEC_PERM;
+ if (v_stat->st_mode & S_ISUID)
+ hdr->unix_mode = hdr->unix_mode | UNIX_SETUID;
+ if (v_stat->st_mode & S_ISGID)
+ hdr->unix_mode = hdr->unix_mode | UNIX_SETGID;
+#endif /* __DJGPP__ */
#else
hdr->unix_mode = v_stat->st_mode;
#endif
}
}
-#if defined(S_IFLNK) && !defined(__DJGPP__)
+#ifdef S_IFLNK
if (is_symlink(v_stat)) {
memcpy(hdr->method, LZHDIRS_METHOD, METHOD_TYPE_STORAGE);
hdr->attribute = GENERIC_DIRECTORY_ATTRIBUTE;
archive_delim = "\\";
}
- if (S_ISLNK(hdr->unix_mode)) {
+ if ((hdr->unix_mode & UNIX_FILE_SYMLINK) == UNIX_FILE_SYMLINK) {
char *p;
p = strchr(hdr->name, '|');
if (p) {
# define kill(pid, sig) 0
#endif
+#if defined __DJGPP__
+# define S_ISLNK(m) 0
+#endif
+
/* ------------------------------------------------------------------------ */
/* YOUR CUSTOMIZIES */
/* ------------------------------------------------------------------------ */
#define LZHEADER_STORAGE 4096
-#ifndef S_IFREG
-#define S_IFREG UNIX_FILE_REGULAR
-#endif
-
-#ifndef S_IFDIR
-#define S_IFDIR UNIX_FILE_DIRECTORY
-#endif
-
-#ifndef S_IFLNK
-#define S_IFLNK UNIX_FILE_SYMLINK
-#endif
-
-#ifndef S_ISREG
-#define S_ISREG(m) (((m) & UNIX_FILE_TYPEMASK) == S_IFREG)
-#endif
-
-#ifndef S_ISDIR
-#define S_ISDIR(m) (((m) & UNIX_FILE_TYPEMASK) == S_IFDIR)
-#endif
-
-#ifndef S_ISLNK
-#ifdef __DJGPP__
-#define S_ISLNK(m) 0
-#else
-#define S_ISLNK(m) (((m) & UNIX_FILE_TYPEMASK) == S_IFLNK)
-#endif
-#endif
-
/* ------------------------------------------------------------------------ */
/* FILE Attribute */
/* ------------------------------------------------------------------------ */
header_pos = ftello(nafp);
write_header(nafp, hdr);/* DUMMY */
- if (S_ISLNK(hdr->unix_mode)) {
+ if ((hdr->unix_mode & UNIX_FILE_SYMLINK) == UNIX_FILE_SYMLINK) {
if (!quiet)
printf("%s -> %s\t- Symbolic Link\n", hdr->name, hdr->realname);
}
init_sp(&sp);
while (get_header(oafp, &hdr)) {
- if (S_ISREG(hdr.unix_mode)) {
+ if ((hdr.unix_mode & UNIX_FILE_TYPEMASK) == UNIX_FILE_REGULAR) {
if (stat(hdr.name, &stbuf) >= 0) /* exist ? */
add_sp(&sp, hdr.name, strlen(hdr.name) + 1);
}
- else if (S_ISDIR(hdr.unix_mode)) {
+ else if ((hdr.unix_mode & UNIX_FILE_TYPEMASK) == UNIX_FILE_DIRECTORY) {
strcpy(name, hdr.name); /* ok */
len = strlen(name);
if (len > 0 && name[len - 1] == '/')
if (need_file(ahdr.name)) { /* skip */
fseeko(oafp, ahdr.packed_size, SEEK_CUR);
if (noexec || !quiet) {
- if (S_ISLNK(ahdr.unix_mode))
+ if ((ahdr.unix_mode & UNIX_FILE_TYPEMASK) == UNIX_FILE_SYMLINK)
message("delete %s -> %s", ahdr.name, ahdr.realname);
else
message("delete %s", ahdr.name);
/* adjust file stamp */
utimebuf.actime = utimebuf.modtime = hdr->unix_last_modified_stamp;
- if (!(S_ISLNK(hdr->unix_mode)))
+ if ((hdr->unix_mode & UNIX_FILE_TYPEMASK) != UNIX_FILE_SYMLINK)
utime(name, &utimebuf);
if (hdr->extend_type == EXTEND_UNIX
|| hdr->extend_type == EXTEND_OS68K
|| hdr->extend_type == EXTEND_XOSK) {
#ifdef NOT_COMPATIBLE_MODE
- Please need your modification in this space.
+ /* Please need your modification in this space. */
+#ifdef __DJGPP__
+ if ((hdr->unix_mode & UNIX_FILE_TYPEMASK) != UNIX_FILE_SYMLINK)
+ chmod(name, hdr->unix_mode);
+#endif /* __DJGPP__ */
#else
- if (!(S_ISLNK(hdr->unix_mode)))
+ if ((hdr->unix_mode & UNIX_FILE_TYPEMASK) != UNIX_FILE_SYMLINK)
chmod(name, hdr->unix_mode);
#endif
if (!getuid()){
break;
}
- if (S_ISREG(hdr->unix_mode)
+ if ((hdr->unix_mode & UNIX_FILE_TYPEMASK) == UNIX_FILE_REGULAR
&& method != LZHDIRS_METHOD_NUM) {
extract_regular:
#if 0
if (hdr->has_crc && crc != hdr->crc)
error("CRC error: \"%s\"", name);
}
- else if (S_ISDIR(hdr->unix_mode)
- || S_ISLNK(hdr->unix_mode)
+ else if ((hdr->unix_mode & UNIX_FILE_TYPEMASK) == UNIX_FILE_DIRECTORY
+ || (hdr->unix_mode & UNIX_FILE_TYPEMASK) == UNIX_FILE_SYMLINK
|| method == LZHDIRS_METHOD_NUM) {
/* ¢¬¤³¤ì¤Ç¡¢Symbolic Link ¤Ï¡¢Âç¾æÉפ«¡© */
if (!ignore_directory && !verify_mode) {
return read_size;
}
/* NAME has trailing SLASH '/', (^_^) */
- if (S_ISLNK(hdr->unix_mode)) {
+ if ((hdr->unix_mode & UNIX_FILE_TYPEMASK) == UNIX_FILE_SYMLINK) {
int l_code;
#ifdef S_IFLNK
char modebits[11];
if (verbose) {
- if (S_ISLNK(hdr->unix_mode))
+ if ((hdr->unix_mode & UNIX_FILE_SYMLINK) != UNIX_FILE_SYMLINK)
printf("%s\n", hdr->name);
else
printf("%s -> %s\n", hdr->name, hdr->realname);
case EXTEND_UNIX:
mode = hdr->unix_mode;
- if (S_ISDIR(mode))
+ if (mode & UNIX_FILE_DIRECTORY)
modebits[0] = 'd';
- else if (S_ISLNK(mode))
+ else if ((mode & UNIX_FILE_SYMLINK) == UNIX_FILE_SYMLINK)
modebits[0] = 'l';
else
modebits[0] = '-';
print_stamp(hdr->unix_last_modified_stamp);
if (!verbose) {
- if (!(S_ISLNK(hdr->unix_mode)))
+ if ((hdr->unix_mode & UNIX_FILE_SYMLINK) != UNIX_FILE_SYMLINK)
printf(" %s", hdr->name);
else {
printf(" %s -> %s", hdr->name, hdr->realname);
$lha xw=test-tmp-crlf test-tmp-crlf.lzh
check $? $LINENO
# use GNU diff option --binary for DJGPP.
+case `$lha --version 2>&1` in
+*msdosdjgpp*)
diff -r --binary test-1 test-tmp-crlf
+ ;;
+*)
+diff -r test-1 test-tmp-crlf
+ ;;
+esac
test $? -ne 0
check $? $LINENO
sed -e 's/$/