diff -Nru vfu-5.01/COMPILE.NOTES vfu-5.07/COMPILE.NOTES --- vfu-5.01/COMPILE.NOTES 2023-02-02 21:54:50.000000000 +0000 +++ vfu-5.07/COMPILE.NOTES 2023-02-12 15:45:10.000000000 +0000 @@ -46,5 +46,5 @@ VFU should compile without big problems on any UNIX (hope so:)) P! Vladi. - Vladi Belperchinov-Shabanski + Vladi Belperchinov-Shabanski diff -Nru vfu-5.01/CONFIG vfu-5.07/CONFIG --- vfu-5.01/CONFIG 2023-02-02 21:54:50.000000000 +0000 +++ vfu-5.07/CONFIG 2023-02-12 15:45:10.000000000 +0000 @@ -40,7 +40,7 @@ Vladi Belperchinov-Shabanski - + https://cade.noxrun.com/projects/vfu ------------------------------------------------------------------------ diff -Nru vfu-5.01/debian/changelog vfu-5.07/debian/changelog --- vfu-5.01/debian/changelog 2023-02-02 21:57:27.000000000 +0000 +++ vfu-5.07/debian/changelog 2023-02-12 22:06:28.000000000 +0000 @@ -1,3 +1,10 @@ +vfu (5.07-1) unstable; urgency=medium + + * New upstream release 5.07 + - many important bugfixes from upstream + + -- Boian Bonev Sun, 12 Feb 2023 22:06:28 +0000 + vfu (5.01-1) unstable; urgency=medium * New upstream release 5.01 diff -Nru vfu-5.01/debian/README.Debian vfu-5.07/debian/README.Debian --- vfu-5.01/debian/README.Debian 2020-08-09 01:31:25.000000000 +0000 +++ vfu-5.07/debian/README.Debian 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -vfu for DEBIAN --------------- - -I could not reproduce the problems with colors the author states he has when -running under X. If you experience such problems please contact me and/or -the upstream author so we can work out the problem. - -And, of course, any comments are appreciated. - - -- Mika Fischer , Fri, 26 Mar 1999 12:00:00 +0100 diff -Nru vfu-5.01/debian/rules vfu-5.07/debian/rules --- vfu-5.01/debian/rules 2023-02-02 21:42:06.000000000 +0000 +++ vfu-5.07/debian/rules 2023-02-12 22:06:28.000000000 +0000 @@ -1,6 +1,6 @@ #!/usr/bin/make -f -export DEB_BUILD_MAINT_OPTIONS+=hardening=+bindnow +export DEB_BUILD_MAINT_OPTIONS+=hardening=+all %: dh $@ --buildsystem=makefile --without=autoreconf @@ -11,6 +11,6 @@ V=1 override_dh_auto_install: - install vfu/vfu.yas debian/vfu/usr/bin/vfu - install rx/rx_* debian/vfu/usr/libexec/vfu - install -m644 vfu.conf debian/vfu/etc + install -DT vfu/vfu.yas debian/vfu/usr/bin/vfu + install -DT -m644 vfu.conf debian/vfu/etc/vfu.conf + install -Dt debian/vfu/usr/libexec/vfu rx/rx_* diff -Nru vfu-5.01/GIT_HISTORY vfu-5.07/GIT_HISTORY --- vfu-5.01/GIT_HISTORY 2023-02-02 22:10:11.000000000 +0000 +++ vfu-5.07/GIT_HISTORY 2023-02-12 21:18:30.000000000 +0000 @@ -1,3 +1,178 @@ +commit 3603858edf3d5ac5f113552bd180abf3348cac58 +Author: Vladi Belperchinov-Shabanski +Date: Sun Feb 12 23:13:22 2023 +0200 + + r5.07 + +commit f0111b708b41588a878b16a6f3ac68eb11df64d1 +Author: Vladi Belperchinov-Shabanski +Date: Sun Feb 12 22:53:11 2023 +0200 + + r5.05 + +commit 1cb1dbcc3903b7b9820cd66f41030b802dc5cc5b +Author: Vladi Belperchinov-Shabanski +Date: Sun Feb 12 22:51:24 2023 +0200 + + maint + +commit 704cdbee482bbf06376764be91569b9ac55fe908 +Merge: bb7e01c dfc0e98 +Author: Vladi Belperchinov-Shabanski +Date: Sun Feb 12 22:30:09 2023 +0200 + + Merge branch 'master' of github.com:cade-vs/vfu-dist + +commit bb7e01c190fca9f262d673242aa83e570598b955 +Author: Vladi Belperchinov-Shabanski +Date: Sun Feb 12 22:29:50 2023 +0200 + + r5.04 + +commit dfc0e981c1be02979fb6bd6082c36fb173e1103b +Merge: 1acfcc5 6ee5b95 +Author: Vladi Belperchinov-Shabanski +Date: Sat Feb 11 03:08:42 2023 +0200 + + Merge pull request #13 from bbonev/master + + half working + +commit 6ee5b950d23e11c5fbbe03000bfe2b66bdb10d8a +Merge: 71a4b6c 1acfcc5 +Author: Boian Bonev +Date: Sat Feb 11 03:07:19 2023 +0200 + + Merge branch 'cade-vs:master' into master + +commit 71a4b6c324f472ac245526e27fb10a5e9c7dca2b +Author: Boian Bonev +Date: Sat Feb 11 01:02:32 2023 +0000 + + set ar/ranlib + +commit ae9b61027d2ddb7190c99f283dad2246add93f40 +Author: Boian Bonev +Date: Sat Feb 11 00:57:02 2023 +0000 + + always set cc + +commit 5c7eb95be49e9c45405465a8cbbcb8537a6426ba +Author: Boian Bonev +Date: Sat Feb 11 00:47:07 2023 +0000 + + apply flto config to all projects + +commit 9ddcbc78b8f72807d0321f9040509ca793d47993 +Author: Boian Bonev +Date: Sat Feb 11 00:43:39 2023 +0000 + + simplify + +commit 1cc1e73fd87e0339f087e00d80ca08e82170d505 +Author: Boian Bonev +Date: Sat Feb 11 00:41:10 2023 +0000 + + clang 13+ understands -flto=auto + +commit d7de1d04feea8214857473ad1b314f1f7a0dda3e +Author: Boian Bonev +Date: Sat Feb 11 00:36:30 2023 +0000 + + be more verbose + +commit 969dc323d1d9acbab9320398bfef3cce3d35f907 +Author: Boian Bonev +Date: Sat Feb 11 00:33:03 2023 +0000 + + use different flto build with old clang + +commit 66e6cf8c95f9e1e96c3bfb06b5498f4c9b380c47 +Author: Boian Bonev +Date: Sat Feb 11 00:25:16 2023 +0000 + + fix paths(2); verbose build + +commit 2de2d664d4d0d9ea6aa6d12f07f31a6a6f793955 +Author: Boian Bonev +Date: Sat Feb 11 00:21:24 2023 +0000 + + fix paths + +commit 45dbfa03a4fe2937339c2462bcef80155e32d4cd +Author: Boian Bonev +Date: Sat Feb 11 00:18:53 2023 +0000 + + properly prepare yascreen.pc in build dir + +commit caa7ef5a6010358ff5a814786c5a790b9fc040eb +Author: Boian Bonev +Date: Sat Feb 11 00:13:33 2023 +0000 + + do not build man page + +commit 6407b19931d4bd2fe8db8a244cbab69297113072 +Author: Boian Bonev +Date: Sat Feb 11 00:11:05 2023 +0000 + + build yascreen without flto with ancient compilers; install it afterwards + +commit 1acfcc53b04a05e8bc4439be9ede61cea5cbea0f +Author: Vladi Belperchinov-Shabanski +Date: Sat Feb 11 01:58:11 2023 +0200 + + maint + +commit a62c3ed165637998033ff3769f37ceb949fc9567 +Merge: 4446bb6 599c4d3 +Author: Vladi Belperchinov-Shabanski +Date: Sat Feb 11 01:52:48 2023 +0200 + + maint + +commit 4446bb64dff9cd93213cc375cb24dd3e568be70e +Author: Vladi Belperchinov-Shabanski +Date: Sat Feb 11 01:52:15 2023 +0200 + + maint + +commit 599c4d35e26e201f13cd70e078952c3f8cda0eb9 +Merge: ffeb537 dbb7b89 +Author: Vladi Belperchinov-Shabanski +Date: Sat Feb 11 01:27:54 2023 +0200 + + Merge pull request #12 from andy5995/ci/fix-workflow + + ci: fix workflow, add matrix + +commit ffeb537c76e03f9ea6988964567fc86f673171bc +Merge: c36efbc 2954780 +Author: Vladi Belperchinov-Shabanski +Date: Sat Feb 11 00:59:48 2023 +0200 + + Merge branch 'master' of github.com:cade-vs/vfu-dist + +commit c36efbc192a356de08832c6f3475e7eb7af8cd23 +Author: Vladi Belperchinov-Shabanski +Date: Sat Feb 11 00:59:13 2023 +0200 + + 5.02 + +commit dbb7b89f02c444419f80cdff3235d1c831b396b0 +Author: andy5995 +Date: Mon Feb 6 19:19:23 2023 -0600 + + ci: fix workflow, add matrix + +commit 2954780fbe7cf374fbf5b38208f84096d43f2cfa +Merge: b8faed9 3df362e +Author: Vladi Belperchinov-Shabanski +Date: Tue Feb 7 01:42:37 2023 +0200 + + Merge pull request #11 from andy5995/ci/add-initial-workflow + + ci: add initial workflow + commit b8faed984af37b53542874a81da80bd96fec9398 Author: Vladi Belperchinov-Shabanski Date: Fri Feb 3 00:09:51 2023 +0200 @@ -22,6 +197,12 @@ cleanup-of-extras +commit 3df362ee16e9b148ff1becd94f6063b0f657bf40 +Author: andy5995 +Date: Tue Jan 31 15:34:25 2023 -0600 + + ci: add initial workflow + commit 3b6a99c7883f0cb8caf35e9b23ce0c813ccd49bf Author: Vladi Belperchinov-Shabanski Date: Tue Jan 31 12:52:08 2023 +0200 diff -Nru vfu-5.01/HISTORY vfu-5.07/HISTORY --- vfu-5.01/HISTORY 2023-01-29 23:45:49.000000000 +0000 +++ vfu-5.07/HISTORY 2023-02-12 21:14:03.000000000 +0000 @@ -18,6 +18,29 @@ ! bugfix % note + 5.07: 12.Feb.2023 (yeah...) + + 5.05: 12.Feb.2023 (11 minutes later) + + + 1. Added rx support for *.tar.zst archives. + + 5.04: 12.Feb.2023 (includes 5.03 changes) + + ! 1. Fixed filename matching for corner cases. + ! 2. Fixed rx_auto searching. + + 5.02: 11.Feb.2023 (includes 5.01 changes) + + ! 1. proper unicode padding for uid/gid/hostname + ! 2. refresh views cleanup + ! 3. init data setup cleanup + + 4. dir sizes menu: added "missing dirs size calc" (keys Z, M) + ! 5. load settings loading optimized + ! 6. added getdirname helper menu ctrl-o + + 7. dir menu allows negative-xy + ! 8. get dir name glob and complete are fixed + + 9. added option in dir sizes menu (key Z) to delete cache + 5.00: 30.Jan.2023 + 1. Added full wide char (unicode) support. VFU now implements Level 1 diff -Nru vfu-5.01/README.MAC_OSX vfu-5.07/README.MAC_OSX --- vfu-5.01/README.MAC_OSX 2023-02-02 21:54:50.000000000 +0000 +++ vfu-5.07/README.MAC_OSX 2023-02-12 15:45:10.000000000 +0000 @@ -27,7 +27,6 @@ please, contact me at these email addresses: cade@bis.bg - cade@biscom.net cade@noxrun.com diff -Nru vfu-5.01/rx/rx_auto vfu-5.07/rx/rx_auto --- vfu-5.01/rx/rx_auto 2021-11-19 01:04:19.000000000 +0000 +++ vfu-5.07/rx/rx_auto 2023-02-12 20:53:32.000000000 +0000 @@ -25,15 +25,17 @@ unlink $_; } -my $rx = choose( $file ) or die "$0: this file type is not nown to me, sorry\n"; +my $rx = choose( $file ) or die "$0: this file type is not known to me, sorry\n"; -exec( '/usr/libexec/vfu/'.$rx, @ARGV ); +exec_if_exists( "/usr/libexec/vfu/$rx", @ARGV ); +exec_if_exists( "$ENV{HOME}/bin/$rx", @ARGV ); +die "$0: cannot find and/or execute [$rx]\n"; sub choose { local $_ = shift; - return "rx_tar" if /\.(?:tar(?:\.(?:z|gz|xz|bz2))?|t[bgx]z)$/i; - return "rx_zip" if /\.(?:zip|jar|pk3|egg|maff)$/i; + return "rx_tar" if /\.(tar(\.(z|gz|xz|bz2|zst))?|t[bgx]z)$/i; + return "rx_zip" if /\.(zip|jar|pk3|egg|maff)$/i; return "rx_deb" if /\.deb$/i; return "rx_ftp" if /\.ftp$/i; return "rx_rar" if /\.rar$/i; @@ -46,3 +48,9 @@ return (stat($_[0]))[9]; } +sub exec_if_exists +{ + my $rxbin = shift; + return undef unless -x $rxbin; + exec( $rxbin, @_ ); +} diff -Nru vfu-5.01/rx/rx_tar vfu-5.07/rx/rx_tar --- vfu-5.01/rx/rx_tar 2023-01-29 23:45:49.000000000 +0000 +++ vfu-5.07/rx/rx_tar 2023-02-12 20:53:32.000000000 +0000 @@ -34,6 +34,7 @@ system( qq[ umask 0077; gzip -dc "$archive" | tar tvf - > "$cache" ] ) if $archive =~ /\.tgz$/i; system( qq[ umask 0077; xz -dc "$archive" | tar tvf - > "$cache" ] ) if $archive =~ /(\.txz|\.tar\.xz(\.rx\.cache)?)$/i; system( qq[ umask 0077; bzip2 -dc "$archive" | tar tvf - > "$cache" ] ) if $archive =~ /\.tar\.bz2?$/i; + system( qq[ umask 0077; zstd -dc "$archive" | tar tvf - > "$cache" ] ) if $archive =~ /\.tar\.zst$/i; } else { @@ -41,8 +42,8 @@ } my $content = read_archive( $cache ); - use Data::Dumper; - print Dumper( $content ); +# use Data::Dumper; +# print Dumper( $content ); if ( $cmd eq "l" ) { @@ -69,11 +70,11 @@ } else { - $list = "/tmp/$$.rx.list"; + $list = "/tmp/rx.$$.rxlist"; - my $fo; - sysopen $fo, $list, O_CREAT | O_EXCL, 0600; + sysopen my $fo, $list, O_CREAT | O_EXCL | O_RDWR, 0600; print $fo "$_\n" for @ARGV; + print STDERR "[$_]\n" for @ARGV; close $fo; } system( qq[ tar xvf "$archive" -T "$list" ] ) if $archive =~ /\.tar$/i; @@ -82,6 +83,7 @@ system( qq[ xz -dc "$archive" | tar xvf - -T "$list" ] ) if $archive =~ /\.tar\.xz(\.rx\.cache)?$/i; system( qq[ xz -dc "$archive" | tar xvf - -T "$list" ] ) if $archive =~ /\.txz$/i; system( qq[ bzip2 -dc "$archive" | tar xvf - -T "$list" ] ) if $archive =~ /\.tar\.bz2?$/i; + system( qq[ zstd -dc "$archive" | tar xvf - -T "$list" ] ) if $archive =~ /\.tar\.zst$/i; unlink $list; } else @@ -105,6 +107,9 @@ my $N = $D[5]; # name my $M = $D[0]; # mode +#use Data::Dumper; +#print STDERR Dumper( $_, \@D, $N ); + # strip leading /s $N =~ s/^\.\///; $N =~ s/^\//\//; diff -Nru vfu-5.01/rx/rxx vfu-5.07/rx/rxx --- vfu-5.01/rx/rxx 2021-11-19 01:04:19.000000000 +0000 +++ vfu-5.07/rx/rxx 2023-02-10 23:09:01.000000000 +0000 @@ -93,9 +93,6 @@ my $content = rx_tar_read_archive( $cache ); - use Data::Dumper; - print Dumper( $content ); - if ( $cmd eq "l" ) { $dir .= "/" unless $dir =~ /\/$/; diff -Nru vfu-5.01/vfu/Makefile vfu-5.07/vfu/Makefile --- vfu-5.01/vfu/Makefile 2023-02-02 21:01:38.000000000 +0000 +++ vfu-5.07/vfu/Makefile 2023-02-10 22:51:33.000000000 +0000 @@ -48,6 +48,8 @@ CXXFLAGS?=-O3 -fno-stack-protector -mno-stackrealign endif +CXXFLAGS+=$(CCDEF) + # some architectures do not have -mno-stackrealign HAVESREA:=$(shell if $(CXX) -mno-stackrealign -xc -c /dev/null -o /dev/null >/dev/null 2>/dev/null;then echo yes;else echo no;fi) # old comiplers do not have -Wdate-time @@ -64,6 +66,8 @@ MYLDFLAGS:=$(MYCXXFLAGS) $(LDFLAGS) -fPIE -pie MYLIBS:=$(LIBS) $(PCRE08_LD) $(PCRE32_LD) +MYLDFLAGS+=$(LDDEF) + ifeq ("$(V)","1") Q:= E:=@true diff -Nru vfu-5.01/vfu/see.cpp vfu-5.07/vfu/see.cpp --- vfu-5.01/vfu/see.cpp 2023-02-02 21:01:38.000000000 +0000 +++ vfu-5.07/vfu/see.cpp 2023-02-12 21:14:09.000000000 +0000 @@ -754,7 +754,7 @@ void SeeViewer::help() { - vfu_con_out( 1, 1, help_str ); + con_out( 1, 1, help_str ); do_draw = 1; con_getch(); } diff -Nru vfu-5.01/vfu/vfuarc.cpp vfu-5.07/vfu/vfuarc.cpp --- vfu-5.01/vfu/vfuarc.cpp 2023-01-29 22:52:18.000000000 +0000 +++ vfu-5.07/vfu/vfuarc.cpp 2023-02-12 19:36:56.000000000 +0000 @@ -18,6 +18,13 @@ /*---------------------------------------------------------------------------*/ +VString find_rx_auto() +{ + if( file_exist( "/usr/libexec/vfu/rx_auto" ) ) return VString( "/usr/libexec/vfu/rx_auto" ); + if( file_exist( "/usr/lib/vfu/rx_auto" ) ) return VString( "/usr/lib/vfu/rx_auto" ); + return VString( "rx_auto" ); +} + void vfu_read_archive_files( int a_recursive ) { char line[2048] = ""; @@ -27,13 +34,18 @@ if ( a_recursive ) archive_path = ""; /* cannot have path when recursing archive */ + VString an = archive_name; + VString ap = archive_path; + + shell_escape( an ); + shell_escape( ap ); + VString s; - s = "/usr/libexec/vfu/rx_auto "; + s = find_rx_auto() + " "; s += ( a_recursive ) ? "v" : "l"; - s += " '" + archive_name + "' "; - s += " '" + archive_path + "' "; - s += " 2> /dev/null"; - /* NOTE: calling rx_* should be safe and result should be proper + s += " " + an + " " + ap + " 2> /dev/null"; + + /* NOTE: calling rx_* should be safe and result should be proper. all bugs must be traced outside VFU ... */ FILE *f = popen( s, "r" ); @@ -112,27 +124,29 @@ void vfu_browse_archive_file() { - VString tmpdir = vfu_temp(); - if(mkdir( tmpdir, S_IRUSR|S_IWUSR|S_IXUSR /*|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH*/ ) || chdir( tmpdir ) ) + VString tmpdir = vfu_temp_dir(); + if( tmpdir == "" || chdir( tmpdir ) ) { - say1( "error: cannot create temp directory" ); - say2( tmpdir ); + say1( "error: cannot create temp directory: " + tmpdir ); + say2errno(); return; } VString fn = files_list_get(FLI)->full_name(); + VString wp = work_path; + VString an = archive_name; + + shell_escape( wp ); + shell_escape( an ); + shell_escape( fn ); + VString s; - s = "/usr/libexec/vfu/rx_auto x \""; - s += work_path; - s += archive_name; - s += "\" "; - s += fn; - s += " 2> /dev/null"; + s = find_rx_auto() + " x " + wp + an + " " + fn + " 2> /dev/null"; vfu_shell( s, "" ); - if(chdir( tmpdir )) /* FIXME: a little hack -- vfu_shell() changes current path */ + if( chdir( tmpdir ) ) /* FIXME: a little hack -- vfu_shell() changes current path */ { say1( "error: cannot chdir to temp directory: " + tmpdir ); say2errno(); @@ -154,23 +168,25 @@ void vfu_user_external_archive_exec( VString &shell_line ) { - VString tmpdir = vfu_temp(); - if(mkdir( tmpdir, S_IRUSR|S_IWUSR|S_IXUSR /*|S_IRGRP|S_IXGRP|S_IROTH|S_IXOTH*/ ) || chdir( tmpdir )) + VString tmpdir = vfu_temp_dir(); + if( tmpdir == "" || chdir( tmpdir ) ) { - say1( "error: cannot create temp directory" ); - say2( tmpdir ); + say1( "error: cannot create temp directory: " + tmpdir ); + say2errno(); return; } VString fn = files_list_get(FLI)->full_name(); + VString wp = work_path; + VString an = archive_name; + + shell_escape( wp ); + shell_escape( an ); + shell_escape( fn ); + VString s; - s = "/usr/libexec/vfu/rx_auto x \""; - s += work_path; - s += archive_name; - s += "\" "; - s += fn; - s += " 2> /dev/null"; + s = find_rx_auto() + " x " + wp + an + " " + fn + " 2> /dev/null"; vfu_shell( s, "" ); @@ -180,8 +196,8 @@ say2errno(); return; } - str_replace( shell_line, "%f", fn ); - str_replace( shell_line, "%F", fn ); + str_replace( shell_line, "%f", shell_escape( fn ) ); + str_replace( shell_line, "%F", shell_escape( fn ) ); vfu_shell( shell_line, "" ); if(chdir( work_path )) @@ -236,13 +252,14 @@ } chmod( tmpfile, S_IRUSR|S_IWUSR ); + VString wp = work_path; + VString an = archive_name; + + shell_escape( wp ); + shell_escape( an ); + VString s; - s = "/usr/libexec/vfu/rx_auto x \""; - s += work_path; - s += archive_name; - s += "\" @"; - s += tmpfile; - s += " 2> /dev/null"; + s = find_rx_auto() + " x " + wp + an + " @" + tmpfile + " 2> /dev/null"; vfu_shell( s, "" ); diff -Nru vfu-5.01/vfu/vfu.cpp vfu-5.07/vfu/vfu.cpp --- vfu-5.01/vfu/vfu.cpp 2023-02-02 21:01:38.000000000 +0000 +++ vfu-5.07/vfu/vfu.cpp 2023-02-12 21:18:36.000000000 +0000 @@ -971,7 +971,7 @@ case 'd' : temp = optarg; vfu_chdir( temp ); break; - case 'r' : vfu_con_out(1,1,HEADER,cINFO); + case 'r' : con_out(1,1,HEADER,cINFO); temp = "Rebuilding directory tree ( work_path is"; temp += work_path; temp += " )"; @@ -1200,8 +1200,8 @@ VString str = shell_editor; if ( fname ) { - str_replace( str, "%f", fname ); - str_replace( str, "%F", fname ); + str_replace( str, "%f", shell_escape( fname ) ); + str_replace( str, "%F", shell_escape( fname ) ); } vfu_shell( str, "" ); } @@ -1258,10 +1258,9 @@ if ( FNMATCH( mask, str_file_name_ext( fname ) ) ) continue; /* found */ tmp_name = vfu_temp(); - str_replace( str, "%f", fname ); - str_replace( str, "%F", full_fname ); - str += " > "; - str += tmp_name; + str_replace( str, "%f", shell_escape( fname ) ); + str_replace( str, "%F", shell_escape( full_fname ) ); + str += " > " + tmp_name; vfu_shell( str, "" ); chmod( tmp_name, S_IRUSR | S_IWUSR ); break; @@ -1275,6 +1274,7 @@ { opt.svo.cs = cINFO; SeeViewer viewer( &opt.svo ); + if( viewer.open( new_name ) == 0 ) viewer.run(); else @@ -1286,8 +1286,8 @@ VString str = shell_browser; if ( fname ) { - str_replace( str, "%f", fname ); - str_replace( str, "%F", full_fname ); + str_replace( str, "%f", shell_escape( fname ) ); + str_replace( str, "%F", shell_escape( full_fname ) ); } vfu_shell( str, "" ); } @@ -1319,6 +1319,7 @@ for ( z = 0; z < archive_extensions.count(); z++ ) if ( FNMATCH_OC( archive_extensions[z], fi->name_ext(), opt.lower_case_ext_config ) == 0 ) { + FNMATCH_OC( archive_extensions[z], fi->name_ext(), opt.lower_case_ext_config ); z = -1; /* FIXME: this shouldn't be -1 for TRUE really :) */ break; } @@ -2130,6 +2131,7 @@ mb.push( L"S Selected directories" ); mb.push( L"A All dir's in the list" ); mb.push( L"M Missing sizes dirs" ); + mb.push( L"P Drop dir sizes cache (WARNING!)" ); mb.push( L"--directory size options--" ); mb.push( L"N Normal" ); mb.push( L"Y Follow symlinks (WARNING: may loop!)" ); @@ -2206,8 +2208,31 @@ else say1( "Directory size calculation will follow ALL devices/filesystems" ); } - - + if( wch == L'P' ) + { + int scc = size_cache.count(); + wchar_t wch = 0; + if( scc > 0 ) + { + vfu_beep(); + say2( VString() + "Entries to be removed: " + scc ); + wch = towlower( vfu_ask( L"Directory sizes cache will be dropped? " + L"( D=Yes, drop data!, ESC=cancel )", + L"d" )); + say1( "" ); + say2( "" ); + } + else + { + say1( "Directory sizes cache is empty." ); + } + + if( wch == L'd') + { + size_cache.undef(); + say1( VString() + "Directory sizes cache dropped. Removed entries: " + scc ); + } + } do_draw = 1; update_status(); diff -Nru vfu-5.01/vfu/vfudir.cpp vfu-5.07/vfu/vfudir.cpp --- vfu-5.01/vfu/vfudir.cpp 2023-02-02 21:01:38.000000000 +0000 +++ vfu-5.07/vfu/vfudir.cpp 2023-02-10 22:51:33.000000000 +0000 @@ -173,13 +173,13 @@ if ( dir_list.count() > 1) { int li = 0; // counter -// int ll = 0; // longest directory entry + int ll = 0; // longest directory entry int xm = 0; // exact match entry for ( li = 0; li < dir_list.count(); li++ ) { -// int len = strlen( dir_list[li] ); -// if( len > ll ) -// ll = len; + int len = strlen( dir_list[li] ); + if( len > ll ) + ll = len; VString current_dtail; if( dtail != str_copy( current_dtail, dir_list[li], 0, dtlen ) ) continue; @@ -187,7 +187,7 @@ break; } int mc = 0; // match count - int mi = 0; // match letter index + int mi = dtlen; // match letter index while(4) { mc = 0; @@ -206,8 +206,10 @@ if ( mc != dir_list.count() ) break; mi++; -// if( mi >= ll ) +// if( dir_list[xm][mi] == 0 || dir_list[li][mi] == 0 ) // break; + if( mi >= ll ) + break; } VString exact_dtail_max; diff -Nru vfu-5.01/vfu/vfuopt.cpp vfu-5.07/vfu/vfuopt.cpp --- vfu-5.01/vfu/vfuopt.cpp 2023-02-02 21:01:38.000000000 +0000 +++ vfu-5.07/vfu/vfuopt.cpp 2023-02-10 22:51:33.000000000 +0000 @@ -446,8 +446,8 @@ else { VString line = shell_editor; - str_replace( line, "%f", filename_conf ); - str_replace( line, "%F", filename_conf ); + str_replace( line, "%f", shell_escape( filename_conf ) ); + str_replace( line, "%F", shell_escape( filename_conf ) ); vfu_shell( line.data(), 0 ); } vfu_settings_save(); diff -Nru vfu-5.01/vfu/vfusetup.h vfu-5.07/vfu/vfusetup.h --- vfu-5.01/vfu/vfusetup.h 2023-01-29 22:52:18.000000000 +0000 +++ vfu-5.07/vfu/vfusetup.h 2023-02-12 21:14:09.000000000 +0000 @@ -19,7 +19,7 @@ * */ -#define VFU_VERSION "5.00" +#define VFU_VERSION "5.07" #define HEADER "VF/U v" VFU_VERSION " Copyright (c) 1996-2023 Vladi Belperchinov-Shabanski 'Cade'" #define CONTACT " [http://cade.noxrun.com]" diff -Nru vfu-5.01/vfu/vfusys.h vfu-5.07/vfu/vfusys.h --- vfu-5.01/vfu/vfusys.h 2023-01-29 22:52:18.000000000 +0000 +++ vfu-5.07/vfu/vfusys.h 2023-02-10 22:51:33.000000000 +0000 @@ -42,8 +42,8 @@ int vfu_edit_attr( mode_str_t mod_str, int allow_masking = 1 ); /* FIXME: dir_exist should check if directory really */ -#define dir_exist( d ) ( access( d, F_OK ) == 0) -#define file_exist( d ) ( access( d, F_OK ) == 0) +#define dir_exist( d ) ( access( d, F_OK ) == 0 ) +#define file_exist( d ) ( access( d, F_OK ) == 0 ) #endif /* _VFUSYS_H_ */ diff -Nru vfu-5.01/vfu/vfuuti.cpp vfu-5.07/vfu/vfuuti.cpp --- vfu-5.01/vfu/vfuuti.cpp 2023-02-02 21:01:38.000000000 +0000 +++ vfu-5.07/vfu/vfuuti.cpp 2023-02-10 22:51:33.000000000 +0000 @@ -63,8 +63,7 @@ { s = files_list_get(FLI)->name(); } - shell_escape( s ); - out += s; + out += shell_escape( s ); break; case 'g' : /* list selected filenames */ @@ -85,8 +84,7 @@ { s = files_list_get(z)->name(); } - shell_escape( s ); - out += s + " "; + out += shell_escape( s ) + " "; } break; @@ -96,7 +94,7 @@ s = str_file_name( s ); else s = files_list_get(FLI)->ext(); - out += s; + out += shell_escape( s ); break; case 's' : /* current file size */ @@ -121,21 +119,22 @@ case 'c' : /* current path */ s = work_path; - out += s; + out += shell_escape( s ); break; case 'C' : /* startup dir */ s = startup_path; - out += s; + out += shell_escape( s ); break; case 'a' : /* Archive name */ - out += archive_name; + s = archive_name; + out += shell_escape( s ); break; case 'A' : /* Archive path */ s = archive_path; - out += s; + out += shell_escape( s ); break; case 'w' : @@ -465,16 +464,27 @@ /*---------------------------------------------------------------------------*/ -// FIXME: TODO: new function for tmp dir name etc. fname_t vfu_temp_filename; const char* vfu_temp() { strcpy( vfu_temp_filename, tmp_path + "vfu.XXXXXX" ); int fd = mkstemp( vfu_temp_filename ); - if( fd ) close( fd ); + if( fd >= 0 ) + close( fd ); + else + vfu_temp_filename[0] = 0; return vfu_temp_filename; } +fname_t vfu_temp_dirname; +const char* vfu_temp_dir() +{ + strcpy( vfu_temp_dirname, tmp_path + "vfu.XXXXXX" ); + char* r = mkdtemp( vfu_temp_dirname ); + if( ! r ) vfu_temp_dirname[0] = 0; + return vfu_temp_dirname; +} + /*---------------------------------------------------------------------------*/ char* vfu_str_comma( char* target ) diff -Nru vfu-5.01/vfu/vfuuti.h vfu-5.07/vfu/vfuuti.h --- vfu-5.01/vfu/vfuuti.h 2023-01-29 22:52:18.000000000 +0000 +++ vfu-5.07/vfu/vfuuti.h 2023-02-10 22:51:33.000000000 +0000 @@ -32,25 +32,25 @@ VString size_str_compact( const fsize_t siz ); -char* vfu_str_comma( char* target ); +char* vfu_str_comma( char* target ); VString& vfu_str_comma( VString& target ); -VString vfu_str_comma( fsize_t size ); +VString vfu_str_comma( fsize_t size ); /*###########################################################################*/ -void vfu_hist_add( int hist_id, const char* str ); +void vfu_hist_add( int hist_id, const char* str ); const char* vfu_hist_get( int hist_id, int index = 0 ); char* vfu_hist_get( int hist_id, int index, char* str ); -int vfu_hist_index( int hist_id, const char* value ); -int vfu_hist_count( int hist_id ); -void vfu_hist_remove( int hist_id, int index ); -int vfu_hist_menu( int x, int y, const wchar_t* title, int hist_id ); +int vfu_hist_index( int hist_id, const char* value ); +int vfu_hist_count( int hist_id ); +void vfu_hist_remove( int hist_id, int index ); +int vfu_hist_menu( int x, int y, const wchar_t* title, int hist_id ); -void vfu_get_str_history( int key, VString &s, int &pos ); /* internal! */ -int vfu_get_str( const char *prompt, VString& target, int hist_id, int x = -1, int y = -1 ); +void vfu_get_str_history( int key, VString &s, int &pos ); /* internal! */ +int vfu_get_str( const char *prompt, VString& target, int hist_id, int x = -1, int y = -1 ); const char* vfu_temp(); - +const char* vfu_temp_dir(); /*###########################################################################*/ void vfu_con_out( int x, int y, const char *s ); diff -Nru vfu-5.01/vfu.lsm vfu-5.07/vfu.lsm --- vfu-5.01/vfu.lsm 2023-02-02 21:54:50.000000000 +0000 +++ vfu-5.07/vfu.lsm 2023-02-12 21:14:03.000000000 +0000 @@ -1,7 +1,7 @@ Begin3 Title: VFU File Manager -Version: 5.01 -Entered-date: 01FEB2023 +Version: 5.07 +Entered-date: 12FEB2023 Description: VFU is console (text mode) file manager for UNIX. It has all usual file oprations plus more: - extended completion and wildcard expansion @@ -20,7 +20,7 @@ Author: cade@noxrun.com (Vladi Belperchinov-Shabanski) Maintained-by: cade@bis.bg (Vladi Belperchinov-Shabanski) Primary-site: http://cade.noxrun.com/projects/vfu/ - 500kB vfu-4.22.tar.gz + 290kB vfu-5.07.tar.gz Original-site: http://cade.noxrun.com/projects/vfu/ Platforms: UNIX (Linux, NetBSD, Mac OS X, Solaris), DOS/Win9X Copying-policy: GPL diff -Nru vfu-5.01/vslib/t/test.cpp vfu-5.07/vslib/t/test.cpp --- vfu-5.01/vslib/t/test.cpp 2023-02-02 21:01:36.000000000 +0000 +++ vfu-5.07/vslib/t/test.cpp 2023-02-10 22:51:32.000000000 +0000 @@ -402,8 +402,7 @@ VString v2 = shell_escape( fn.data() ); printf( "vstr: [%s]\n", v2.data() ); - int c = shell_escape( fn ); - printf( "vstr ipl: [%s] %d\n", fn.data(), c ); + printf( "vstr ipl: [%s]\n", shell_escape( fn ).data() ); } diff -Nru vfu-5.01/vslib/vsuti.cpp vfu-5.07/vslib/vsuti.cpp --- vfu-5.01/vslib/vsuti.cpp 2023-01-29 22:52:16.000000000 +0000 +++ vfu-5.07/vslib/vsuti.cpp 2023-02-10 22:51:32.000000000 +0000 @@ -358,22 +358,8 @@ return dest; } -VString shell_escape( const char* src ) +VString& shell_escape( VString &dest ) { - VString dest; - int sl = strlen( src ); - for( int i = 0; i < sl; i++ ) - { - if( strchr( shell_special_chars, src[i] ) ) - str_add_ch( dest, '\\' ); - str_add_ch( dest, src[i] ); - } - return dest; -} - -int shell_escape( VString &dest ) -{ - int c = 0; int sl = strlen( dest ); for( int i = 0; i < sl; i++ ) { @@ -381,9 +367,16 @@ str_ins_ch( dest, i, '\\' ); sl++; i++; - c++; } - return c; + return dest; +} + +VString shell_escape( const char* src ) +{ + VString dest; + dest = src; + shell_escape( dest ); + return dest; } /***************************************************************************** diff -Nru vfu-5.01/vslib/vsuti.h vfu-5.07/vslib/vsuti.h --- vfu-5.01/vslib/vsuti.h 2023-01-29 22:52:16.000000000 +0000 +++ vfu-5.07/vslib/vsuti.h 2023-02-10 22:51:32.000000000 +0000 @@ -130,9 +130,9 @@ ** *****************************************************************************/ -char* shell_escape( const char *src, char *dest ); -VString shell_escape( const char* src ); -int shell_escape( VString &dest ); +char* shell_escape( const char *src, char *dest ); +VString& shell_escape( VString &dest ); +VString shell_escape( const char* src ); /***************************************************************************** ** diff -Nru vfu-5.01/vstring/Makefile vfu-5.07/vstring/Makefile --- vfu-5.01/vstring/Makefile 2023-02-02 21:01:34.000000000 +0000 +++ vfu-5.07/vstring/Makefile 2023-02-10 22:51:30.000000000 +0000 @@ -34,6 +34,8 @@ CXXFLAGS?=-O3 -fno-stack-protector -mno-stackrealign endif +CXXFLAGS+=$(CCDEF) + # some architectures do not have -mno-stackrealign HAVESREA:=$(shell if $(CXX) -mno-stackrealign -xc -c /dev/null -o /dev/null >/dev/null 2>/dev/null;then echo yes;else echo no;fi) # old comiplers do not have -Wdate-time @@ -50,6 +52,8 @@ MYLDFLAGS:=$(MYCXXFLAGS) $(LDFLAGS) -fPIE -pie MYLIBS:=$(LIBS) $(PCRE08_LD) $(PCRE32_LD) +MYLDFLAGS+=$(LDDEF) + ifeq ("$(V)","1") Q:= E:=@true diff -Nru vfu-5.01/vstring/test.cpp vfu-5.07/vstring/test.cpp --- vfu-5.01/vstring/test.cpp 2023-02-02 21:01:34.000000000 +0000 +++ vfu-5.07/vstring/test.cpp 2023-02-10 22:51:30.000000000 +0000 @@ -458,6 +458,12 @@ } #endif + /* + VString nu = "is not null"; + nu = NULL; + ASSERT( nu == "" ); + */ + char t[92] = "this is simple test"; char r[92] = "1111111111111111111"; str_word( t, " ", r ); diff -Nru vfu-5.01/vstring/vstring_internal.h vfu-5.07/vstring/vstring_internal.h --- vfu-5.01/vstring/vstring_internal.h 2023-02-02 21:01:34.000000000 +0000 +++ vfu-5.07/vstring/vstring_internal.h 2023-02-10 22:51:30.000000000 +0000 @@ -97,7 +97,8 @@ }; VS_STRING_CLASS() { box = new VS_STRING_BOX(); }; - VS_STRING_CLASS( const VS_CHAR* ps ) { box = new VS_STRING_BOX(); set( ps); }; + VS_STRING_CLASS( const void* nu ) { box = new VS_STRING_BOX(); nu = nu; }; + VS_STRING_CLASS( const VS_CHAR* ps ) { box = new VS_STRING_BOX(); set( ps); }; VS_STRING_CLASS( const int n ) { box = new VS_STRING_BOX(); i(n); }; VS_STRING_CLASS( const long n ) { box = new VS_STRING_BOX(); l(n); }; VS_STRING_CLASS( const double n ) { box = new VS_STRING_BOX(); f(n); }; @@ -124,6 +125,7 @@ return *this; }; + const VS_STRING_CLASS& operator = ( const void* nu ) { nu = nu; undef(); return *this; }; const VS_STRING_CLASS& operator = ( const VS_CHAR* ps ) { set(ps); return *this; }; const VS_STRING_CLASS& operator = ( const int n ) { i(n); return *this; }; const VS_STRING_CLASS& operator = ( const long n ) { l(n); return *this; }; diff -Nru vfu-5.01/vstring/vstrlib_internal.cpp vfu-5.07/vstring/vstrlib_internal.cpp --- vfu-5.01/vstring/vstrlib_internal.cpp 2023-02-02 21:01:34.000000000 +0000 +++ vfu-5.07/vstring/vstrlib_internal.cpp 2023-02-12 15:45:14.000000000 +0000 @@ -116,7 +116,7 @@ str_up( charset_str ); cc = VS_FN_TOUPPER( cc ); } - if( str_find( charset_str, cc ) > 0 ) return r ? 1 : 0; + if( str_find( charset_str, cc ) >= 0 ) return r ? 1 : 0; return 1; } @@ -126,8 +126,9 @@ const VS_CHAR* ss = string; if( ! *ps ) return 1; // empty pattern, will not match + if( ! *ss ) return 1; // empty string, will not match - while( *ps ) + while(4) { if( ! ( flags & SFN_NOESCAPE ) && *ps == VS_CHAR_L('\\') ) { @@ -140,27 +141,20 @@ } else if( *ps == VS_CHAR_L('*') ) { - ps++; + while( *ps == VS_CHAR_L('*') ) ps++; if( ! *ps ) return 0; // pattern ends with *, will match anything - if( ( *ps == VS_CHAR_L('*') ) || ( *ps == VS_CHAR_L('?') ) ) continue; // next is special - if( *ps == VS_CHAR_L('[') ) - { - int a; - while( *ss && __sfn_match_charset( ps, *ss, flags, &a ) ) ss++; - if( *ss ) ps += a; // found, advance data position - } - else + + while( *ss ) { - if( ! ( flags & SFN_NOESCAPE ) && *ps && *ps == VS_CHAR_L('\\') ) ps++; // found escape, right after * - while( *ss && ! __sfn_eq( *ps, *ss, flags ) ) ss++; + if( sfn_match( ps, ss++, flags ) ) continue; + return 0; } - if( ! *ss ) return 3; // no found string char after * - // char after * matched, continue + return 11; } else if( *ps == VS_CHAR_L('[') ) { ps++; - int a; + int a = 0; int r = __sfn_match_charset( ps, *ss, flags, &a ); ps += a; // advance data position if( r != 0 ) return 4; @@ -170,6 +164,8 @@ if( ! __sfn_eq( *ps, *ss, flags ) ) return 5; } + if( ! *ps && ! *ss ) return 0; // end of pattern and string reached, matched so far, return ok + ps++; ss++; } diff -Nru vfu-5.01/vstring/wtest.cpp vfu-5.07/vstring/wtest.cpp --- vfu-5.01/vstring/wtest.cpp 2023-02-02 21:01:34.000000000 +0000 +++ vfu-5.07/vstring/wtest.cpp 2023-02-12 15:45:14.000000000 +0000 @@ -561,6 +561,21 @@ ASSERT( sfn_match( L"vF\\*d[g-k]?z", L"Vf*dIrz", SFN_CASEFOLD ) == 0 ); ASSERT( sfn_match( "*ing*", "vstring.txt" ) == 0 ); + + ASSERT( sfn_match( "*.deb", "vfu.debug" ) != 0 ); + + ASSERT( sfn_match( "*.tar.gz", "vfu-5.02.tar.gz" ) == 0 ); + + ASSERT( sfn_match( "*.tar*z", "vfu-5.02.tar.xz" ) == 0 ); + ASSERT( sfn_match( "*.tar*z", "vfu-5.02_tar.xz" ) != 0 ); + ASSERT( sfn_match( "*.tar*z", "vfu-5.tar.tar.xz" ) == 0 ); + ASSERT( sfn_match( "*.tar*m*z", "vfu-5.tar.tar.xz" ) != 0 ); + + ASSERT( sfn_match( "*tar*", "vfu tar tar.xz" ) == 0 ); + + ASSERT( sfn_match( "vf*u*xz", "vfu tar tar.xz" ) == 0 ); + ASSERT( sfn_match( "vf*[u]*xz", "vfu tar tar.xz" ) == 0 ); + ASSERT( sfn_match( "vf*[u*xz", "vfu tar tar.xz" ) != 0 ); } int main( void ) diff -Nru vfu-5.01/XWINDOW.NOTES vfu-5.07/XWINDOW.NOTES --- vfu-5.01/XWINDOW.NOTES 2021-11-19 01:04:19.000000000 +0000 +++ vfu-5.07/XWINDOW.NOTES 2023-02-12 15:45:10.000000000 +0000 @@ -49,5 +49,5 @@ keycode 91 = Delete ---cut--- - If you have problems contact me at + If you have problems contact me at diff -Nru vfu-5.01/yascreen/Makefile vfu-5.07/yascreen/Makefile --- vfu-5.01/yascreen/Makefile 2023-01-29 22:52:13.000000000 +0000 +++ vfu-5.07/yascreen/Makefile 2023-02-10 22:51:28.000000000 +0000 @@ -12,7 +12,8 @@ # # }}} -$(.TARGETS): - @if [ ! -x "`which gmake 2>/dev/null`" ]; then echo gmake is required; false; fi - @gmake -f GNUmakefile $(.TARGETS) +all .DEFAULT: + @if [ ! -x "$$(command -v gmake 2>/dev/null)" ]; then echo gmake is required; false; fi + @gmake --no-print-directory -f GNUmakefile $@ +.PHONY: all diff -Nru vfu-5.01/yascreen/Makefile.main vfu-5.07/yascreen/Makefile.main --- vfu-5.01/yascreen/Makefile.main 2023-02-02 21:01:32.000000000 +0000 +++ vfu-5.07/yascreen/Makefile.main 2023-02-10 22:51:28.000000000 +0000 @@ -40,16 +40,23 @@ SONAME:=-Wl,-soname,libyascreen.so.$(SOVERM) -ifeq ($(shell uname -s),Darwin) +ifeq ($(shell uname -s),Darwin) # tested on 17.7 AR=ar RANLIB=ranlib -LDOPT:= +NO_VERSIONED:=1 +NO_FLTO:=1 SONAME:= endif +ifeq ($(shell uname -s),FreeBSD) # tested on 14.0 +AR=ar +RANLIB=ranlib +endif + ifeq ($(shell uname -s),OpenBSD) # tested on 7.2 AR=ar RANLIB=ranlib +NO_VERSIONED:=1 endif ifeq ($(shell uname -s),NetBSD) # tested on 9.3 @@ -59,14 +66,19 @@ NO_FLTO:=1 endif -# change options based on flto configuration - ifndef NO_FLTO -CCOPT:=-Wall -Wextra -I. --std=gnu89 -fPIC -flto=auto +CHECK_CC_FLAGS:=-Wall -Wextra -I. --std=gnu89 -fPIC -flto=auto else -CCOPT:=-Wall -Wextra -I. --std=gnu89 -fPIC +CHECK_CC_FLAGS:=-Wall -Wextra -I. --std=gnu89 -fPIC endif +# remove unsupported flags from CCOPT +define check_cc_flag +$(shell echo 'int main(){return 0;}'|$(CC) $(1) -xc - -o /dev/null 2>/dev/null && echo $(1)) +endef +HAVE_FLAGS+=$(foreach flag,$(CHECK_CC_FLAGS),$(call check_cc_flag,$(flag))) +CCOPT:=$(HAVE_FLAGS) + # build versioned library by default ifndef NO_VERSIONED @@ -83,7 +95,7 @@ all: libyascreen.a libyascreen.so yascreen.pc -yascreen.o: yascreen.c yascreen.h +yascreen.o: yascreen.c yascreen.h yascreen_feed.c $(CC) $(MYCFLAGS) -o $@ -c $< yastest.o: yastest.c yascreen.h @@ -140,6 +152,7 @@ tar \ --xform 's,^[.],yascreen-$(VER),' \ --exclude ./.git \ + --exclude ./.github \ --exclude ./.gitignore \ --exclude ./.cvsignore \ --exclude ./CVS \ diff -Nru vfu-5.01/yascreen/yascreen.c vfu-5.07/yascreen/yascreen.c --- vfu-5.01/yascreen/yascreen.c 2023-02-02 21:01:32.000000000 +0000 +++ vfu-5.07/yascreen/yascreen.c 2023-02-10 22:51:28.000000000 +0000 @@ -1,4 +1,4 @@ -// $Id: yascreen.c,v 1.95 2023/02/02 00:06:00 bbonev Exp $ +// $Id: yascreen.c,v 1.96 2023/02/03 23:20:18 bbonev Exp $ // // Copyright © 2015-2023 Boian Bonev (bbonev@ipacct.com) {{{ // @@ -162,6 +162,28 @@ uint8_t outb[256]; // buffered output uint16_t outp; // position in outb }; + +// helpers for versioned symbols +#if YASCREEN_VERSIONED // implementation always follows the attribute +#if defined __GNUC__ && __GNUC__ >= 10 && !defined(__clang__) +#define symver_o(impl,sym,ver) __attribute__((symver(#sym"@"#ver))) +#define symver_d(impl,sym,ver) __attribute__((symver(#sym"@@"#ver))) +#else +#define symver_o(impl,sym,ver) asm(".symver "#impl","#sym"@"#ver); +#define symver_d(impl,sym,ver) asm(".symver "#impl","#sym"@@"#ver); +#endif +#define VV(foo,ver) foo##ver +#define V(foo,ver) VV(foo,ver) +#define V193 _193 +#else +#define symver_o(impl,sym,ver) +#define symver_d(impl,sym,ver) +#define V(foo,ver) foo +#define V193 +#endif +#define symver_V(impl,sym,ver) symver_d(impl,sym,ver) +#define YASCREEN_193 YASCREEN_1.93 + // }}} static inline int64_t mytime() { // {{{ @@ -291,7 +313,7 @@ return s->phint; } // }}} -static char myver[]="\0Yet another screen library (https://github.com/bbonev/yascreen) $Revision: 1.95 $\n\n"; // {{{ +static char myver[]="\0Yet another screen library (https://github.com/bbonev/yascreen) $Revision: 1.96 $\n\n"; // {{{ // }}} inline const char *yascreen_ver(void) { // {{{ @@ -1511,6 +1533,11 @@ return TELNET_NOOP; } // }}} +#if YASCREEN_VERSIONED +inline void yascreen_feed_193(yascreen *s,unsigned char c); +inline void yascreen_feed_179(yascreen *s,unsigned char c); +#endif + static inline int yascreen_getch_to_gen(yascreen *s,int timeout,int key_none) { // {{{ int64_t toms=timeout*1000,tto; struct timeval to,*pto=&to; @@ -1555,7 +1582,14 @@ unsigned char c; // important to be unsigned, so codes>127 do not expand as negative int values if (FD_ISSET(STDOUT_FILENO,&r)&&sizeof c==read(STDOUT_FILENO,&c,sizeof c)) { + #if YASCREEN_VERSIONED + if (key_none==YAS_K_NONE) // default behaviour, new symbols + yascreen_feed_193(s,c); + else + yascreen_feed_179(s,c); + #else yascreen_feed(s,c); + #endif continue; // check if feed has yielded a key } } @@ -1576,17 +1610,8 @@ } } // }}} -// inline void yascreen_feed(yascreen *s,unsigned char c) {{{ -#if YASCREEN_VERSIONED -#if defined __GNUC__ && __GNUC__ >= 10 && !defined(__clang__) -__attribute__((symver("yascreen_getch_to@@YASCREEN_1.93"))) -#else -asm(".symver yascreen_getch_to_193,yascreen_getch_to@@YASCREEN_1.93"); -#endif -inline int yascreen_getch_to_193(yascreen *s,int timeout) { -#else -inline int yascreen_getch_to(yascreen *s,int timeout) { -#endif +symver_d(yascreen_getch_to_193,yascreen_getch_to,YASCREEN_1.93) // {{{ +inline int V(yascreen_getch_to,V193)(yascreen *s,int timeout) { return yascreen_getch_to_gen(s,timeout,YAS_K_NONE); } // }}} @@ -1637,17 +1662,8 @@ s->escto=(timeout>=0)?timeout:YAS_DEFAULT_ESCTO; } // }}} -// inline void yascreen_feed(yascreen *s,unsigned char c) {{{ -#if YASCREEN_VERSIONED -#if defined __GNUC__ && __GNUC__ >= 10 && !defined(__clang__) -__attribute__((symver("yascreen_peekch@@YASCREEN_1.93"))) -#else -asm(".symver yascreen_peekch_193,yascreen_peekch@@YASCREEN_1.93"); -#endif -inline int yascreen_peekch_193(yascreen *s) { -#else -inline int yascreen_peekch(yascreen *s) { -#endif +symver_d(yascreen_peekch_193,yascreen_peekch,YASCREEN_1.93) // {{{ +inline int V(yascreen_peekch,V193)(yascreen *s) { int ch=yascreen_getch_nowait(s); if (ch!=YAS_K_NONE) @@ -1773,13 +1789,10 @@ return ch; } // }}} -#define YASCREEN_FEED_HEAD +// get yascreen_feed with the new symbol or unversioned #include "yascreen_feed.c" -#undef YASCREEN_FEED_HEAD - -#if YASCREEN_VERSIONED -// redefine YAS_K_* {{{ +#if YASCREEN_VERSIONED // redefine YAS_K_* {{{ #undef YAS_K_ALT #define YAS_K_ALT(code) (((code)&0xff)|0x200) @@ -1909,21 +1922,13 @@ // }}} // {{{ -#if defined __GNUC__ && __GNUC__ >= 10 && !defined(__clang__) -__attribute__((symver("yascreen_getch_to@YASCREEN_1.79"))) -#else -asm(".symver yascreen_getch_to_179,yascreen_getch_to@YASCREEN_1.79"); -#endif + +symver_o(yascreen_getch_to_179,yascreen_getch_to,YASCREEN_1.79) // {{{ inline int yascreen_getch_to_179(yascreen *s,int timeout) { return yascreen_getch_to_gen(s,timeout,YAS_K_NONE); } // }}} -// {{{ -#if defined __GNUC__ && __GNUC__ >= 10 && !defined(__clang__) -__attribute__((symver("yascreen_peekch@YASCREEN_1.79"))) -#else -asm(".symver yascreen_peekch_179,yascreen_peekch@YASCREEN_1.79"); -#endif +symver_o(yascreen_peekch_179,yascreen_peekch,YASCREEN_1.79) // {{{ inline int yascreen_peekch_179(yascreen *s) { int ch=yascreen_getch_to_179(s,-1); @@ -1932,6 +1937,14 @@ return ch; } // }}} +// now get yascreen_feed old version + +#undef symver_V +#define symver_V(impl,sym,ver) symver_o(impl,sym,ver) +#undef V193 +#define V193 _179 +#undef YASCREEN_193 +#define YASCREEN_193 YASCREEN_1.79 #include "yascreen_feed.c" #endif diff -Nru vfu-5.01/yascreen/yascreen_feed.c vfu-5.07/yascreen/yascreen_feed.c --- vfu-5.01/yascreen/yascreen_feed.c 2023-02-02 21:01:32.000000000 +0000 +++ vfu-5.07/yascreen/yascreen_feed.c 2023-02-10 22:51:28.000000000 +0000 @@ -1,25 +1,7 @@ -// $Id: yascreen_feed.c,v 1.3 2023/02/02 00:06:00 bbonev Exp $ +// $Id: yascreen_feed.c,v 1.4 2023/02/03 23:20:18 bbonev Exp $ -// inline void yascreen_feed(yascreen *s,unsigned char c) {{{ -#if YASCREEN_VERSIONED -#ifdef YASCREEN_FEED_HEAD -#if defined __GNUC__ && __GNUC__ >= 10 && !defined(__clang__) -__attribute__((symver("yascreen_feed@@YASCREEN_1.93"))) -#else -asm(".symver yascreen_feed_193,yascreen_feed@@YASCREEN_1.93"); -#endif -inline void yascreen_feed_193(yascreen *s,unsigned char c) { -#else -#if defined __GNUC__ && __GNUC__ >= 10 && !defined(__clang__) -__attribute__((symver("yascreen_feed@YASCREEN_1.79"))) -#else -asm(".symver yascreen_feed_179,yascreen_feed@YASCREEN_1.79"); -#endif -inline void yascreen_feed_179(yascreen *s,unsigned char c) { -#endif -#else -inline void yascreen_feed(yascreen *s,unsigned char c) { -#endif +symver_V(V(yascreen_feed,V193),yascreen_feed,YASCREEN_193) // {{{ +inline void V(yascreen_feed,V193)(yascreen *s,unsigned char c) { if (!s) return;