Hello community, here is the log from the commit of package fortune for openSUSE:Factory checked in at 2019-07-11 13:13:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/fortune (Old) and /work/SRC/openSUSE:Factory/.fortune.new.4615 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "fortune" Thu Jul 11 13:13:50 2019 rev:26 rq:713003 version:2.10.0 Changes: -------- --- /work/SRC/openSUSE:Factory/fortune/fortune.changes 2019-06-20 18:56:40.904951151 +0200 +++ /work/SRC/openSUSE:Factory/.fortune.new.4615/fortune.changes 2019-07-11 13:13:57.382859744 +0200 @@ -1,0 +2,14 @@ +Mon Jul 1 10:39:21 UTC 2019 - Marketa Calabkova <[email protected]> + +- Update to version 2.10.0 + * Move strfile and unstr to /usr/bin. + * Code cleanups: warnings and portability. +- Removed patch fortune-no-recode.patch + * Recode is maintained again, so this patch is not needed and due + to "code cleanups" it did not apply cleanly. Let us drop it. +- Added patch fortune-avoid-rinutils.patch + * Shlomi Fish again used one of his "random and task-specific" + packages. I do not want to package this one. +- Corrected license category. + +------------------------------------------------------------------- Old: ---- fortune-mod-2.8.0.tar.gz fortune-no-recode.patch New: ---- fortune-avoid-rinutils.patch fortune-mod-2.10.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ fortune.spec ++++++ --- /var/tmp/diff_new_pack.eF7F9r/_old 2019-07-11 13:13:58.718859193 +0200 +++ /var/tmp/diff_new_pack.eF7F9r/_new 2019-07-11 13:13:58.722859192 +0200 @@ -19,18 +19,18 @@ %define CookieDir share/fortune Name: fortune -Version: 2.8.0 +Version: 2.10.0 Release: 0 Summary: Random Saying -License: BSD-3-Clause +License: BSD-4-Clause Group: Amusements/Toys/Other URL: ftp://sunsite.unc.edu/pub/Linux/games/amusements/fortune/ Source: https://github.com/shlomif/fortune-mod/archive/fortune-mod-%{version}.tar.gz -# This patch is not needed anymore, because recode is maintained again. If it was naughty, drop it and BuildRequire recode-devel instead. -Patch0: fortune-no-recode.patch -Patch1: fortune-no-games.patch +Patch0: fortune-no-games.patch +Patch1: fortune-avoid-rinutils.patch BuildRequires: cmake >= 3 BuildRequires: gcc-c++ +BuildRequires: recode-devel BuildRequires: shlomif-cmake-modules %description @@ -57,7 +57,6 @@ %{_mandir}/man1/* %{_mandir}/man6/* %{_datadir}/fortune -%{_sbindir}/* %{_bindir}/* %changelog ++++++ fortune-avoid-rinutils.patch ++++++ Index: fortune-mod/util/randstr.c =================================================================== --- fortune-mod.orig/util/randstr.c +++ fortune-mod/util/randstr.c @@ -87,7 +87,11 @@ */ #include "fortune-mod-common.h" -#include "rinutils/unused.h" +#if defined(__GNUC__) +#define GCC_UNUSED __attribute__((unused)) +#else +#define GCC_UNUSED +#endif char *Infile, /* name of input file */ Datafile[MAXPATHLEN], /* name of data file */ Index: fortune-mod/CMakeLists.txt =================================================================== --- fortune-mod.orig/CMakeLists.txt +++ fortune-mod/CMakeLists.txt @@ -96,14 +96,6 @@ SHLOMIF_ADD_COMMON_C_FLAGS() SHLOMIF_FINALIZE_FLAGS() -SET (rinutils "rinutils") -IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${rinutils}") - EXECUTE_PROCESS(COMMAND "git" "clone" "https://github.com/shlomif/rinutils.git" "${rinutils}" - WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" - ) -ENDIF () -INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/${rinutils}/rinutils/include") - IF ("$ENV{FCS_GCC}") ADD_DEFINITIONS("-W -Wabi=11 -Waddress -Waggressive-loop-optimizations -Wall -Wattributes -Wbad-function-cast -Wbool-compare -Wbool-operation -Wbuiltin-declaration-mismatch -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wchkp -Wclobbered -Wcomment -Wcomments -Wcoverage-mismatch -Wcpp -Wdangling-else -Wdate-time -Wdeprecated -Wdeprecated-declarations -Wdesignated-init -Wdisabled-optimization -Wdiscarded-array-qualifiers -Wdiscarded-qualifiers -Wdiv-by-zero -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wenum-compare -Wexpansion-to-defined -Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-signedness -Wformat-y2k -Wformat-zero-length -Wframe-address -Wfree-nonheap-object -Whsa -Wignored-attributes -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Winline -Wint-conversion -Wint-in-bool-context -Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch -Wjump-misses-init -Wlogical-not-parentheses -Wlogical-op -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-parameter-type -Wmissing-prototypes -Wmultichar -Wnarrowing -Wnested-externs -Wnonnull -Wnonnull-compare -Wnull-dereference -Wodr -Wold-style-declaration -Wold-style-definition -Wopenmp-simd -Woverflow -Woverlength-strings -Woverride-init -Wpacked -Wpacked-bitfield-compat -Wparentheses -Wpointer-arith -Wpointer-compare -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wpsabi -Wrestrict -Wreturn-local-addr -Wreturn-type -Wscalar-storage-order -Wsequence-point -Wshadow -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-memaccess -Wstack-protector -Wstrict-aliasing -Wstrict-prototypes -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsuggest-final-methods -Wsuggest-final-types -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-unreachable -Wsync-nand -Wtautological-compare -Wtrampolines -Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-macros -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvector-operation-performance -Wvla -Wvolatile-register-var -Wwrite-strings -Walloc-size-larger-than=9223372036854775807 -Warray-bounds=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wnormalized=nfc -Wshift-overflow=2 -Wunused-const-variable=2 -Wstrict-overflow=1 -Wno-switch-default -Wno-vla -Wno-inline -Wno-jump-misses-init -Wno-unsafe-loop-optimizations") # -Wimplicit-fallthrough=5 ++++++ fortune-mod-2.8.0.tar.gz -> fortune-mod-2.10.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/.appveyor.yml new/fortune-mod-fortune-mod-2.10.0/.appveyor.yml --- old/fortune-mod-fortune-mod-2.8.0/.appveyor.yml 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/.appveyor.yml 2019-06-30 13:35:34.000000000 +0200 @@ -1,6 +1,11 @@ --- # Shamelessly taken from https://github.com/plicease/Dist-Zilla-PluginBundle-Author-Plicease/blob/master/.appveyor.yml # Thanks! +clone_folder: c:\projects\fortune-mod +environment: + global: + MSYSTEM: MINGW64 + VERBOSE: 1 install: - choco install strawberryperl - SET PATH=C:\strawberry\c\bin;C:\strawberry\perl\site\bin;C:\strawberry\perl\bin;%PATH% @@ -11,13 +16,22 @@ - SET PERL_LOCAL_LIB_ROOT=C:/Perl5 - SET PERL_MB_OPT=--install_base C:/Perl5 - SET PERL_MM_OPT=INSTALL_BASE=C:/Perl5 - - cpanm --notest Dir::Manifest Dist::Zilla Env::Path Games::Solitaire::Verify::Solution IO::All Inline Inline::C Perl::Tidy Pod::Coverage::TrustPod Pod::Weaver::Section::Support String::ShellQuote Test::Code::TidyAll Test::CPAN::Changes Test::Differences Test::EOL Test::Kwalitee Test::NoTabs Test::Pod Test::Pod::Coverage Test::RunValgrind Test::TrailingSpace Test::Trap + - cpanm --notest Env::Path IO::All Perl::Tidy Pod::Coverage::TrustPod String::ShellQuote Test::Code::TidyAll Test::Differences Test::EOL Test::Pod Test::Pod::Coverage Test::RunValgrind Test::TrailingSpace Test::Trap + - git clone https://github.com/rrthomas/Recode ./recode + - C:\msys64\usr\bin\bash.exe -l -x -c "test -e /mingw64/include/recode.h || bash -x c:/projects/fortune-mod/recode/build-aux/appveyor-install.sh" + - C:\msys64\usr\bin\bash.exe -x -lc "test -e /mingw64/include/recode.h || cd c:/projects/fortune-mod/recode && ./bootstrap && ./configure --enable-silent-rules %CONFIGURE_FLAGS% && make && make install" build: off test_script: - set CMAKE_MAKE_PROGRAM=C:\strawberry\c\bin\gmake.exe # Removing for now because it is too much trouble on windows. # - set FCS_TEST_BUILD=1 + - set CPATH=c:\mingw64\include;c:\msys64\mingw64\include + - set LIBRARY_PATH=c:\mingw64\lib;c:\msys64\mingw64\lib + - set PATH=%PATH%;c:\mingw64\lib;c:\msys64\mingw64\lib + # Python3 confuses the recode build so only add it here. + - SET PATH=%PATH%;C:\Python35-x64 + - SET FORTUNE_TEST_DEBUG=1 - perl CI-testing/continuous-integration-testing.pl --gen="MSYS Makefiles" -# cache: -# - C:\Perl5 +cache: + - C:\msys64\mingw64 shallow_clone: true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/CI-testing/continuous-integration-testing.pl new/fortune-mod-fortune-mod-2.10.0/CI-testing/continuous-integration-testing.pl --- old/fortune-mod-fortune-mod-2.8.0/CI-testing/continuous-integration-testing.pl 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/CI-testing/continuous-integration-testing.pl 2019-06-30 13:35:34.000000000 +0200 @@ -42,4 +42,4 @@ } ); do_system( { cmd => [$MAKE] } ); -do_system( { cmd => [ $^X, "..${SEP}fortune-mod${SEP}run-tests.pl", ] } ); +do_system( { cmd => [ $MAKE, "check", ] } ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/CMakeLists.txt new/fortune-mod-fortune-mod-2.10.0/fortune-mod/CMakeLists.txt --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/CMakeLists.txt 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/CMakeLists.txt 2019-06-30 13:35:34.000000000 +0200 @@ -29,6 +29,7 @@ SET(CPACK_SOURCE_IGNORE_FILES "/.deps/" + "/\\\\.git/" "~$" "\\\\.pyc$" "/tags$" @@ -95,6 +96,29 @@ SHLOMIF_FINALIZE_FLAGS() +SET (rinutils "rinutils") +IF (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${rinutils}") + EXECUTE_PROCESS(COMMAND "git" "clone" "https://github.com/shlomif/rinutils.git" "${rinutils}" + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + ) +ENDIF () +INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_SOURCE_DIR}/${rinutils}/rinutils/include") + +IF ("$ENV{FCS_GCC}") + ADD_DEFINITIONS("-W -Wabi=11 -Waddress -Waggressive-loop-optimizations -Wall -Wattributes -Wbad-function-cast -Wbool-compare -Wbool-operation -Wbuiltin-declaration-mismatch -Wbuiltin-macro-redefined -Wcast-align -Wchar-subscripts -Wchkp -Wclobbered -Wcomment -Wcomments -Wcoverage-mismatch -Wcpp -Wdangling-else -Wdate-time -Wdeprecated -Wdeprecated-declarations -Wdesignated-init -Wdisabled-optimization -Wdiscarded-array-qualifiers -Wdiscarded-qualifiers -Wdiv-by-zero -Wdouble-promotion -Wduplicated-branches -Wduplicated-cond -Wduplicate-decl-specifier -Wempty-body -Wendif-labels -Wenum-compare -Wexpansion-to-defined -Wextra -Wformat-contains-nul -Wformat-extra-args -Wformat-nonliteral -Wformat-security -Wformat-signedness -Wformat-y2k -Wformat-zero-length -Wframe-address -Wfree-nonheap-object -Whsa -Wignored-attributes -Wignored-qualifiers -Wimplicit -Wimplicit-function-declaration -Wimplicit-int -Wincompatible-pointer-types -Winit-self -Winline -Wint-conversion -Wint-in-bool-context -Wint-to-pointer-cast -Winvalid-memory-model -Winvalid-pch -Wjump-misses-init -Wlogical-not-parentheses -Wlogical-op -Wmain -Wmaybe-uninitialized -Wmemset-elt-size -Wmemset-transposed-args -Wmisleading-indentation -Wmissing-braces -Wmissing-declarations -Wmissing-field-initializers -Wmissing-include-dirs -Wmissing-parameter-type -Wmissing-prototypes -Wmultichar -Wnarrowing -Wnested-externs -Wnonnull -Wnonnull-compare -Wnull-dereference -Wodr -Wold-style-declaration -Wold-style-definition -Wopenmp-simd -Woverflow -Woverlength-strings -Woverride-init -Wpacked -Wpacked-bitfield-compat -Wparentheses -Wpointer-arith -Wpointer-compare -Wpointer-sign -Wpointer-to-int-cast -Wpragmas -Wpsabi -Wrestrict -Wreturn-local-addr -Wreturn-type -Wscalar-storage-order -Wsequence-point -Wshadow -Wshift-count-negative -Wshift-count-overflow -Wshift-negative-value -Wsizeof-array-argument -Wsizeof-pointer-memaccess -Wstack-protector -Wstrict-aliasing -Wstrict-prototypes -Wsuggest-attribute=format -Wsuggest-attribute=noreturn -Wsuggest-attribute=pure -Wsuggest-final-methods -Wsuggest-final-types -Wswitch -Wswitch-bool -Wswitch-default -Wswitch-unreachable -Wsync-nand -Wtautological-compare -Wtrampolines -Wtrigraphs -Wtype-limits -Wuninitialized -Wunknown-pragmas -Wunsafe-loop-optimizations -Wunused -Wunused-but-set-parameter -Wunused-but-set-variable -Wunused-function -Wunused-label -Wunused-local-typedefs -Wunused-macros -Wunused-parameter -Wunused-result -Wunused-value -Wunused-variable -Wvarargs -Wvariadic-macros -Wvector-operation-performance -Wvla -Wvolatile-register-var -Wwrite-strings -Walloc-size-larger-than=9223372036854775807 -Warray-bounds=2 -Wformat-overflow=2 -Wformat-truncation=2 -Wnormalized=nfc -Wshift-overflow=2 -Wunused-const-variable=2 -Wstrict-overflow=1 -Wno-switch-default -Wno-vla -Wno-inline -Wno-jump-misses-init -Wno-unsafe-loop-optimizations") + # -Wimplicit-fallthrough=5 + # -Wno-vla-larger-than + # -Wsuggest-attribute=const + # -Wstringop-overflow=2 + + IF (NOT IS_DEBUG) + ADD_DEFINITIONS("-D_FORTIFY_SOURCE=2") + ELSE () + ADD_DEFINITIONS("-D_FORTIFY_SOURCE=2") + ENDIF () + ADD_DEFINITIONS("-O1") +ENDIF () + INCLUDE(CheckIncludeFile) SET(_r "stdbool.h" "stdio.h" "recode.h") CHECK_INCLUDE_FILES("${_r}" HAVE_RECODE_H) @@ -106,8 +130,23 @@ INCLUDE_DIRECTORIES(BEFORE "${CMAKE_CURRENT_BINARY_DIR}") MACRO(my_exe exe c_file dir) + SET(_files "${c_file}") + if (WIN32) + list(APPEND _files "util/getopt.c") + endif() ADD_EXECUTABLE("${exe}" "${c_file}") - INSTALL(TARGETS "${exe}" RUNTIME DESTINATION "${dir}") + set(_libs) + if ("${exe}" STREQUAL "fortune") + list(APPEND _libs "recode") + endif() + if (WIN32) + # See https://stackoverflow.com/questions/15119639/how-to-link-winsock-in-cmake + list(APPEND _libs intl regex wsock32 ws2_32) + endif() + TARGET_LINK_LIBRARIES("${exe}" ${_libs}) + if (NOT ("${dir}" STREQUAL "null")) + INSTALL(TARGETS "${exe}" RUNTIME DESTINATION "${dir}") + endif() ENDMACRO() my_exe( @@ -119,15 +158,15 @@ my_exe( "strfile" "util/strfile.c" - "sbin" + "bin" ) # Build but not install. -ADD_EXECUTABLE("randstr" "util/randstr.c") +my_exe("randstr" "util/randstr.c" "null") my_exe( "unstr" "util/unstr.c" - "sbin" + "bin" ) my_exe( @@ -158,13 +197,13 @@ INSTALL_RENAME_MAN("strfile.man" "1" "strfile" "util") INSTALL_RENAME_MAN("fortune.6" "6" "fortune" "fortune") -TARGET_LINK_LIBRARIES("fortune" "recode") INCLUDE_DIRECTORIES("${CMAKE_CURRENT_SOURCE_DIR}/util") -ADD_DEFINITIONS("-DLOCOFFDIR=\"${LOCALODIR}\"") -ADD_DEFINITIONS("-DLOCFORTDIR=\"${LOCALDIR}\"") -ADD_DEFINITIONS("-DOFFDIR=\"${OCOOKIEDIR}\"") -ADD_DEFINITIONS("-DFORTDIR=\"${COOKIEDIR}\"") +IF(WIN32 AND NOT UNIX) + FOREACH (var "LOCALODIR" "LOCALDIR" "OCOOKIEDIR" "COOKIEDIR") + string(REPLACE "\\" "/" "${var}" "${var}") + ENDFOREACH() +ENDIF() IF ("${NO_OFFENSIVE}") ADD_DEFINITIONS("-DNO_OFFENSIVE=1") diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/ChangeLog new/fortune-mod-fortune-mod-2.10.0/fortune-mod/ChangeLog --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/ChangeLog 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/ChangeLog 2019-06-30 13:35:34.000000000 +0200 @@ -1,6 +1,16 @@ (Note: this file has been re-arranged to be in reverse chronological order, which is The Right Thing for ChangeLogs - DLC) +June 30, 2019 (fortune-mod 2.10.0) + + Move strfile and unstr to /usr/bin : + https://github.com/shlomif/fortune-mod/issues/35 + + Code cleanups: warnings and portability. + + Better porting to windows / appveyor-CI + (still not perfect) + June 07, 2019 (fortune-mod 2.8.0) Add some quotes by amigojapan. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/config.h.in new/fortune-mod-fortune-mod-2.10.0/fortune-mod/config.h.in --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/config.h.in 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/config.h.in 2019-06-30 13:35:34.000000000 +0200 @@ -11,6 +11,10 @@ /* Version number of package */ #define VERSION "${VERSION}" +#define LOCOFFDIR "${LOCALODIR}" +#define LOCFORTDIR "${LOCALDIR}" +#define OFFDIR "${OCOOKIEDIR}" +#define FORTDIR "${COOKIEDIR}" #ifdef __cplusplus } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/datfiles/CMakeLists.txt new/fortune-mod-fortune-mod-2.10.0/fortune-mod/datfiles/CMakeLists.txt --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/datfiles/CMakeLists.txt 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/datfiles/CMakeLists.txt 2019-06-30 13:35:34.000000000 +0200 @@ -23,11 +23,18 @@ ) SET(LINK "${c}.u8") + if (WIN32) + ADD_CUSTOM_COMMAND( + OUTPUT "${LINK}" + COMMAND ${CMAKE_COMMAND} -E copy "${SOURCE}" "${LINK}" + ) + else() ADD_CUSTOM_COMMAND( OUTPUT "${LINK}" COMMAND "ln" ARGS "-sf" "${c}" "${LINK}" ) + endif() ADD_CUSTOM_TARGET( "${TARGET_NAME}" ALL diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/datfiles/off/CMakeLists.txt new/fortune-mod-fortune-mod-2.10.0/fortune-mod/datfiles/off/CMakeLists.txt --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/datfiles/off/CMakeLists.txt 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/datfiles/off/CMakeLists.txt 2019-06-30 13:35:34.000000000 +0200 @@ -24,6 +24,13 @@ SET(LINK "${c}.u8") SET(rot_LINK "${rot_dir}/${LINK}") + if (WIN32) + ADD_CUSTOM_COMMAND( + OUTPUT "${rot_LINK}" + COMMAND ${CMAKE_COMMAND} -E copy "${rot_dest}" "${rot_LINK}" + DEPENDS "${rot_dest}" + ) +else() ADD_CUSTOM_COMMAND( OUTPUT "${rot_LINK}" COMMAND "ln" @@ -31,7 +38,7 @@ DEPENDS "${rot_dest}" WORKING_DIRECTORY "${rot_dir}" ) - +endif() ADD_CUSTOM_TARGET( "${TARGET_NAME}" ALL DEPENDS "${rot_dest}" "${DEST}" "${rot_LINK}" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/datfiles/songs-poems new/fortune-mod-fortune-mod-2.10.0/fortune-mod/datfiles/songs-poems --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/datfiles/songs-poems 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/datfiles/songs-poems 2019-06-30 13:35:34.000000000 +0200 @@ -7154,3 +7154,11 @@ Dragged and washed with eager hands. -- ``Cities in Dust'', "Tinderbox", Siouxsie & the Banshees. % +We're always gonna try it +No one can deny it +We can cause a riot in Sunday School +We'll have you believing +Truth can be deceiving +"Do unto others" is our Golden Rule + -- Pokemon: Double Trouble (Team Rocket) song +% diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/fortune/fortune.c new/fortune-mod-fortune-mod-2.10.0/fortune-mod/fortune/fortune.c --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/fortune/fortune.c 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/fortune/fortune.c 2019-06-30 13:35:34.000000000 +0200 @@ -104,7 +104,9 @@ #include <assert.h> #include <errno.h> #include <locale.h> +#ifndef _WIN32 #include <langinfo.h> +#endif #include <recode.h> @@ -1500,8 +1502,11 @@ open_dat(fp); lseek(fp->datfd, (off_t) (sizeof fp->tbl + (size_t)fp->pos * sizeof Seekpts[0]), 0); - read(fp->datfd, &Seekpts[0], sizeof Seekpts[0]); - read(fp->datfd, &Seekpts[1], sizeof Seekpts[1]); + if ((read(fp->datfd, &Seekpts[0], sizeof Seekpts[0]) <0)|| + (read(fp->datfd, &Seekpts[1], sizeof Seekpts[1])<0)) + { + exit(1); + } Seekpts[0] = (int32_t)ntohl((uint32_t)Seekpts[0]); Seekpts[1] = (int32_t)ntohl((uint32_t)Seekpts[1]); } @@ -1705,7 +1710,7 @@ return nchar; } -static int max(register int i, register int j) +static int mymax(register int i, register int j) { return (i >= j ? i : j); } @@ -1747,6 +1752,9 @@ request = recode_new_request (outer); setlocale(LC_ALL,""); +#ifdef _WIN32 + ctype = "C"; +#else ctype = nl_langinfo(CODESET); if (!ctype || !*ctype) { @@ -1756,6 +1764,7 @@ { ctype="ISO-8859-1"; } +#endif crequest = malloc(strlen(ctype) + 7 + 1); sprintf(crequest, "UTF-8..%s", ctype); @@ -1793,7 +1802,7 @@ if (Wait) { fortlen(); - sleep((unsigned int) max(Fort_len / CPERS, MINW)); + sleep((unsigned int) mymax(Fort_len / CPERS, MINW)); } } cleanup: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/fortune/gen-fortune-man-page.pl new/fortune-mod-fortune-mod-2.10.0/fortune-mod/fortune/gen-fortune-man-page.pl --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/fortune/gen-fortune-man-page.pl 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/fortune/gen-fortune-man-page.pl 2019-06-30 13:35:34.000000000 +0200 @@ -33,7 +33,9 @@ { die "Please specify ocookiedir"; } -open my $out, '>', $output_fn; + +# The :raw is to prevent CRs on Win32/etc. +open my $out, '>:raw', $output_fn; $out->print(<<'END_OF_STRING'); .\" $NetBSD: fortune.6,v 1.4 1995/03/23 08:28:37 cgd Exp $ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/run-tests.pl new/fortune-mod-fortune-mod-2.10.0/fortune-mod/run-tests.pl --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/run-tests.pl 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/run-tests.pl 2019-06-30 13:35:34.000000000 +0200 @@ -39,4 +39,11 @@ do_system( { cmd => [ $^X, "$src_dir/tests/trailing-space-and-CRs.pl" ] } ); } -do_system( { cmd => [ 'prove', glob("$src_dir/tests/t/*.t") ] } ); +eval { do_system( { cmd => [ 'prove', glob("$src_dir/tests/t/*.t") ] } ); }; + +my $E = $@; +if ( $ENV{FORTUNE_TEST_DEBUG} ) +{ + system( "python", "$src_dir/tests/fortune-m-test.py" ); +} +exit( $E ? 1 : 0 ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/tests/fortune-m-test.py new/fortune-mod-fortune-mod-2.10.0/fortune-mod/tests/fortune-m-test.py --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/tests/fortune-m-test.py 1970-01-01 01:00:00.000000000 +0100 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/tests/fortune-m-test.py 2019-06-30 13:35:34.000000000 +0200 @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import glob +import os +import subprocess +from os.path import join +inst_dir = join(os.getcwd(), "fortune-m-INST_DIR") + +exe = glob.glob(join(inst_dir, "games", "fortune")+'*')[0] +subprocess.call(["objdump", "-p", exe]) +subprocess.check_call([exe, "-m", "giants"]) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/tests/t/lib/FortTestInst.pm new/fortune-mod-fortune-mod-2.10.0/fortune-mod/tests/t/lib/FortTestInst.pm --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/tests/t/lib/FortTestInst.pm 1970-01-01 01:00:00.000000000 +0100 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/tests/t/lib/FortTestInst.pm 2019-06-30 13:35:34.000000000 +0200 @@ -0,0 +1,88 @@ +package FortTestInst; + +use strict; +use warnings; + +use File::Path qw/mkpath rmtree/; +use Cwd qw/getcwd/; + +my $IS_WIN = ( $^O eq "MSWin32" ); +my $SEP = $IS_WIN ? "\\" : '/'; +my $MAKE = $IS_WIN ? 'gmake' : 'make'; + +sub do_system +{ + my ($args) = @_; + + my $cmd = $args->{cmd}; + print "Running [@$cmd]\n"; + if ( system(@$cmd) ) + { + die "Running [@$cmd] failed!"; + } +} + +sub install +{ + my ($basepath) = @_; + my $cwd = getcwd(); + my $build_dir = "$cwd/$basepath-build-dir"; + my $inst_dir = "$cwd/$basepath-INST_DIR"; + rmtree( $build_dir, 0, 0 ); + rmtree( $inst_dir, 0, 0 ); + mkpath($build_dir); + chdir $build_dir; + my $KEY = 'CMAKE_GEN'; + do_system( + { + cmd => [ + 'cmake', + ( defined( $ENV{$KEY} ) ? ( "-G", $ENV{$KEY} ) : () ), + ( + defined( $ENV{CMAKE_MAKE_PROGRAM} ) + ? "-DCMAKE_MAKE_PROGRAM=$ENV{CMAKE_MAKE_PROGRAM}" + : () + ), + "-DCMAKE_INSTALL_PREFIX=$inst_dir", + $ENV{SRC_DIR} + ] + } + ); + do_system( { cmd => [$MAKE] } ); + do_system( { cmd => [ $MAKE, 'install', ] } ); + + return $inst_dir; +} + +1; +__END__ + +=head1 COPYRIGHT & LICENSE + +Copyright 2019 by Shlomi Fish + +This program is distributed under the MIT / Expat License: +L<http://www.opensource.org/licenses/mit-license.php> + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +=cut diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/tests/t/test-fortune-m.t new/fortune-mod-fortune-mod-2.10.0/fortune-mod/tests/t/test-fortune-m.t --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/tests/t/test-fortune-m.t 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/tests/t/test-fortune-m.t 2019-06-30 13:35:34.000000000 +0200 @@ -3,41 +3,15 @@ use strict; use warnings; -use File::Path qw/mkpath rmtree/; -use Cwd qw/getcwd/; - +use FindBin; +use lib "$FindBin::Bin/lib"; +use FortTestInst (); use Test::More tests => 1; -sub do_system -{ - my ($args) = @_; - - my $cmd = $args->{cmd}; - print "Running [@$cmd]\n"; - if ( system(@$cmd) ) - { - die "Running [@$cmd] failed!"; - } -} - { - my $cwd = getcwd(); - my $build_dir = "$cwd/fortune-m-build-dir"; - my $inst_dir = "$cwd/fortune-m-INST_DIR"; - rmtree( $build_dir, 0, 0 ); - rmtree( $inst_dir, 0, 0 ); - mkpath($build_dir); - chdir $build_dir; - do_system( - { - cmd => - [ 'cmake', "-DCMAKE_INSTALL_PREFIX=$inst_dir", $ENV{SRC_DIR} ] - } - ); - do_system( { cmd => ['make'] } ); - do_system( { cmd => [ 'make', 'install', ] } ); + my $inst_dir = FortTestInst::install("fortune-m"); - my $text = `'$inst_dir/games/fortune' -m giants`; + my $text = `$inst_dir/games/fortune -m giants`; # TEST like( $text, qr/Newton/, 'fortune -m matched' ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/tests/t/test-fortune-o-rot.t new/fortune-mod-fortune-mod-2.10.0/fortune-mod/tests/t/test-fortune-o-rot.t --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/tests/t/test-fortune-o-rot.t 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/tests/t/test-fortune-o-rot.t 2019-06-30 13:35:34.000000000 +0200 @@ -7,42 +7,15 @@ use strict; use warnings; -use File::Path qw/mkpath rmtree/; -use Cwd qw/getcwd/; - +use FindBin; +use lib "$FindBin::Bin/lib"; +use FortTestInst (); use Test::More tests => 1; -sub do_system { - my ($args) = @_; - - my $cmd = $args->{cmd}; - print "Running [@$cmd]\n"; - if ( system(@$cmd) ) - { - die "Running [@$cmd] failed!"; - } -} - -{ - my $cwd = getcwd(); - my $build_dir = "$cwd/fortune-m-build-dir"; - my $inst_dir = "$cwd/fortune-m-INST_DIR"; - rmtree( $build_dir, 0, 0 ); - rmtree( $inst_dir, 0, 0 ); - mkpath($build_dir); - chdir $build_dir; - do_system( - { - cmd => - [ 'cmake', "-DCMAKE_INSTALL_PREFIX=$inst_dir", $ENV{SRC_DIR} ] - } - ); - do_system( { cmd => ['make'] } ); - do_system( { cmd => [ 'make', 'install', ] } ); - + my $inst_dir = FortTestInst::install("fortune-o-rot"); local $ENV{FORTUNE_MOD_RAND_HARD_CODED_VALS} = 240; - my $text = `'$inst_dir/games/fortune' -o`; + my $text = `$inst_dir/games/fortune -o`; # TEST like( $text, qr/\A"Prayer/, 'fortune -o was not rotated' ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/tests/t/trailing-space-and-CRs.t new/fortune-mod-fortune-mod-2.10.0/fortune-mod/tests/t/trailing-space-and-CRs.t --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/tests/t/trailing-space-and-CRs.t 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/tests/t/trailing-space-and-CRs.t 2019-06-30 13:35:34.000000000 +0200 @@ -51,6 +51,13 @@ } } } + else + { + if ( ( $r->dir_components->[-1] // '' ) eq '.git' ) + { + $tree->prune; + } + } } # TEST diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/tests/t/valgrind.t new/fortune-mod-fortune-mod-2.10.0/fortune-mod/tests/t/valgrind.t --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/tests/t/valgrind.t 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/tests/t/valgrind.t 2019-06-30 13:35:34.000000000 +0200 @@ -6,7 +6,10 @@ use Test::More; use Test::RunValgrind; -# plan skip_all => 'lib-recode has memory leaks'; +if ( $^O eq "MSWin32" ) +{ + plan skip_all => 'valgrind is not available on Windows'; +} plan tests => 4; my $obj = Test::RunValgrind->new( {} ); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/util/fortune-mod-common.h new/fortune-mod-fortune-mod-2.10.0/fortune-mod/util/fortune-mod-common.h --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/util/fortune-mod-common.h 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/util/fortune-mod-common.h 2019-06-30 13:35:34.000000000 +0200 @@ -57,3 +57,9 @@ #ifndef MAXPATHLEN #define MAXPATHLEN 1024 #endif /* MAXPATHLEN */ +#if defined(_WIN32) +#include "getopt.h" +#define random(x) rand(x) +#define srandom(x) srand(x) +#define sleep(n) _sleep((n)*1000) +#endif diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/util/getopt.c new/fortune-mod-fortune-mod-2.10.0/fortune-mod/util/getopt.c --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/util/getopt.c 1970-01-01 01:00:00.000000000 +0100 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/util/getopt.c 2019-06-30 13:35:34.000000000 +0200 @@ -0,0 +1,107 @@ +#include "getopt.h" // make sure you construct the header file as dictated above + +/* +* Copyright (c) 1987, 1993, 1994 +* The Regents of the University of California. All rights reserved. +* +* Redistribution and use in source and binary forms, with or without +* modification, are permitted provided that the following conditions +* are met: +* 1. Redistributions of source code must retain the above copyright +* notice, this list of conditions and the following disclaimer. +* 2. Redistributions in binary form must reproduce the above copyright +* notice, this list of conditions and the following disclaimer in the +* documentation and/or other materials provided with the distribution. +* 3. All advertising materials mentioning features or use of this software +* must display the following acknowledgement: +* This product includes software developed by the University of +* California, Berkeley and its contributors. +* 4. Neither the name of the University nor the names of its contributors +* may be used to endorse or promote products derived from this software +* without specific prior written permission. +* +* THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND +* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE +* ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE +* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS +* OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) +* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT +* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY +* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF +* SUCH DAMAGE. +*/ + +#include <string.h> +#include <stdio.h> + +int opterr = 1, /* if error message should be printed */ + optind = 1, /* index into parent argv vector */ + optopt, /* character checked for validity */ + optreset; /* reset getopt */ +char *optarg; /* argument associated with option */ + +#define BADCH (int)'?' +#define BADARG (int)':' +#define EMSG "" + +/* + * getopt -- + * Parse argc/argv argument vector. + */ +int getopt(int nargc, char * const nargv[], const char *ostr) +{ + static char *place = EMSG; /* option letter processing */ + const char *oli; /* option letter list index */ + + if (optreset || !*place) { /* update scanning pointer */ + optreset = 0; + if (optind >= nargc || *(place = nargv[optind]) != '-') { + place = EMSG; + return (-1); + } + if (place[1] && *++place == '-') { /* found "--" */ + ++optind; + place = EMSG; + return (-1); + } + } /* option letter okay? */ + if ((optopt = (int)*place++) == (int)':' || + !(oli = strchr(ostr, optopt))) { + /* + * if the user didn't specify '-' as an option, + * assume it means -1. + */ + if (optopt == (int)'-') + return (-1); + if (!*place) + ++optind; + if (opterr && *ostr != ':') + (void)printf("illegal option -- %c\n", optopt); + return (BADCH); + } + if (*++oli != ':') { /* don't need argument */ + optarg = NULL; + if (!*place) + ++optind; + } + else { /* need an argument */ + if (*place) /* no white space */ + optarg = place; + else if (nargc <= ++optind) { /* no arg */ + place = EMSG; + if (*ostr == ':') + return (BADARG); + if (opterr) + (void)printf("option requires an argument -- %c\n", optopt); + return (BADCH); + } + else /* white space */ + optarg = nargv[optind]; + place = EMSG; + ++optind; + } + return (optopt); /* dump back option letter */ +} + diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/util/getopt.h new/fortune-mod-fortune-mod-2.10.0/fortune-mod/util/getopt.h --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/util/getopt.h 1970-01-01 01:00:00.000000000 +0100 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/util/getopt.h 2019-06-30 13:35:34.000000000 +0200 @@ -0,0 +1,15 @@ +/* + * getopt.h + */ + +#ifndef GETOPT_H +#define GETOPT_H + +extern int opterr, /* if error message should be printed */ + optind, /* index into parent argv vector */ + optopt, /* character checked for validity */ + optreset; /* reset getopt */ +extern char *optarg; /* argument associated with option */ +int getopt(int nargc, char * const nargv[], const char *ostr) ; + +#endif /* !GETOPT_H */ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/util/randstr.c new/fortune-mod-fortune-mod-2.10.0/fortune-mod/util/randstr.c --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/util/randstr.c 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/util/randstr.c 2019-06-30 13:35:34.000000000 +0200 @@ -87,6 +87,7 @@ */ #include "fortune-mod-common.h" +#include "rinutils/unused.h" char *Infile, /* name of input file */ Datafile[MAXPATHLEN], /* name of data file */ @@ -97,9 +98,8 @@ off_t pos, Seekpts[2]; /* seek pointers to fortunes */ -void getargs(int ac, char *av[]) +static void getargs(char *av[]) { - extern int optind; char *extc; av += optind + 1; @@ -135,7 +135,7 @@ * Get the position from the pos file, if there is one. If not, * return a random number. */ -void get_pos(STRFILE * fp) +static void get_pos(STRFILE * fp) { pos = random() % fp->str_numstr; if (++(pos) >= fp->str_numstr) @@ -146,23 +146,22 @@ * get_fort: * Get the fortune data file's seek pointer for the next fortune. */ -void get_fort(STRFILE fp) +static void get_fort(STRFILE fp) { - register int choice; - - choice = random() % fp.str_numstr; - get_pos(&fp); fseek(Dataf, (long) (sizeof fp + pos * sizeof Seekpts[0]), 0); - fread(Seekpts, sizeof Seekpts, 1, Dataf); + if (!fread(Seekpts, sizeof Seekpts, 1, Dataf)) + { + exit(1); + } Seekpts[0] = ntohl(Seekpts[0]); Seekpts[1] = ntohl(Seekpts[1]); } -void display(FILE * fp, STRFILE table) +static void display(FILE * fp, STRFILE table) { register char *p, ch; - unsigned char line[BUFSIZ]; + char line[BUFSIZ]; int i; fseek(fp, (long) Seekpts[0], 0); @@ -171,20 +170,22 @@ { if (table.str_flags & STR_ROTATED) for (p = line; (ch = *p); ++p) + { if (isupper(ch)) *p = 'A' + (ch - 'A' + 13) % 26; else if (islower(ch)) *p = 'a' + (ch - 'a' + 13) % 26; + } fputs(line, stdout); } fflush(stdout); } -int main(int ac, char **av) +int main(int ac GCC_UNUSED, char **av) { static STRFILE tbl; /* description table */ - getargs(ac, av); + getargs(av); if ((Inf = fopen(Infile, "r")) == NULL) { perror(Infile); @@ -195,7 +196,10 @@ perror(Datafile); exit(1); } - fread((char *) &tbl, sizeof tbl, 1, Dataf); + if (!fread((char *) &tbl, sizeof tbl, 1, Dataf)) + { + exit(1); + } tbl.str_version = ntohl(tbl.str_version); tbl.str_numstr = ntohl(tbl.str_numstr); tbl.str_longlen = ntohl(tbl.str_longlen); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/util/unstr.c new/fortune-mod-fortune-mod-2.10.0/fortune-mod/util/unstr.c --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/util/unstr.c 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/util/unstr.c 2019-06-30 13:35:34.000000000 +0200 @@ -168,7 +168,10 @@ for (i = 0; i <= tbl->str_numstr; i++) { - fread((char *) &pos, 1, sizeof pos, Dataf); + if (!fread((char *) &pos, 1, sizeof pos, Dataf)) + { + exit(1); + } fseek(Inf, ntohl((uint32_t)pos), 0); printedsome = 0; for (;;) @@ -211,12 +214,13 @@ perror(Outfile); exit(1); } - fread(&tbl.str_version, sizeof(tbl.str_version), 1, Dataf); - fread(&tbl.str_numstr, sizeof(tbl.str_numstr), 1, Dataf); - fread(&tbl.str_longlen, sizeof(tbl.str_longlen), 1, Dataf); - fread(&tbl.str_shortlen, sizeof(tbl.str_shortlen), 1, Dataf); - fread(&tbl.str_flags, sizeof(tbl.str_flags), 1, Dataf); - fread( tbl.stuff, sizeof(tbl.stuff), 1, Dataf); +#define err_fread(a, b, c, d) if (!fread(a, b, c, d)) { perror("fread"); exit(1); } + err_fread(&tbl.str_version, sizeof(tbl.str_version), 1, Dataf); + err_fread(&tbl.str_numstr, sizeof(tbl.str_numstr), 1, Dataf); + err_fread(&tbl.str_longlen, sizeof(tbl.str_longlen), 1, Dataf); + err_fread(&tbl.str_shortlen, sizeof(tbl.str_shortlen), 1, Dataf); + err_fread(&tbl.str_flags, sizeof(tbl.str_flags), 1, Dataf); + err_fread( tbl.stuff, sizeof(tbl.stuff), 1, Dataf); if (!(tbl.str_flags & (STR_ORDERED | STR_RANDOM)) && (!NewDelch)) { fprintf(stderr, "nothing to do -- table in file order\n"); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/fortune-mod/ver.txt new/fortune-mod-fortune-mod-2.10.0/fortune-mod/ver.txt --- old/fortune-mod-fortune-mod-2.8.0/fortune-mod/ver.txt 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/fortune-mod/ver.txt 2019-06-30 13:35:34.000000000 +0200 @@ -1 +1 @@ -2.8.0 +2.10.0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/fortune-mod-fortune-mod-2.8.0/scripts/Tatzer new/fortune-mod-fortune-mod-2.10.0/scripts/Tatzer --- old/fortune-mod-fortune-mod-2.8.0/scripts/Tatzer 2019-06-07 20:18:06.000000000 +0200 +++ new/fortune-mod-fortune-mod-2.10.0/scripts/Tatzer 2019-06-30 13:35:34.000000000 +0200 @@ -125,7 +125,7 @@ exec( "bash", $FN ); } -my $HOME = $ENV{HOME}; +my $HOME = $ENV{HOME} // $ENV{userprofile} // ""; foreach my $rec ( { id => "c2", a => "core2", },
