From 42c234aecf9e6035ad6efac329a7f08a5188ae3f Mon Sep 17 00:00:00 2001 From: siemargl Date: Fri, 18 Nov 2016 16:37:20 +0000 Subject: [PATCH] start work, but buggy git-svn-id: svn://kolibrios.org@6727 a494cfbc-eb01-0410-851d-a64ba20cac60 --- programs/fs/unzip60/kolibri/Makefile.gcc | 2 +- programs/fs/unzip60/kolibri/dirent.c | 44 ++++++++++++++++++++---- programs/fs/unzip60/kolibri/kos32.c | 16 ++++----- 3 files changed, 46 insertions(+), 16 deletions(-) diff --git a/programs/fs/unzip60/kolibri/Makefile.gcc b/programs/fs/unzip60/kolibri/Makefile.gcc index 9a847207f9..a0af8c4c54 100644 --- a/programs/fs/unzip60/kolibri/Makefile.gcc +++ b/programs/fs/unzip60/kolibri/Makefile.gcc @@ -273,7 +273,7 @@ UNZIP_H = unzip.h unzpriv.h globals.h all: unzip$(EXE) unzip$(EXE): $(OBJU) $(LIBBZIP2) - $(LD) $(LDFLAGS) $(LDVER) $(OBJU) $(LD_BZ2LIB) $(LDLIBS) + $(LD) $(LDFLAGS) $(LDVER) $(OBJU) $(LD_BZ2LIB) $(LDLIBS) -Map=unzip.exe.map kos32-objcopy $@ -O binary unzipsfx$(EXE): $(OBJX) $(LIBBZIP2X) diff --git a/programs/fs/unzip60/kolibri/dirent.c b/programs/fs/unzip60/kolibri/dirent.c index da6da4bafb..2287100f9c 100644 --- a/programs/fs/unzip60/kolibri/dirent.c +++ b/programs/fs/unzip60/kolibri/dirent.c @@ -116,7 +116,7 @@ struct dirent* readdir(DIR *dirp) int rc = sf_file(1, &di); // read dir if(rc) { - fprintf(stderr, "Error %d reading dir item %s", rc, dirp->entry.d_name); + fprintf(stderr, "Error %d reading dir item %s\n", rc, dirp->entry.d_name); errno = rc; return NULL; } @@ -144,20 +144,52 @@ void rewinddir(DIR *dirp) int mkdir(const char *_path, mode_t m) { - struct fs_dirinfo di; - memset(&di, 0, sizeof di); - di.ppath = (char*)_path; + char namebuffer[1050]; // need for save data after di!!! + struct fs_dirinfo *di = (struct fs_dirinfo *)namebuffer; - int rc = sf_file(9, &di); // creat dir +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); + + int rc = sf_file(9, di); // creat dir if(rc) { - fprintf(stderr, "Error %d creating dir item %s", rc, _path); + fprintf(stderr, "Error %d creating dir item %s\n", rc, _path); errno = rc; return -1; } +debug_board_printf("mkdir end (%s)\n", _path); return 0; } +//////////////////////////////////////////////////////////////////////////////////////// +void __attribute__ ((noinline)) debug_board_write_str(const char* str){ + while(*str) + debug_board_write_byte(*str++); +} + +void __attribute__ ((noinline)) debug_board_printf(const char *format,...) +{ + va_list ap; + char log_board[300]; + + va_start (ap, format); + vsnprintf(log_board, sizeof log_board, format, ap); + va_end(ap); + debug_board_write_str(log_board); +} + +__attribute__ ((noinline)) void trap(int n) +{ + // nothing todo, just see n in debugger. use "bp trap" command + __asm__ __volatile__( + "nop" + : + :"a"(n)); +} + + /* tested example void* read_folderdata(char* name) diff --git a/programs/fs/unzip60/kolibri/kos32.c b/programs/fs/unzip60/kolibri/kos32.c index d37aa1b6df..a87efe165d 100644 --- a/programs/fs/unzip60/kolibri/kos32.c +++ b/programs/fs/unzip60/kolibri/kos32.c @@ -91,13 +91,9 @@ int mapattr(__G) /********************************************************************************************************************/ -/*** Function checkdir() */ +/*** Function mapname() */ /********************************************************************************************************************/ -/************************/ -/* Function mapname() */ -/************************/ - int mapname(__G__ renamed) __GDEF int renamed; @@ -212,7 +208,8 @@ int mapname(__G__ renamed) /* disable control character filter when requested, * else allow 8-bit characters (e.g. UTF-8) in filenames: */ - ; + if ((isprint(workch) || (128 <= workch && workch <= 254))) + *pp++ = (char)workch; /*kos if (uO.cflxflag || (isprint(workch) || (128 <= workch && workch <= 254))) @@ -350,9 +347,10 @@ int mapname(__G__ renamed) -/***********************/ -/* Function checkdir() */ -/***********************/ +/********************************************************************************************************************/ +/*** Function checkdir() */ +/********************************************************************************************************************/ + int checkdir(__G__ pathcomp, flag) __GDEF