forked from KolibriOS/kolibrios
final cp866 version
git-svn-id: svn://kolibrios.org@6775 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
parent
bb2b6bba8c
commit
bdccb5b1c7
@ -653,6 +653,8 @@ int extract_or_test_files(__G) /* return PK-type error code */
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef SET_DIR_ATTRIB
|
||||
//Trace((stderr, "SET_DIR_ATTRIB[%d] \n", num_dirs)); hmm, too big number
|
||||
|
||||
if (num_dirs > 0) {
|
||||
sorted_dirlist = (direntry **)malloc(num_dirs*sizeof(direntry *));
|
||||
if (sorted_dirlist == (direntry **)NULL) {
|
||||
@ -1483,12 +1485,12 @@ startover:
|
||||
#else /* !WINDLL */
|
||||
extent fnlen;
|
||||
reprompt:
|
||||
Info(slide, 0x81, ((char *)slide,
|
||||
Info(slide, 0x81 & 0xFE, ((char *)slide,
|
||||
LoadFarString(ReplaceQuery),
|
||||
FnFilter1(G.filename)));
|
||||
if (fgets(G.answerbuf, sizeof(G.answerbuf), stdin)
|
||||
== (char *)NULL) {
|
||||
Info(slide, 1, ((char *)slide,
|
||||
Info(slide, 1 & 0xFE, ((char *)slide,
|
||||
LoadFarString(AssumeNone)));
|
||||
*G.answerbuf = 'N';
|
||||
if (!error_in_archive)
|
||||
@ -1498,7 +1500,7 @@ reprompt:
|
||||
case 'r':
|
||||
case 'R':
|
||||
do {
|
||||
Info(slide, 0x81, ((char *)slide,
|
||||
Info(slide, 0x81 & 0xFE, ((char *)slide,
|
||||
LoadFarString(NewNameQuery)));
|
||||
fgets(G.filename, FILNAMSIZ, stdin);
|
||||
/* usually get \n here: better check for it */
|
||||
@ -1538,7 +1540,7 @@ reprompt:
|
||||
fnlen = strlen(G.answerbuf);
|
||||
if (lastchar(G.answerbuf, fnlen) == '\n')
|
||||
G.answerbuf[--fnlen] = '\0';
|
||||
Info(slide, 1, ((char *)slide,
|
||||
Info(slide, 1 & 0xFE, ((char *)slide,
|
||||
LoadFarString(InvalidResponse), G.answerbuf));
|
||||
goto reprompt; /* yet another goto? */
|
||||
} /* end switch (*answerbuf) */
|
||||
|
@ -1214,7 +1214,7 @@ static int disk_error(__G)
|
||||
__GDEF
|
||||
{
|
||||
/* OK to use slide[] here because this file is finished regardless */
|
||||
Info(slide, 0x4a1, ((char *)slide, LoadFarString(DiskFullQuery),
|
||||
Info(slide, 0x4a1 & 0xFE, ((char *)slide, LoadFarString(DiskFullQuery),
|
||||
FnFilter1(G.filename)));
|
||||
|
||||
#ifndef WINDLL
|
||||
|
@ -20,7 +20,7 @@ SDK_DIR:= $(abspath ../../../contrib/sdk)
|
||||
NOASM=1
|
||||
CC_CPU_OPT=-march=pentium
|
||||
#USEZLIB=1
|
||||
#DEBUG=1
|
||||
DEBUG=1
|
||||
|
||||
|
||||
### Optional section
|
||||
@ -164,7 +164,7 @@ LD_SPECIFIC_OPT = -o $@ -static -S -nostdlib -T $(SDK_DIR)/sources/newlib/app-dy
|
||||
ifdef USEZLIB
|
||||
LD_RELEASE_LIBS = -lz -lgcc -ldll -lc.dll -lapp
|
||||
else
|
||||
LD_RELEASE_LIBS = -lgcc -ldll -lc.dll -lapp
|
||||
LD_RELEASE_LIBS = -lgcc -ldll -lc.dll
|
||||
endif
|
||||
LD_DEBUG_LIBS = $(LD_RELEASE_LIBS)
|
||||
|
||||
|
@ -103,7 +103,7 @@ INCLUDES= -I $(SDK_DIR)/sources/newlib/libc/include -I $(SDK_DIR)/sources/zlib
|
||||
LIBPATH = -L $(SDK_DIR)/lib -L /home/autobuild/tools/win32/mingw32/lib
|
||||
|
||||
CC_ENVIR_OPT = -U__WIN32__ -U_Win32 -U_WIN32 -U__MINGW32__ -UWIN32 -DKOS32 \
|
||||
$(INCLUDES) -DSTATIC_LIBC -DBUILD_LIBC
|
||||
$(INCLUDES) -DSTATIC_LIBC
|
||||
|
||||
### Compiler-specific section
|
||||
|
||||
|
@ -18,15 +18,40 @@ Started by Siemargl @Nov 2016
|
||||
#define STRNICMP zstrnicmp
|
||||
#define NO_CHMOD
|
||||
#define NO_FCHOWN
|
||||
//#define SET_DIR_ATTRIB internal unzip bug
|
||||
|
||||
#define echoff(f)
|
||||
#define echon()
|
||||
#define getch() getchar() /* not correct, but may not be on a console */
|
||||
#define HAVE_WORKING_GETCH
|
||||
|
||||
#define UNICODE_SUPPORT
|
||||
#define UTF8_MAYBE_NATIVE
|
||||
#define NO_NL_LANGINFO
|
||||
/* next line turn on full unicode utf-8 support */
|
||||
//#define UNICODE_SUPPORT
|
||||
#ifdef UNICODE_SUPPORT
|
||||
# define UTF8_MAYBE_NATIVE
|
||||
# define NO_NL_LANGINFO
|
||||
#else /* cp866 is native */
|
||||
# define CRTL_CP_IS_OEM
|
||||
#endif // UNICODE_SUPPORT
|
||||
|
||||
/*
|
||||
# ifdef CRTL_CP_IS_OEM
|
||||
# define ISO_TO_INTERN(src, dst) AnsiToOem(src, dst)
|
||||
# define OEM_TO_INTERN(src, dst) {if ((src) != (dst)) strcpy((dst), (src));}
|
||||
# define INTERN_TO_ISO(src, dst) OemToAnsi(src, dst)
|
||||
# define INTERN_TO_OEM(src, dst) {if ((src) != (dst)) strcpy((dst), (src));}
|
||||
# endif
|
||||
# define _OEM_INTERN(str1) OEM_TO_INTERN(str1, str1)
|
||||
# define _ISO_INTERN(str1) ISO_TO_INTERN(str1, str1)
|
||||
*/
|
||||
/* UzpPassword supplies ANSI-coded string regardless of C RTL's native CP */
|
||||
// remove for a while
|
||||
// # define STR_TO_CP2(dst, src) (AnsiToOem(src, dst), dst)
|
||||
/* dummy defines to disable these functions, they are not needed */
|
||||
# define STR_TO_ISO
|
||||
# define STR_TO_OEM
|
||||
|
||||
|
||||
/*
|
||||
# ifdef DATE_FORMAT
|
||||
# undef DATE_FORMAT
|
||||
|
@ -3,7 +3,7 @@ Kolibri OS port for gcc 5.4
|
||||
|
||||
Started by Siemargl @Nov 2016
|
||||
|
||||
Contains realisation of directory handling functions:
|
||||
Contains realization of directory handling functions:
|
||||
mkdir()
|
||||
closedir()
|
||||
opendir()
|
||||
@ -20,6 +20,7 @@ Contains realisation of directory handling functions:
|
||||
#include <sys/stat.h>
|
||||
#include <assert.h>
|
||||
#include "kos32sys1.h"
|
||||
#include "sys/kos_io.h"
|
||||
|
||||
/* defined in newlib headers
|
||||
int _EXFUN(mkdir,( const char *_path, mode_t __mode ));
|
||||
@ -147,7 +148,7 @@ int mkdir(const char *_path, mode_t m)
|
||||
char namebuffer[1050]; // need for save data after di!!!
|
||||
struct fs_dirinfo *di = (struct fs_dirinfo *)namebuffer;
|
||||
|
||||
debug_board_printf("mkdir start (%s)\n", _path);
|
||||
//debug_board_printf("mkdir start (%s)\n", _path);
|
||||
memset(di, 0, sizeof(struct fs_dirinfo));
|
||||
//di.ppath = (char*)_path; // dont work with 70.9
|
||||
strcpy(di->path, _path);
|
||||
@ -159,7 +160,7 @@ debug_board_printf("mkdir start (%s)\n", _path);
|
||||
return -1;
|
||||
}
|
||||
|
||||
debug_board_printf("mkdir end (%s)\n", _path);
|
||||
//debug_board_printf("mkdir end (%s)\n", _path);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -230,3 +231,27 @@ void* read_folderdata(char* name)
|
||||
return retdir;
|
||||
}
|
||||
*/
|
||||
|
||||
// while not in newlib
|
||||
int set_fileinfo(const char *path, fileinfo_t *info)
|
||||
{
|
||||
int retval;
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"pushl $0 \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"movl %1, 1(%%esp) \n\t"
|
||||
"pushl %%ebx \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"pushl $0 \n\t"
|
||||
"pushl $6 \n\t"
|
||||
"movl %%esp, %%ebx \n\t"
|
||||
"movl $70, %%eax \n\t"
|
||||
"int $0x40 \n\t"
|
||||
"addl $28, %%esp \n\t"
|
||||
:"=a" (retval)
|
||||
:"r" (path), "b" (info));
|
||||
return retval;
|
||||
};
|
||||
|
||||
|
326
programs/fs/unzip60/kolibri/kolibri.cbp
Normal file
326
programs/fs/unzip60/kolibri/kolibri.cbp
Normal file
@ -0,0 +1,326 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||
<CodeBlocks_project_file>
|
||||
<FileVersion major="1" minor="6" />
|
||||
<Project>
|
||||
<Option title="kolibri" />
|
||||
<Option makefile="kolibri/Makefile.gcc" />
|
||||
<Option makefile_is_custom="1" />
|
||||
<Option execution_dir="D:/VSProjects/_kos/programs/fs/unzip60/" />
|
||||
<Option pch_mode="2" />
|
||||
<Option compiler="kolibri_gnu_gcc_compiler" />
|
||||
<MakeCommands>
|
||||
<Build command="$make -f $makefile " />
|
||||
<CompileFile command="$make -f $makefile $file" />
|
||||
<Clean command="$make -f $makefile clean$target" />
|
||||
<DistClean command="$make -f $makefile distclean$target" />
|
||||
<AskRebuildNeeded command="$make -q -f $makefile $target" />
|
||||
<SilentBuild command="$make -f $makefile > $(CMD_NULL)" />
|
||||
</MakeCommands>
|
||||
<Build>
|
||||
<Target title="Debug">
|
||||
<Option output="Debug/kolibri" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="Debug/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="kolibri_gnu_gcc_compiler" />
|
||||
<MakeCommands>
|
||||
<Build command="$make -f $makefile" />
|
||||
<CompileFile command="$make -f $makefile $file" />
|
||||
<Clean command="$make -f $makefile clean" />
|
||||
<DistClean command="$make -f $makefile distclean$target" />
|
||||
<AskRebuildNeeded command="$make -q -f $makefile $target" />
|
||||
<SilentBuild command="$make -f $makefile > $(CMD_NULL)" />
|
||||
</MakeCommands>
|
||||
</Target>
|
||||
<Target title="Release">
|
||||
<Option output="Release/kolibri" prefix_auto="1" extension_auto="1" />
|
||||
<Option object_output="Release/" />
|
||||
<Option type="1" />
|
||||
<Option compiler="kolibri_gnu_gcc_compiler" />
|
||||
</Target>
|
||||
</Build>
|
||||
<Unit filename="../acorn/riscos.h" />
|
||||
<Unit filename="../acorn/swiven.h" />
|
||||
<Unit filename="../acorn/swiven.s" />
|
||||
<Unit filename="../amiga/amiga.h" />
|
||||
<Unit filename="../amiga/z-stat.h" />
|
||||
<Unit filename="../aosvs/aosvs.h" />
|
||||
<Unit filename="../api.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../apihelp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../atheos/athcfg.h" />
|
||||
<Unit filename="../atheos/atheos.h" />
|
||||
<Unit filename="../beos/beocfg.h" />
|
||||
<Unit filename="../beos/beos.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../beos/beos.h" />
|
||||
<Unit filename="../beos/beosmain.cpp" />
|
||||
<Unit filename="../cmsmvs/vmmvs.h" />
|
||||
<Unit filename="../cmsmvs/vmstat.h" />
|
||||
<Unit filename="../consts.h" />
|
||||
<Unit filename="../crc32.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../crc32.h" />
|
||||
<Unit filename="../crc_i386.S" />
|
||||
<Unit filename="../crypt.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../crypt.h" />
|
||||
<Unit filename="../ebcdic.h" />
|
||||
<Unit filename="../envargs.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../explode.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../extract.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../fileio.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../flexos/flexos.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../flexos/flxcfg.h" />
|
||||
<Unit filename="../funzip.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../gbloffs.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../globals.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../globals.h" />
|
||||
<Unit filename="../human68k/crc_68.s" />
|
||||
<Unit filename="../human68k/flate.s" />
|
||||
<Unit filename="../inflate.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../inflate.h" />
|
||||
<Unit filename="../list.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../macos/UnZp.h" />
|
||||
<Unit filename="../macos/UnZpLib.h" />
|
||||
<Unit filename="../macos/UnZpSFX.h" />
|
||||
<Unit filename="../macos/UnZpSx.h" />
|
||||
<Unit filename="../macos/source/charmap.h" />
|
||||
<Unit filename="../macos/source/getenv.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../macos/source/helpers.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../macos/source/helpers.h" />
|
||||
<Unit filename="../macos/source/macbin3.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../macos/source/macbin3.h" />
|
||||
<Unit filename="../macos/source/maccfg.h" />
|
||||
<Unit filename="../macos/source/macdir.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../macos/source/macdir.h" />
|
||||
<Unit filename="../macos/source/macos.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../macos/source/macscreen.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../macos/source/macstat.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../macos/source/macstat.h" />
|
||||
<Unit filename="../macos/source/macstuff.h" />
|
||||
<Unit filename="../macos/source/mactime.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../macos/source/mactime.h" />
|
||||
<Unit filename="../macos/source/macunzip.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../macos/source/pathname.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../macos/source/pathname.h" />
|
||||
<Unit filename="../macos/source/sxunzip.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../match.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../msdos/crc_i86.asm" />
|
||||
<Unit filename="../msdos/doscfg.h" />
|
||||
<Unit filename="../msdos/msdos.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../netware/netware.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../netware/nlmcfg.h" />
|
||||
<Unit filename="../os2/os2.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../os2/os2acl.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../os2/os2acl.h" />
|
||||
<Unit filename="../os2/os2cfg.h" />
|
||||
<Unit filename="../os2/os2data.h" />
|
||||
<Unit filename="../os2/rexxapi.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../os2/rexxhelp.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../process.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../qdos/callstub.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../qdos/config.S" />
|
||||
<Unit filename="../qdos/crc68.s" />
|
||||
<Unit filename="../qdos/izqdos.h" />
|
||||
<Unit filename="../qdos/makesfx.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../qdos/qdos.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../tandem/tandem.h" />
|
||||
<Unit filename="../tandem/tannsk.h" />
|
||||
<Unit filename="../theos/charconv.h" />
|
||||
<Unit filename="../theos/oldstat.h" />
|
||||
<Unit filename="../theos/stat.h" />
|
||||
<Unit filename="../theos/thscfg.h" />
|
||||
<Unit filename="../timezone.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../timezone.h" />
|
||||
<Unit filename="../tops20/tops20.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../ttyio.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../ttyio.h" />
|
||||
<Unit filename="../ubz2err.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../unix/unix.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../unix/unxcfg.h" />
|
||||
<Unit filename="../unreduce.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../unshrink.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../unzip.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../unzip.h" />
|
||||
<Unit filename="../unzipstb.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../unzpriv.h" />
|
||||
<Unit filename="../unzvers.h" />
|
||||
<Unit filename="../vms/bzlib.h" />
|
||||
<Unit filename="../vms/infback9.h" />
|
||||
<Unit filename="../vms/unixio_gcc.h" />
|
||||
<Unit filename="../vms/unixlib_gcc.h" />
|
||||
<Unit filename="../vms/vms.h" />
|
||||
<Unit filename="../vms/vmscfg.h" />
|
||||
<Unit filename="../vms/vmsdefs.h" />
|
||||
<Unit filename="../vms/zlib.h" />
|
||||
<Unit filename="../win32/crc_i386.asm" />
|
||||
<Unit filename="../win32/crc_i386.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../win32/crc_lcc.asm" />
|
||||
<Unit filename="../win32/nt.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../win32/nt.h" />
|
||||
<Unit filename="../win32/rsxntwin.h" />
|
||||
<Unit filename="../win32/w32cfg.h" />
|
||||
<Unit filename="../win32/win32.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../win32/win32i64.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../win32/winapp.rc">
|
||||
<Option compilerVar="WINDRES" />
|
||||
</Unit>
|
||||
<Unit filename="../wince/inc/conio.h" />
|
||||
<Unit filename="../wince/inc/errno.h" />
|
||||
<Unit filename="../wince/inc/locale.h" />
|
||||
<Unit filename="../wince/inc/signal.h" />
|
||||
<Unit filename="../wince/inc/stdio.h" />
|
||||
<Unit filename="../wince/intrface.cpp" />
|
||||
<Unit filename="../wince/intrface.h" />
|
||||
<Unit filename="../wince/punzip.h" />
|
||||
<Unit filename="../wince/punzip.rc">
|
||||
<Option compilerVar="WINDRES" />
|
||||
</Unit>
|
||||
<Unit filename="../wince/resource.h" />
|
||||
<Unit filename="../wince/wcecfg.h" />
|
||||
<Unit filename="../wince/wcemain.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../wince/wince.cpp" />
|
||||
<Unit filename="../wince/wince.h" />
|
||||
<Unit filename="../wince/winmain.cpp" />
|
||||
<Unit filename="../wince/winmain.h" />
|
||||
<Unit filename="../windll/decs.h" />
|
||||
<Unit filename="../windll/guisfx/dialog.h" />
|
||||
<Unit filename="../windll/guisfx/sfxwiz.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../windll/guisfx/sfxwiz.rc">
|
||||
<Option compilerVar="WINDRES" />
|
||||
</Unit>
|
||||
<Unit filename="../windll/structs.h" />
|
||||
<Unit filename="../windll/uzexampl.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../windll/uzexampl.h" />
|
||||
<Unit filename="../windll/windll.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="../windll/windll.h" />
|
||||
<Unit filename="../windll/windll.rc">
|
||||
<Option compilerVar="WINDRES" />
|
||||
</Unit>
|
||||
<Unit filename="../zip.h" />
|
||||
<Unit filename="../zipinfo.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="Makefile.gcc" />
|
||||
<Unit filename="config.h" />
|
||||
<Unit filename="dirent.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="kos32.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Unit filename="kos32sys1.h" />
|
||||
<Unit filename="main.c">
|
||||
<Option compilerVar="CC" />
|
||||
</Unit>
|
||||
<Extensions>
|
||||
<code_completion />
|
||||
<envvars />
|
||||
<debugger />
|
||||
</Extensions>
|
||||
</Project>
|
||||
</CodeBlocks_project_file>
|
@ -16,16 +16,14 @@ Contains:
|
||||
close_outfile()
|
||||
get_extattribs()
|
||||
do_wild()
|
||||
set_direc_attribs()
|
||||
defer_dir_attribs()
|
||||
|
||||
todo
|
||||
russian filenames in arh
|
||||
datetime restore
|
||||
overwrite request not in stderr
|
||||
|
||||
too many open files error EMFILE when DEBUG - error in newlib open. fixed
|
||||
-d dir error. Use -ddir or -d dir/
|
||||
|
||||
release, sizing removing old compression methods or zlib
|
||||
datetime restore for dirs. buf in unzip - crash when SET_DIR_ATTRIB
|
||||
fixed partial
|
||||
-d dir error (only in unicode). Use -ddir or -d dir/
|
||||
russian filenames in arhives. Now works cp866 version, unicode need to fix @kos32.c:470 (GETPATH)
|
||||
*/
|
||||
|
||||
#define FATTR FS_HIDDEN+FS_SYSTEM+FS_SUBDIR
|
||||
@ -38,6 +36,12 @@ todo
|
||||
// Siemargl fork of Kolibri system API
|
||||
#include "kos32sys1.h"
|
||||
|
||||
static ZCONST char CannotSetItemTimestamps[] =
|
||||
"warning: cannot set modif./access times for %s\n %s\n";
|
||||
static ZCONST char CannotGetTimestamps[] =
|
||||
" (warning) cannot get fileinfo for %s\n";
|
||||
|
||||
|
||||
/********************************************************************************************************************/
|
||||
/*** Function version() */
|
||||
/********************************************************************************************************************/
|
||||
@ -154,7 +158,7 @@ int mapname(__G__ renamed)
|
||||
else
|
||||
++cp; /* point to start of last component of path */
|
||||
|
||||
fprintf(stderr, "mapname start[%s]\n", cp);
|
||||
Trace((stderr, "mapname start[%s]\n", cp));
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
Begin main loop through characters in filename.
|
||||
@ -323,7 +327,7 @@ fprintf(stderr, "mapname start[%s]\n", cp);
|
||||
checkdir(__G__ pathcomp, APPEND_NAME); /* returns 1 if truncated: care? */
|
||||
checkdir(__G__ G.filename, GETPATH);
|
||||
|
||||
fprintf(stderr, "mapname end[%s]\n", pathcomp);
|
||||
Trace((stderr, "mapname end[%s]\n", pathcomp));
|
||||
|
||||
|
||||
return error;
|
||||
@ -465,14 +469,24 @@ int checkdir(__G__ pathcomp, flag)
|
||||
GETPATH: copy full path to the string pointed at by pathcomp, and free
|
||||
G.buildpath.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (FUNCTION == GETPATH) {
|
||||
// kolibri UTf8 support
|
||||
#ifdef UNICODE_SUPPORT
|
||||
if(G.native_is_utf8)
|
||||
{
|
||||
if (G.buildpath[0] == '/')
|
||||
{
|
||||
pathcomp[0] = '/'; // kolibri utf8 flag
|
||||
pathcomp[1] = 3; // kolibri utf8 flag
|
||||
strcpy(pathcomp + 2, G.buildpath);
|
||||
} else
|
||||
{
|
||||
pathcomp[0] = 3; // kolibri utf8 flag
|
||||
strcpy(pathcomp + 1, G.buildpath);
|
||||
}
|
||||
}
|
||||
else
|
||||
#endif // UNICODE_SUPPORT
|
||||
strcpy(pathcomp, G.buildpath);
|
||||
Trace((stderr, "getting and freeing path [%s]\n",
|
||||
FnFilter1(pathcomp)));
|
||||
@ -622,59 +636,24 @@ int checkdir(__G__ pathcomp, flag)
|
||||
|
||||
} /* end function checkdir() */
|
||||
|
||||
static int get_extattribs OF((__GPRO__ iztimes *pzt, ulg z_uidgid[2]));
|
||||
|
||||
static int get_extattribs(__G__ pzt, z_uidgid)
|
||||
__GDEF
|
||||
iztimes *pzt;
|
||||
ulg z_uidgid[2];
|
||||
/****************************/
|
||||
/* Function dos_to_kolibri_time() */
|
||||
/****************************/
|
||||
void dos_to_kolibri_time(unsigned dos_datetime, unsigned *fdat, unsigned *ftim)
|
||||
{
|
||||
/*---------------------------------------------------------------------------
|
||||
Convert from MSDOS-format local time and date to Unix-format 32-bit GMT
|
||||
time: adjust base year from 1980 to 1970, do usual conversions from
|
||||
yy/mm/dd hh:mm:ss to elapsed seconds, and account for timezone and day-
|
||||
light savings time differences. If we have a Unix extra field, however,
|
||||
we're laughing: both mtime and atime are ours. On the other hand, we
|
||||
then have to check for restoration of UID/GID.
|
||||
---------------------------------------------------------------------------*/
|
||||
int have_uidgid_flg;
|
||||
unsigned eb_izux_flg;
|
||||
char* pc = (char*)fdat;
|
||||
*pc++ = (dos_datetime >> 16) & 0x1F; // day
|
||||
*pc++ = (dos_datetime >> 21) & 0xF; // month
|
||||
short *ps = (short*)pc;
|
||||
*ps = (dos_datetime >> 25) + 1980; // year
|
||||
*ftim = 0;
|
||||
pc = (char*)ftim;
|
||||
*pc++ = (dos_datetime & 0x1F) << 1; // sec
|
||||
*pc++ = (dos_datetime >> 5) & 0x3F; // min
|
||||
*pc = (dos_datetime >> 11) & 0x1F; // hour
|
||||
} /* end function dos_to_kolibri_time() */
|
||||
|
||||
eb_izux_flg = 0; // kos32
|
||||
/*
|
||||
(G.extra_field ? ef_scan_for_izux(G.extra_field,
|
||||
G.lrec.extra_field_length, 0, G.lrec.last_mod_dos_datetime,
|
||||
#ifdef IZ_CHECK_TZ
|
||||
(G.tz_is_valid ? pzt : NULL),
|
||||
#else
|
||||
pzt,
|
||||
#endif
|
||||
z_uidgid) : 0);
|
||||
*/
|
||||
if (eb_izux_flg & EB_UT_FL_MTIME) {
|
||||
TTrace((stderr, "\nget_extattribs: Unix e.f. modif. time = %ld\n",
|
||||
pzt->mtime));
|
||||
} else {
|
||||
pzt->mtime = dos_to_unix_time(G.lrec.last_mod_dos_datetime);
|
||||
}
|
||||
if (eb_izux_flg & EB_UT_FL_ATIME) {
|
||||
TTrace((stderr, "get_extattribs: Unix e.f. access time = %ld\n",
|
||||
pzt->atime));
|
||||
} else {
|
||||
pzt->atime = pzt->mtime;
|
||||
TTrace((stderr, "\nget_extattribs: modification/access times = %ld\n",
|
||||
pzt->mtime));
|
||||
}
|
||||
|
||||
/* if -X option was specified and we have UID/GID info, restore it */
|
||||
have_uidgid_flg =
|
||||
#ifdef RESTORE_UIDGID
|
||||
(uO.X_flag && (eb_izux_flg & EB_UX2_VALID));
|
||||
#else
|
||||
0;
|
||||
#endif
|
||||
return have_uidgid_flg;
|
||||
}
|
||||
|
||||
/****************************/
|
||||
/* Function close_outfile() */
|
||||
@ -683,159 +662,36 @@ static int get_extattribs(__G__ pzt, z_uidgid)
|
||||
void close_outfile(__G) /* GRR: change to return PK-style warning level */
|
||||
__GDEF
|
||||
{
|
||||
union {
|
||||
iztimes t3; /* mtime, atime, ctime */
|
||||
ztimbuf t2; /* modtime, actime */
|
||||
} zt;
|
||||
ulg z_uidgid[2];
|
||||
int have_uidgid_flg;
|
||||
|
||||
have_uidgid_flg = get_extattribs(__G__ &(zt.t3), z_uidgid);
|
||||
|
||||
/*---------------------------------------------------------------------------
|
||||
If symbolic links are supported, allocate storage for a symlink control
|
||||
structure, put the uncompressed "data" and other required info in it, and
|
||||
add the structure to the "deferred symlinks" chain. Since we know it's a
|
||||
symbolic link to start with, we shouldn't have to worry about overflowing
|
||||
unsigned ints with unsigned longs.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
#ifdef SYMLINKS
|
||||
if (G.symlnk) {
|
||||
extent ucsize = (extent)G.lrec.ucsize;
|
||||
# ifdef SET_SYMLINK_ATTRIBS
|
||||
extent attribsize = sizeof(unsigned) +
|
||||
(have_uidgid_flg ? sizeof(z_uidgid) : 0);
|
||||
# else
|
||||
extent attribsize = 0;
|
||||
# endif
|
||||
/* size of the symlink entry is the sum of
|
||||
* (struct size (includes 1st '\0') + 1 additional trailing '\0'),
|
||||
* system specific attribute data size (might be 0),
|
||||
* and the lengths of name and link target.
|
||||
*/
|
||||
extent slnk_entrysize = (sizeof(slinkentry) + 1) + attribsize +
|
||||
ucsize + strlen(G.filename);
|
||||
slinkentry *slnk_entry;
|
||||
|
||||
if (slnk_entrysize < ucsize) {
|
||||
Info(slide, 0x201, ((char *)slide,
|
||||
"warning: symbolic link (%s) failed: mem alloc overflow\n",
|
||||
FnFilter1(G.filename)));
|
||||
fclose(G.outfile);
|
||||
return;
|
||||
}
|
||||
|
||||
if ((slnk_entry = (slinkentry *)malloc(slnk_entrysize)) == NULL) {
|
||||
Info(slide, 0x201, ((char *)slide,
|
||||
"warning: symbolic link (%s) failed: no mem\n",
|
||||
FnFilter1(G.filename)));
|
||||
fclose(G.outfile);
|
||||
return;
|
||||
}
|
||||
slnk_entry->next = NULL;
|
||||
slnk_entry->targetlen = ucsize;
|
||||
slnk_entry->attriblen = attribsize;
|
||||
# ifdef SET_SYMLINK_ATTRIBS
|
||||
memcpy(slnk_entry->buf, &(G.pInfo->file_attr),
|
||||
sizeof(unsigned));
|
||||
if (have_uidgid_flg)
|
||||
memcpy(slnk_entry->buf + 4, z_uidgid, sizeof(z_uidgid));
|
||||
# endif
|
||||
slnk_entry->target = slnk_entry->buf + slnk_entry->attriblen;
|
||||
slnk_entry->fname = slnk_entry->target + ucsize + 1;
|
||||
strcpy(slnk_entry->fname, G.filename);
|
||||
|
||||
/* move back to the start of the file to re-read the "link data" */
|
||||
rewind(G.outfile);
|
||||
|
||||
if (fread(slnk_entry->target, 1, ucsize, G.outfile) != ucsize)
|
||||
{
|
||||
Info(slide, 0x201, ((char *)slide,
|
||||
"warning: symbolic link (%s) failed\n",
|
||||
FnFilter1(G.filename)));
|
||||
free(slnk_entry);
|
||||
fclose(G.outfile);
|
||||
return;
|
||||
}
|
||||
fclose(G.outfile); /* close "link" file for good... */
|
||||
slnk_entry->target[ucsize] = '\0';
|
||||
if (QCOND2)
|
||||
Info(slide, 0, ((char *)slide, "-> %s ",
|
||||
FnFilter1(slnk_entry->target)));
|
||||
/* add this symlink record to the list of deferred symlinks */
|
||||
if (G.slink_last != NULL)
|
||||
G.slink_last->next = slnk_entry;
|
||||
else
|
||||
G.slink_head = slnk_entry;
|
||||
G.slink_last = slnk_entry;
|
||||
return;
|
||||
}
|
||||
#endif /* SYMLINKS */
|
||||
|
||||
#ifdef QLZIP
|
||||
if (G.extra_field) {
|
||||
static void qlfix OF((__GPRO__ uch *ef_ptr, unsigned ef_len));
|
||||
|
||||
qlfix(__G__ G.extra_field, G.lrec.extra_field_length);
|
||||
}
|
||||
#endif
|
||||
|
||||
#if (defined(NO_FCHOWN))
|
||||
fclose(G.outfile);
|
||||
Trace((stdout, "File (%s) closed\n", FnFilter1(G.filename)));
|
||||
#endif
|
||||
|
||||
// kos. add set file datetime ?
|
||||
#ifndef KOS32
|
||||
/* if -X option was specified and we have UID/GID info, restore it */
|
||||
if (have_uidgid_flg
|
||||
/* check that both uid and gid values fit into their data sizes */
|
||||
&& ((ulg)(uid_t)(z_uidgid[0]) == z_uidgid[0])
|
||||
&& ((ulg)(gid_t)(z_uidgid[1]) == z_uidgid[1])) {
|
||||
TTrace((stderr, "close_outfile: restoring Unix UID/GID info\n"));
|
||||
#if (defined(NO_FCHOWN))
|
||||
if (chown(G.filename, (uid_t)z_uidgid[0], (gid_t)z_uidgid[1]))
|
||||
#else
|
||||
if (fchown(fileno(G.outfile), (uid_t)z_uidgid[0], (gid_t)z_uidgid[1]))
|
||||
#endif
|
||||
{
|
||||
if (uO.qflag)
|
||||
Info(slide, 0x201, ((char *)slide, CannotSetItemUidGid,
|
||||
z_uidgid[0], z_uidgid[1], FnFilter1(G.filename),
|
||||
strerror(errno)));
|
||||
else
|
||||
Info(slide, 0x201, ((char *)slide, CannotSetUidGid,
|
||||
z_uidgid[0], z_uidgid[1], strerror(errno)));
|
||||
}
|
||||
}
|
||||
|
||||
#if (!defined(NO_FCHOWN) && defined(NO_FCHMOD))
|
||||
fclose(G.outfile);
|
||||
#endif
|
||||
|
||||
#if (!defined(NO_FCHOWN) && !defined(NO_FCHMOD))
|
||||
/*---------------------------------------------------------------------------
|
||||
Change the file permissions from default ones to those stored in the
|
||||
zipfile.
|
||||
---------------------------------------------------------------------------*/
|
||||
|
||||
if (fchmod(fileno(G.outfile), filtattr(__G__ G.pInfo->file_attr)))
|
||||
perror("fchmod (file attributes) error");
|
||||
|
||||
fclose(G.outfile);
|
||||
#endif /* !NO_FCHOWN && !NO_FCHMOD */
|
||||
|
||||
/* skip restoring time stamps on user's request */
|
||||
if (uO.D_flag <= 1) {
|
||||
/* set the file's access and modification times */
|
||||
if (utime(G.filename, &(zt.t2))) {
|
||||
if (uO.qflag)
|
||||
Info(slide, 0x201, ((char *)slide, CannotSetItemTimestamps,
|
||||
/* siemargl: dont using extra fields */
|
||||
unsigned ftim, fdat;
|
||||
dos_to_kolibri_time(G.lrec.last_mod_dos_datetime, &fdat, &ftim);
|
||||
|
||||
fileinfo_t finfo;
|
||||
if (get_fileinfo(G.filename, &finfo))
|
||||
{
|
||||
Info(slide, 1, ((char *)slide, CannotGetTimestamps,
|
||||
FnFilter1(G.filename)));
|
||||
return;
|
||||
}
|
||||
finfo.flags = G.pInfo->file_attr;
|
||||
finfo.cr_time = finfo.acc_time = finfo.mod_time = ftim;
|
||||
finfo.cr_date = finfo.acc_date = finfo.mod_date = fdat;
|
||||
Trace((stderr, "Trying to set fileinfo[%s] date %X, time %X, attr %X\n", FnFilter1(G.filename), fdat, ftim, finfo.flags));
|
||||
|
||||
if (set_fileinfo(G.filename, &finfo))
|
||||
{
|
||||
Info(slide, 1, ((char *)slide, CannotSetItemTimestamps,
|
||||
FnFilter1(G.filename), strerror(errno)));
|
||||
else
|
||||
Info(slide, 0x201, ((char *)slide, CannotSetTimestamps,
|
||||
strerror(errno)));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -851,7 +707,6 @@ void close_outfile(__G) /* GRR: change to return PK-style warning level */
|
||||
#endif
|
||||
#endif /* NO_FCHOWN || NO_FCHMOD */
|
||||
|
||||
#endif // 0
|
||||
|
||||
} /* end function close_outfile() */
|
||||
|
||||
@ -978,3 +833,48 @@ char *do_wild(__G__ wildspec)
|
||||
|
||||
} /* end function do_wild() */
|
||||
|
||||
#ifdef SET_DIR_ATTRIB
|
||||
int defer_dir_attribs(__G__ pd)
|
||||
__GDEF
|
||||
direntry **pd;
|
||||
{
|
||||
// do nothing
|
||||
return PK_OK;
|
||||
}
|
||||
|
||||
int set_direc_attribs(__G__ d)
|
||||
__GDEF
|
||||
direntry *d;
|
||||
{
|
||||
/* skip restoring time stamps on user's request */
|
||||
if (uO.D_flag <= 0) {
|
||||
/* set the file's access and modification times */
|
||||
/* siemargl: dont using extra fields */
|
||||
unsigned ftim, fdat;
|
||||
dos_to_kolibri_time(G.lrec.last_mod_dos_datetime, &fdat, &ftim);
|
||||
|
||||
fileinfo_t finfo;
|
||||
if (get_fileinfo(G.filename, &finfo))
|
||||
{
|
||||
Info(slide, 1, ((char *)slide, CannotGetTimestamps,
|
||||
FnFilter1(G.filename)));
|
||||
return PK_WARN;
|
||||
}
|
||||
finfo.flags = G.pInfo->file_attr;
|
||||
finfo.cr_time = finfo.acc_time = finfo.mod_time = ftim;
|
||||
finfo.cr_date = finfo.acc_date = finfo.mod_date = fdat;
|
||||
Trace((stderr, "Trying to set dirinfo[%s] date %X, time %X, attr %X\n", FnFilter1(G.filename), fdat, ftim, finfo.flags));
|
||||
|
||||
if (set_fileinfo(G.filename, &finfo))
|
||||
{
|
||||
Info(slide, 1, ((char *)slide, CannotSetItemTimestamps,
|
||||
FnFilter1(G.filename), strerror(errno)));
|
||||
return PK_WARN;
|
||||
}
|
||||
}
|
||||
|
||||
return PK_OK;
|
||||
} /* end function set_direc_attribs() */
|
||||
|
||||
#endif // SET_DIR_ATTRIB
|
||||
|
||||
|
@ -8,6 +8,7 @@
|
||||
|
||||
//#include <newlib.h>
|
||||
//#include <stdint.h>
|
||||
//#include <sys/kos_io.h>
|
||||
#include <stddef.h>
|
||||
#include <stdarg.h>
|
||||
typedef unsigned int uint32_t;
|
||||
|
Loading…
Reference in New Issue
Block a user