diff --git a/zip/unix/Makefile b/zip/unix/Makefile index abd0c44..0a1520a 100644 --- a/zip/unix/Makefile +++ b/zip/unix/Makefile @@ -61,6 +61,7 @@ CFLAGS_NOOPT = -I. -DUNIX $(LOCAL_ZIP) CFLAGS = -O2 $(CFLAGS_NOOPT) LFLAGS1 = LFLAGS2 = -s +LDADD = -lnatspec # object file lists OBJZ = zip.o zipfile.o zipup.o fileio.o util.o globals.o crypt.o ttyio.o \ @@ -125,7 +126,7 @@ zips: $(ZIPS) zipsman: $(ZIPS) $(ZIPMANUALs) zip$E: $(OBJZ) $(OBJI) $(OBJA) $(LIB_BZ) - $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2) + $(BIND) -o zip$E $(LFLAGS1) $(OBJZ) $(OBJI) $(OBJA) $(LFLAGS2) $(LDADD) zipnote$E: $(OBJN) $(BIND) -o zipnote$E $(LFLAGS1) $(OBJN) $(LFLAGS2) zipcloak$E: $(OBJC) $(OCRCTB) diff --git a/zip/unix/osdep.h b/zip/unix/osdep.h index 10f8ee9..fe7cae0 100644 --- a/zip/unix/osdep.h +++ b/zip/unix/osdep.h @@ -78,3 +78,6 @@ #if !defined(NO_EF_UT_TIME) && !defined(USE_EF_UT_TIME) # define USE_EF_UT_TIME #endif + +/* Set Windows code as archive type */ +# define OS_CODE 0xb00 diff --git a/zip/unix/unix.c b/zip/unix/unix.c index f4d655d..26be4c5 100644 --- a/zip/unix/unix.c +++ b/zip/unix/unix.c @@ -14,6 +14,11 @@ #include +#ifdef UNIX +# include +# include +#endif + #if defined(MINIX) || defined(__mpexl) # ifdef S_IWRITE # undef S_IWRITE @@ -60,7 +65,7 @@ local time_t label_utim = 0; /* Local functions */ local char *readd OF((DIR *)); - +local const char *oem_charset = NULL; #ifdef NO_DIR /* for AT&T 3B1 */ #include @@ -262,6 +267,17 @@ int *pdosflag; /* output: force MSDOS file attributes? */ if (!pathput) t = last(t, PATH_END); +#ifdef UNIX + if (!oem_charset) { + setlocale(LC_CTYPE, ""); + oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, ""); + } + /* Convert to internal encoding */ + if ((n = natspec_convert(t, oem_charset, 0, 0)) == NULL) + return NULL; + return n; +#else + /* Malloc space for internal name and copy it */ if ((n = malloc(strlen(t) + 1)) == NULL) return NULL; @@ -269,6 +285,7 @@ int *pdosflag; /* output: force MSDOS file attributes? */ if (dosify) msname(n); +#endif #ifdef EBCDIC strtoasc(n, n); /* here because msname() needs native coding */ @@ -289,8 +306,19 @@ char *n; /* internal file name */ { char *x; /* external file name */ +#ifdef UNIX + if (!oem_charset) { + oem_charset = natspec_get_charset_by_locale(NATSPEC_DOSCS, ""); + setlocale(LC_CTYPE, ""); + } + /* Convert to internal encoding */ + if ((x = natspec_convert(n, 0, oem_charset, 0)) == NULL) + return NULL; + return x; +#else if ((x = malloc(strlen(n) + 1 + PAD)) == NULL) return NULL; +#endif #ifdef EBCDIC strtoebc(x, n); #else