diff options
| author | Wiimm <none> | 2020-09-30 15:43:02 +0200 |
|---|---|---|
| committer | Wiimm <none> | 2020-09-30 15:43:02 +0200 |
| commit | 50a8c14d2acb20822baff451b35476d717ffc5b4 (patch) | |
| tree | ba286f8307130b9143bc43e20978927c94a8f65b | |
| parent | 646b95d113309378591b75a290ee6c62a04f3772 (diff) | |
SZS v2.20a.beta2: Test Mac build
| -rw-r--r-- | project/Makefile | 2 | ||||
| -rw-r--r-- | project/dclib/dclib-file.c | 13 | ||||
| -rw-r--r-- | project/dclib/dclib-file.h | 15 | ||||
| -rw-r--r--[-rwxr-xr-x] | project/gen-template.sh | 0 | ||||
| -rw-r--r--[-rwxr-xr-x] | project/gen-text-file.sh | 0 | ||||
| -rw-r--r-- | project/src/lib-kmp-text.c | 2 | ||||
| -rw-r--r-- | project/src/lib-std.c | 37 | ||||
| -rw-r--r-- | project/src/lib-std.h | 2 | ||||
| -rw-r--r-- | project/src/lib-szs-create.c | 2 | ||||
| -rw-r--r-- | project/src/wbmgt.c | 23 | ||||
| -rw-r--r-- | project/src/wctct.c | 23 | ||||
| -rw-r--r-- | project/src/wimgt.c | 23 | ||||
| -rw-r--r-- | project/src/wkclt.c | 23 | ||||
| -rw-r--r-- | project/src/wkmpt.c | 23 | ||||
| -rw-r--r-- | project/src/wlect.c | 23 | ||||
| -rw-r--r-- | project/src/wmdlt.c | 23 | ||||
| -rw-r--r-- | project/src/wpatt.c | 23 | ||||
| -rw-r--r-- | project/src/wstrt.c | 23 | ||||
| -rw-r--r-- | project/src/wszst.c | 25 |
19 files changed, 71 insertions, 234 deletions
diff --git a/project/Makefile b/project/Makefile index 4190bbc..f8f1821 100644 --- a/project/Makefile +++ b/project/Makefile @@ -59,7 +59,7 @@ WSTRT_SHORT = wstrt WSTRT_LONG = Wiimms StaticR Tool VERSION_NUM = 2.20a -BETA_VERSION = 1 +BETA_VERSION = 2 # 0:off -1:"beta" >0:"beta#" URI_HOME = https://szs.wiimm.de/ diff --git a/project/dclib/dclib-file.c b/project/dclib/dclib-file.c index a4849e3..2cc8fa1 100644 --- a/project/dclib/dclib-file.c +++ b/project/dclib/dclib-file.c @@ -198,7 +198,7 @@ FileAttrib_t * ClearFileAttrib FileAttrib_t * dest // NULL or destination attribute ) { - #if USE_NEW_FILEATTRIB + #if HAVE_FILEATTRIB_NSEC if (dest) { memset(dest,0,sizeof(*dest)); @@ -222,7 +222,7 @@ FileAttrib_t * TouchFileAttrib ) { DASSERT(dest); - #if USE_NEW_FILEATTRIB + #if HAVE_FILEATTRIB_NSEC struct timeval tv; if (!gettimeofday(&tv,0)) { @@ -248,7 +248,7 @@ FileAttrib_t * SetFileAttrib { DASSERT(dest); - #if USE_NEW_FILEATTRIB + #if HAVE_FILEATTRIB_NSEC if (src_fa) memcpy(dest,src_fa,sizeof(*dest)); @@ -302,7 +302,7 @@ FileAttrib_t * MaxFileAttrib { DASSERT(dest); - #if USE_NEW_FILEATTRIB + #if HAVE_FILEATTRIB_NSEC if (src_fa) { @@ -387,7 +387,7 @@ FileAttrib_t * NormalizeFileAttrib if ( fa->size < 0 ) fa->size = 0; - #if USE_NEW_FILEATTRIB + #if HAVE_FILEATTRIB_NSEC if (IsTimeSpecNull(&fa->mtime)) { @@ -850,7 +850,7 @@ enumError CloseFile TRACE("UNLINK %s\n",f->fname); unlink(f->fname); } - #if USE_NEW_FILEATTRIB + #if HAVE_FILEATTRIB_NSEC else if ( set_time == 1 && !IsTimeSpecNull(&f->fatt.mtime) ) utimensat(AT_FDCWD,f->fname,f->fatt.times,0); #else @@ -860,6 +860,7 @@ enumError CloseFile ubuf.actime = f->fatt.atime ? f->fatt.atime : f->fatt.mtime; ubuf.modtime = f->fatt.mtime; + utime(f->fname,&ubuf); } #endif else if ( set_time > 1 || f->fmode & FM_TOUCH ) diff --git a/project/dclib/dclib-file.h b/project/dclib/dclib-file.h index d2be55c..1060cd1 100644 --- a/project/dclib/dclib-file.h +++ b/project/dclib/dclib-file.h @@ -127,15 +127,22 @@ ccp GetFileOpenMode /////////////// struct FileAttrib_t /////////////// /////////////////////////////////////////////////////////////////////////////// -#ifndef USE_NEW_FILEATTRIB - #define USE_NEW_FILEATTRIB 1 +#ifndef HAVE_FILEATTRIB_NSEC + #ifdef st_mtime + #define HAVE_FILEATTRIB_NSEC 1 + #else + #define HAVE_FILEATTRIB_NSEC 0 + #endif #endif #undef FILEATTRIB_SEC -#if USE_NEW_FILEATTRIB +#undef FILEATTRIB_NSEC +#if HAVE_FILEATTRIB_NSEC #define FILEATTRIB_SEC(t) ((t).tv_sec) + #define FILEATTRIB_NSEC(t) ((t).tv_nsec) #else #define FILEATTRIB_SEC(t) (t) + #define FILEATTRIB_NSEC(t) 0 #endif /////////////////////////////////////////////////////////////////////////////// @@ -143,7 +150,7 @@ ccp GetFileOpenMode typedef struct FileAttrib_t { - #if USE_NEW_FILEATTRIB + #if HAVE_FILEATTRIB_NSEC union { diff --git a/project/gen-template.sh b/project/gen-template.sh index 7e137dd..7e137dd 100755..100644 --- a/project/gen-template.sh +++ b/project/gen-template.sh diff --git a/project/gen-text-file.sh b/project/gen-text-file.sh index 428a8a9..428a8a9 100755..100644 --- a/project/gen-text-file.sh +++ b/project/gen-text-file.sh diff --git a/project/src/lib-kmp-text.c b/project/src/lib-kmp-text.c index 98cf31d..6e6ab87 100644 --- a/project/src/lib-kmp-text.c +++ b/project/src/lib-kmp-text.c @@ -6330,7 +6330,7 @@ enumError SaveTextKMP DASSERT(kmp); DASSERT(fname); - #if USE_NEW_FILEATTRIB + #if HAVE_FILEATTRIB_NSEC PRINT("SaveTextKMP(%s,%d) mtime=%lu\n",fname,set_time,kmp->fatt.mtime.tv_sec); #else PRINT("SaveTextKMP(%s,%d) mtime=%lu\n",fname,set_time,kmp->fatt.mtime); diff --git a/project/src/lib-std.c b/project/src/lib-std.c index 11526cb..95e6e64 100644 --- a/project/src/lib-std.c +++ b/project/src/lib-std.c @@ -3773,6 +3773,43 @@ int ScanOptSort ( ccp arg ) // /////////////////////////////////////////////////////////////////////////////// +/////////////// command version/section /////////////// +/////////////////////////////////////////////////////////////////////////////// + +void cmd_version_section ( bool sect_header, ccp name_short, ccp name_long ) +{ + if (sect_header) + fputs("[version]\n",stdout); + + const u32 base = 0x04030201; + const u8 * e = (u8*)&base; + const u32 endian = be32(e); + + printf( "prog=%s\n" + "name=%s\n" + "version=" VERSION "\n" + "beta=%d\n" + "revision=" REVISION "\n" + "system=" SYSTEM "\n" + "endian=%u%u%u%u %s\n" + "have_nanosec=%d\n" + "author=" AUTHOR "\n" + "date=" DATE "\n" + "url=" URI_HOME "%s\n" + "\n" + , name_short + , name_long + , BETA_VERSION + , e[0], e[1], e[2], e[3] + , endian == 0x01020304 ? "little" + : endian == 0x04030201 ? "big" : "mixed" + , HAVE_FILEATTRIB_NSEC + , name_short + ); +} + +// +/////////////////////////////////////////////////////////////////////////////// /////////////// command argtest /////////////// /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/lib-std.h b/project/src/lib-std.h index 51e69db..ffda6b9 100644 --- a/project/src/lib-std.h +++ b/project/src/lib-std.h @@ -2017,6 +2017,8 @@ data_tab_t; /////////////////////////////////////////////////////////////////////////////// +void cmd_version_section ( bool sect_header, ccp name_short, ccp name_long ); + enumError cmd_argtest ( int argc, char ** argv ); enumError cmd_error(); enumError cmd_filetype(); diff --git a/project/src/lib-szs-create.c b/project/src/lib-szs-create.c index 1907542..d0962ba 100644 --- a/project/src/lib-szs-create.c +++ b/project/src/lib-szs-create.c @@ -808,7 +808,7 @@ enumError CreateSZS { StringCopyE( sd.path_rel, sd.path+sizeof(sd.path), *ptr ); struct stat st; - #if USE_NEW_FILEATTRIB + #if HAVE_FILEATTRIB_NSEC if ( stat(sd.path,&st) || CompareTimeSpec(&st.st_mtim,&szs.fatt.mtime) < 0 ) #else const time_t mtime = stat(sd.path,&st) ? 0 : st.st_mtime; diff --git a/project/src/wbmgt.c b/project/src/wbmgt.c index 87ba3ce..163d9cc 100644 --- a/project/src/wbmgt.c +++ b/project/src/wbmgt.c @@ -86,28 +86,7 @@ static void help_exit ( bool xmode ) static void print_version_section ( bool print_sect_header ) { - if (print_sect_header) - fputs("[version]\n",stdout); - - const u32 base = 0x04030201; - const u8 * e = (u8*)&base; - const u32 endian = be32(e); - - printf( "prog=" WBMGT_SHORT "\n" - "name=" WBMGT_LONG "\n" - "version=" VERSION "\n" - "beta=%d\n" - "revision=" REVISION "\n" - "system=" SYSTEM "\n" - "endian=%u%u%u%u %s\n" - "author=" AUTHOR "\n" - "date=" DATE "\n" - "url=" URI_HOME WBMGT_SHORT "\n" - "\n" - , BETA_VERSION - , e[0], e[1], e[2], e[3] - , endian == 0x01020304 ? "little" - : endian == 0x04030201 ? "big" : "mixed" ); + cmd_version_section(print_sect_header,WBMGT_SHORT,WBMGT_LONG); } /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/wctct.c b/project/src/wctct.c index 6f1db93..8b5d4a4 100644 --- a/project/src/wctct.c +++ b/project/src/wctct.c @@ -76,28 +76,7 @@ static void help_exit ( bool xmode ) static void print_version_section ( bool print_sect_header ) { - if (print_sect_header) - fputs("[version]\n",stdout); - - const u32 base = 0x04030201; - const u8 * e = (u8*)&base; - const u32 endian = be32(e); - - printf( "prog=" WCTCT_SHORT "\n" - "name=" WCTCT_LONG "\n" - "version=" VERSION "\n" - "beta=%d\n" - "revision=" REVISION "\n" - "system=" SYSTEM "\n" - "endian=%u%u%u%u %s\n" - "author=" AUTHOR "\n" - "date=" DATE "\n" - "url=" URI_HOME WCTCT_SHORT "\n" - "\n" - , BETA_VERSION - , e[0], e[1], e[2], e[3] - , endian == 0x01020304 ? "little" - : endian == 0x04030201 ? "big" : "mixed" ); + cmd_version_section(print_sect_header,WCTCT_SHORT,WCTCT_LONG); } /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/wimgt.c b/project/src/wimgt.c index 4acb1c1..4abd6b6 100644 --- a/project/src/wimgt.c +++ b/project/src/wimgt.c @@ -82,28 +82,7 @@ static void help_exit ( bool xmode ) static void print_version_section ( bool print_sect_header ) { - if (print_sect_header) - fputs("[version]\n",stdout); - - const u32 base = 0x04030201; - const u8 * e = (u8*)&base; - const u32 endian = be32(e); - - printf( "prog=" WIMGT_SHORT "\n" - "name=" WIMGT_LONG "\n" - "version=" VERSION "\n" - "beta=%d\n" - "revision=" REVISION "\n" - "system=" SYSTEM "\n" - "endian=%u%u%u%u %s\n" - "author=" AUTHOR "\n" - "date=" DATE "\n" - "url=" URI_HOME WIMGT_SHORT "\n" - "\n" - , BETA_VERSION - , e[0], e[1], e[2], e[3] - , endian == 0x01020304 ? "little" - : endian == 0x04030201 ? "big" : "mixed" ); + cmd_version_section(print_sect_header,WIMGT_SHORT,WIMGT_LONG); } /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/wkclt.c b/project/src/wkclt.c index 49f5742..80eed98 100644 --- a/project/src/wkclt.c +++ b/project/src/wkclt.c @@ -76,28 +76,7 @@ static void help_exit ( bool xmode ) static void print_version_section ( bool print_sect_header ) { - if (print_sect_header) - fputs("[version]\n",stdout); - - const u32 base = 0x04030201; - const u8 * e = (u8*)&base; - const u32 endian = be32(e); - - printf( "prog=" WKCLT_SHORT "\n" - "name=" WKCLT_LONG "\n" - "version=" VERSION "\n" - "beta=%d\n" - "revision=" REVISION "\n" - "system=" SYSTEM "\n" - "endian=%u%u%u%u %s\n" - "author=" AUTHOR "\n" - "date=" DATE "\n" - "url=" URI_HOME WKCLT_SHORT "\n" - "\n" - , BETA_VERSION - , e[0], e[1], e[2], e[3] - , endian == 0x01020304 ? "little" - : endian == 0x04030201 ? "big" : "mixed" ); + cmd_version_section(print_sect_header,WKCLT_SHORT,WKCLT_LONG); } /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/wkmpt.c b/project/src/wkmpt.c index b2bb4ee..1903e53 100644 --- a/project/src/wkmpt.c +++ b/project/src/wkmpt.c @@ -77,28 +77,7 @@ static void help_exit ( bool xmode ) static void print_version_section ( bool print_sect_header ) { - if (print_sect_header) - fputs("[version]\n",stdout); - - const u32 base = 0x04030201; - const u8 * e = (u8*)&base; - const u32 endian = be32(e); - - printf( "prog=" WKMPT_SHORT "\n" - "name=" WKMPT_LONG "\n" - "version=" VERSION "\n" - "beta=%d\n" - "revision=" REVISION "\n" - "system=" SYSTEM "\n" - "endian=%u%u%u%u %s\n" - "author=" AUTHOR "\n" - "date=" DATE "\n" - "url=" URI_HOME WKMPT_SHORT "\n" - "\n" - , BETA_VERSION - , e[0], e[1], e[2], e[3] - , endian == 0x01020304 ? "little" - : endian == 0x04030201 ? "big" : "mixed" ); + cmd_version_section(print_sect_header,WKMPT_SHORT,WKMPT_LONG); } /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/wlect.c b/project/src/wlect.c index 373cd27..d33c3df 100644 --- a/project/src/wlect.c +++ b/project/src/wlect.c @@ -78,28 +78,7 @@ static void help_exit ( bool xmode ) static void print_version_section ( bool print_sect_header ) { - if (print_sect_header) - fputs("[version]\n",stdout); - - const u32 base = 0x04030201; - const u8 * e = (u8*)&base; - const u32 endian = be32(e); - - printf( "prog=" WLECT_SHORT "\n" - "name=" WLECT_LONG "\n" - "version=" VERSION "\n" - "beta=%d\n" - "revision=" REVISION "\n" - "system=" SYSTEM "\n" - "endian=%u%u%u%u %s\n" - "author=" AUTHOR "\n" - "date=" DATE "\n" - "url=" URI_HOME WLECT_SHORT "\n" - "\n" - , BETA_VERSION - , e[0], e[1], e[2], e[3] - , endian == 0x01020304 ? "little" - : endian == 0x04030201 ? "big" : "mixed" ); + cmd_version_section(print_sect_header,WLECT_SHORT,WLECT_LONG); } /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/wmdlt.c b/project/src/wmdlt.c index fcfc034..868dfe7 100644 --- a/project/src/wmdlt.c +++ b/project/src/wmdlt.c @@ -71,28 +71,7 @@ static void help_exit ( bool xmode ) static void print_version_section ( bool print_sect_header ) { - if (print_sect_header) - fputs("[version]\n",stdout); - - const u32 base = 0x04030201; - const u8 * e = (u8*)&base; - const u32 endian = be32(e); - - printf( "prog=" WMDLT_SHORT "\n" - "name=" WMDLT_LONG "\n" - "version=" VERSION "\n" - "beta=%d\n" - "revision=" REVISION "\n" - "system=" SYSTEM "\n" - "endian=%u%u%u%u %s\n" - "author=" AUTHOR "\n" - "date=" DATE "\n" - "url=" URI_HOME WMDLT_SHORT "\n" - "\n" - , BETA_VERSION - , e[0], e[1], e[2], e[3] - , endian == 0x01020304 ? "little" - : endian == 0x04030201 ? "big" : "mixed" ); + cmd_version_section(print_sect_header,WMDLT_SHORT,WMDLT_LONG); } /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/wpatt.c b/project/src/wpatt.c index dbcdc7c..02ce122 100644 --- a/project/src/wpatt.c +++ b/project/src/wpatt.c @@ -71,28 +71,7 @@ static void help_exit ( bool xmode ) static void print_version_section ( bool print_sect_header ) { - if (print_sect_header) - fputs("[version]\n",stdout); - - const u32 base = 0x04030201; - const u8 * e = (u8*)&base; - const u32 endian = be32(e); - - printf( "prog=" WPATT_SHORT "\n" - "name=" WPATT_LONG "\n" - "version=" VERSION "\n" - "beta=%d\n" - "revision=" REVISION "\n" - "system=" SYSTEM "\n" - "endian=%u%u%u%u %s\n" - "author=" AUTHOR "\n" - "date=" DATE "\n" - "url=" URI_HOME WPATT_SHORT "\n" - "\n" - , BETA_VERSION - , e[0], e[1], e[2], e[3] - , endian == 0x01020304 ? "little" - : endian == 0x04030201 ? "big" : "mixed" ); + cmd_version_section(print_sect_header,WPATT_SHORT,WPATT_LONG); } /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/wstrt.c b/project/src/wstrt.c index a384f45..f2e9c89 100644 --- a/project/src/wstrt.c +++ b/project/src/wstrt.c @@ -83,28 +83,7 @@ static void help_exit ( bool xmode ) static void print_version_section ( bool print_sect_header ) { - if (print_sect_header) - fputs("[version]\n",stdout); - - const u32 base = 0x04030201; - const u8 * e = (u8*)&base; - const u32 endian = be32(e); - - printf( "prog=" WSTRT_SHORT "\n" - "name=" WSTRT_LONG "\n" - "version=" VERSION "\n" - "beta=%d\n" - "revision=" REVISION "\n" - "system=" SYSTEM "\n" - "endian=%u%u%u%u %s\n" - "author=" AUTHOR "\n" - "date=" DATE "\n" - "url=" URI_HOME WSTRT_SHORT "\n" - "\n" - , BETA_VERSION - , e[0], e[1], e[2], e[3] - , endian == 0x01020304 ? "little" - : endian == 0x04030201 ? "big" : "mixed" ); + cmd_version_section(print_sect_header,WSTRT_SHORT,WSTRT_LONG); } /////////////////////////////////////////////////////////////////////////////// diff --git a/project/src/wszst.c b/project/src/wszst.c index 7ca33f1..15100f2 100644 --- a/project/src/wszst.c +++ b/project/src/wszst.c @@ -177,28 +177,7 @@ static void list_compressions_exit() static void print_version_section ( bool print_sect_header ) { - if (print_sect_header) - fputs("[version]\n",stdout); - - const u32 base = 0x04030201; - const u8 * e = (u8*)&base; - const u32 endian = be32(e); - - printf( "prog=" WSZST_SHORT "\n" - "name=" WSZST_LONG "\n" - "version=" VERSION "\n" - "beta=%d\n" - "revision=" REVISION "\n" - "system=" SYSTEM "\n" - "endian=%u%u%u%u %s\n" - "author=" AUTHOR "\n" - "date=" DATE "\n" - "url=" URI_HOME WSZST_SHORT "\n" - "\n" - , BETA_VERSION - , e[0], e[1], e[2], e[3] - , endian == 0x01020304 ? "little" - : endian == 0x04030201 ? "big" : "mixed" ); + cmd_version_section(print_sect_header,WSZST_SHORT,WSZST_LONG); } /////////////////////////////////////////////////////////////////////////////// @@ -1806,7 +1785,7 @@ static enumError cmd_sha1() { if (long_count>1) { - #if USE_NEW_FILEATTRIB + #if HAVE_FILEATTRIB_NSEC struct tm * tm = localtime(&szs.fatt.mtime.tv_sec); #else struct tm * tm = localtime(&szs.fatt.mtime); |
