pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/games/fortune



Module Name:    pkgsrc
Committed By:   jperkin
Date:           Mon Aug  7 11:10:32 UTC 2017

Added Files:
        pkgsrc/games/fortune: DESCR Makefile PLIST distinfo options.mk
        pkgsrc/games/fortune/patches: patch-Makefile patch-datfiles_Makefile
            patch-datfiles_html_Makefile patch-datfiles_off_Makefile
            patch-fortune_fortune.c patch-util_strfile.h

Log Message:
Import fortune-19970829 into pkgsrc as games/fortune.

This is the Linux "port" of BSD fortune, but has been patched to work with
BSD fortune files so that those available already in pkgsrc will work.  The
pkgsrc strfile has been made a full dependency so that those with dat files
in the Linux format can easily regenerate them to be compatible.


To generate a diff of this commit:
cvs rdiff -u -r0 -r1.1 pkgsrc/games/fortune/DESCR \
    pkgsrc/games/fortune/Makefile pkgsrc/games/fortune/PLIST \
    pkgsrc/games/fortune/distinfo pkgsrc/games/fortune/options.mk
cvs rdiff -u -r0 -r1.1 pkgsrc/games/fortune/patches/patch-Makefile \
    pkgsrc/games/fortune/patches/patch-datfiles_Makefile \
    pkgsrc/games/fortune/patches/patch-datfiles_html_Makefile \
    pkgsrc/games/fortune/patches/patch-datfiles_off_Makefile \
    pkgsrc/games/fortune/patches/patch-fortune_fortune.c \
    pkgsrc/games/fortune/patches/patch-util_strfile.h

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Added files:

Index: pkgsrc/games/fortune/DESCR
diff -u /dev/null pkgsrc/games/fortune/DESCR:1.1
--- /dev/null   Mon Aug  7 11:10:32 2017
+++ pkgsrc/games/fortune/DESCR  Mon Aug  7 11:10:32 2017
@@ -0,0 +1,24 @@
+This version of fortune is a modification of the NetBSD fortune, as
+tweaked by Florian La Roche (see below, and many thanks to Florian for
+starting the update), and then massively hacked on by Amy Lewis.
+
+I (Amy) hacked on this because it was broken; the BSD source itself is
+broken (I looked at it).  Specifically, if you are using an old version
+of fortune, then it accesses *only* the two files "fortunes" and
+"fortunes-o", even though 'fortune -[ao]f' will tell you differently.
+That was my original reason to start working with the code.
+
+Bug fixes: fortune now reads the same file list that it reports with -f.
+strfile now really sorts and randomizes, instead of just setting the
+'sorted' and 'randomized' flags.  strfile does not lose the pointer to a
+fortune that follows a null fortune.
+
+Enhancements: fortune -f now prints percentages, whether specified on the
+command line or not.  fortune -m now prints filenames to stderr; the
+fortunes printed to stdout can be redirected into a file which is valid
+strfile format.  fortune -l|s can be modified with -n _number_ to specify
+the number of characters in a short fortune (default 160, as before).
+The means of distinguishing between offensive and inoffensive fortunes is
+changed: offensive fortunes are put in a separate subdirectory.  The
+contents of the fortunes databases have been extensively reviewed, and
+broken into smaller, more manageable [hopefully] files.
Index: pkgsrc/games/fortune/Makefile
diff -u /dev/null pkgsrc/games/fortune/Makefile:1.1
--- /dev/null   Mon Aug  7 11:10:32 2017
+++ pkgsrc/games/fortune/Makefile       Mon Aug  7 11:10:32 2017
@@ -0,0 +1,22 @@
+# $NetBSD: Makefile,v 1.1 2017/08/07 11:10:32 jperkin Exp $
+
+DISTNAME=      fortune-mod-9708
+PKGNAME=       fortune-19970829
+CATEGORIES=    games
+MASTER_SITES=  http://www.ibiblio.org/pub/linux/games/amusements/fortune/
+
+MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
+HOMEPAGE=      http://www.ibiblio.org/pub/linux/games/amusements/fortune/
+COMMENT=       Fortune cookie generator
+LICENSE=       original-bsd
+
+DEPENDS+=      fortune-strfile>=0:../../games/fortune-strfile
+
+.include "options.mk"
+
+BUILD_TARGET=  fortune-bin cookies-z
+MAKE_ENV+=     STRFILE=${PREFIX}/bin/strfile
+
+PRINT_PLIST_AWK+=      /fortune\/off\// { $$0 = "$${PLIST.off}" $$0; }
+
+.include "../../mk/bsd.pkg.mk"
Index: pkgsrc/games/fortune/PLIST
diff -u /dev/null pkgsrc/games/fortune/PLIST:1.1
--- /dev/null   Mon Aug  7 11:10:32 2017
+++ pkgsrc/games/fortune/PLIST  Mon Aug  7 11:10:32 2017
@@ -0,0 +1,109 @@
+@comment $NetBSD: PLIST,v 1.1 2017/08/07 11:10:32 jperkin Exp $
+bin/fortune
+share/games/fortune/art
+share/games/fortune/art.dat
+share/games/fortune/ascii-art
+share/games/fortune/ascii-art.dat
+share/games/fortune/computers
+share/games/fortune/computers.dat
+share/games/fortune/cookie
+share/games/fortune/cookie.dat
+share/games/fortune/definitions
+share/games/fortune/definitions.dat
+share/games/fortune/drugs
+share/games/fortune/drugs.dat
+share/games/fortune/education
+share/games/fortune/education.dat
+share/games/fortune/ethnic
+share/games/fortune/ethnic.dat
+share/games/fortune/food
+share/games/fortune/food.dat
+share/games/fortune/fortunes
+share/games/fortune/fortunes.dat
+share/games/fortune/goedel
+share/games/fortune/goedel.dat
+share/games/fortune/humorists
+share/games/fortune/humorists.dat
+share/games/fortune/kids
+share/games/fortune/kids.dat
+share/games/fortune/law
+share/games/fortune/law.dat
+share/games/fortune/linuxcookie
+share/games/fortune/linuxcookie.dat
+share/games/fortune/literature
+share/games/fortune/literature.dat
+share/games/fortune/love
+share/games/fortune/love.dat
+share/games/fortune/magic
+share/games/fortune/magic.dat
+share/games/fortune/medicine
+share/games/fortune/medicine.dat
+share/games/fortune/men-women
+share/games/fortune/men-women.dat
+share/games/fortune/miscellaneous
+share/games/fortune/miscellaneous.dat
+share/games/fortune/news
+share/games/fortune/news.dat
+${PLIST.off}share/games/fortune/off/astrology
+${PLIST.off}share/games/fortune/off/astrology.dat
+${PLIST.off}share/games/fortune/off/black-humor
+${PLIST.off}share/games/fortune/off/black-humor.dat
+${PLIST.off}share/games/fortune/off/definitions
+${PLIST.off}share/games/fortune/off/definitions.dat
+${PLIST.off}share/games/fortune/off/drugs
+${PLIST.off}share/games/fortune/off/drugs.dat
+${PLIST.off}share/games/fortune/off/ethnic
+${PLIST.off}share/games/fortune/off/ethnic.dat
+${PLIST.off}share/games/fortune/off/hphobia
+${PLIST.off}share/games/fortune/off/hphobia.dat
+${PLIST.off}share/games/fortune/off/limerick
+${PLIST.off}share/games/fortune/off/limerick.dat
+${PLIST.off}share/games/fortune/off/misandry
+${PLIST.off}share/games/fortune/off/misandry.dat
+${PLIST.off}share/games/fortune/off/miscellaneous
+${PLIST.off}share/games/fortune/off/miscellaneous.dat
+${PLIST.off}share/games/fortune/off/misogyny
+${PLIST.off}share/games/fortune/off/misogyny.dat
+${PLIST.off}share/games/fortune/off/politics
+${PLIST.off}share/games/fortune/off/politics.dat
+${PLIST.off}share/games/fortune/off/privates
+${PLIST.off}share/games/fortune/off/privates.dat
+${PLIST.off}share/games/fortune/off/racism
+${PLIST.off}share/games/fortune/off/racism.dat
+${PLIST.off}share/games/fortune/off/religion
+${PLIST.off}share/games/fortune/off/religion.dat
+${PLIST.off}share/games/fortune/off/riddles
+${PLIST.off}share/games/fortune/off/riddles.dat
+${PLIST.off}share/games/fortune/off/sex
+${PLIST.off}share/games/fortune/off/sex.dat
+${PLIST.off}share/games/fortune/off/songs-poems
+${PLIST.off}share/games/fortune/off/songs-poems.dat
+${PLIST.off}share/games/fortune/off/vulgarity
+${PLIST.off}share/games/fortune/off/vulgarity.dat
+share/games/fortune/people
+share/games/fortune/people.dat
+share/games/fortune/pets
+share/games/fortune/pets.dat
+share/games/fortune/platitudes
+share/games/fortune/platitudes.dat
+share/games/fortune/politics
+share/games/fortune/politics.dat
+share/games/fortune/riddles
+share/games/fortune/riddles.dat
+share/games/fortune/science
+share/games/fortune/science.dat
+share/games/fortune/songs-poems
+share/games/fortune/songs-poems.dat
+share/games/fortune/sports
+share/games/fortune/sports.dat
+share/games/fortune/startrek
+share/games/fortune/startrek.dat
+share/games/fortune/translate-me
+share/games/fortune/translate-me.dat
+share/games/fortune/wisdom
+share/games/fortune/wisdom.dat
+share/games/fortune/work
+share/games/fortune/work.dat
+share/games/fortune/zippy
+share/games/fortune/zippy.dat
+man/man6/fortune.6
Index: pkgsrc/games/fortune/distinfo
diff -u /dev/null pkgsrc/games/fortune/distinfo:1.1
--- /dev/null   Mon Aug  7 11:10:32 2017
+++ pkgsrc/games/fortune/distinfo       Mon Aug  7 11:10:32 2017
@@ -0,0 +1,12 @@
+$NetBSD: distinfo,v 1.1 2017/08/07 11:10:32 jperkin Exp $
+
+SHA1 (fortune-mod-9708.tar.gz) = 9f96a00dbf5d2c6b0e7324af0eae988ce6adc5ad
+RMD160 (fortune-mod-9708.tar.gz) = bf40efcfde2e854166bccdbccf7cf23bfb443e61
+SHA512 (fortune-mod-9708.tar.gz) = 80c5b71d84eeb3092b2dfe483f0dad8ed42e2efeaa1f8791c26fb2ae80fbd7775777ac5252b1d8270e2e176ad14ce98940bee6d8e71fdbb9ac3323dc7188c4d0
+Size (fortune-mod-9708.tar.gz) = 1408517 bytes
+SHA1 (patch-Makefile) = b2429bba09ffdc7d571c5d98833a4ff5a6e2fb21
+SHA1 (patch-datfiles_Makefile) = fd0d1b87bd2532bada57517970cf7676ee678720
+SHA1 (patch-datfiles_html_Makefile) = aef5d7d6275943e94e4f79f2db64445605d329ce
+SHA1 (patch-datfiles_off_Makefile) = 31aa90703d86df0c1d50e5cadfb0ec92a5800199
+SHA1 (patch-fortune_fortune.c) = 734f7c2bd5ebfc3c8d28148e0674bccacdccfc1f
+SHA1 (patch-util_strfile.h) = dd58d46bf13f5a7eeb245a3b747a26fa1e946113
Index: pkgsrc/games/fortune/options.mk
diff -u /dev/null pkgsrc/games/fortune/options.mk:1.1
--- /dev/null   Mon Aug  7 11:10:32 2017
+++ pkgsrc/games/fortune/options.mk     Mon Aug  7 11:10:32 2017
@@ -0,0 +1,15 @@
+# $NetBSD: options.mk,v 1.1 2017/08/07 11:10:32 jperkin Exp $
+
+PKG_OPTIONS_VAR=               PKG_OPTIONS.fortune
+PKG_SUPPORTED_OPTIONS=         offensive
+
+.include "../../mk/bsd.options.mk"
+
+PLIST_VARS+=   off
+
+.if !empty(PKG_OPTIONS:Moffensive)
+MAKE_ENV+=     OFFENSIVE=1
+PLIST.off=     yes
+.else
+MAKE_ENV+=     OFFENSIVE=0
+.endif

Index: pkgsrc/games/fortune/patches/patch-Makefile
diff -u /dev/null pkgsrc/games/fortune/patches/patch-Makefile:1.1
--- /dev/null   Mon Aug  7 11:10:32 2017
+++ pkgsrc/games/fortune/patches/patch-Makefile Mon Aug  7 11:10:32 2017
@@ -0,0 +1,109 @@
+$NetBSD: patch-Makefile,v 1.1 2017/08/07 11:10:32 jperkin Exp $
+
+Use pkgsrc layout and flags.
+
+--- Makefile.orig      1997-08-28 19:36:15.000000000 +0000
++++ Makefile
+@@ -3,27 +3,27 @@
+ #
+ 
+ # Where does the fortune program go?
+-FORTDIR=/usr/local/games
++FORTDIR=${PREFIX}/bin
+ # Where do the data files (fortunes, or cookies) go?
+-COOKIEDIR=/usr/local/share/games/fortunes
++COOKIEDIR=${PREFIX}/share/games/fortune
+ # Offensive ones?
+ OCOOKIEDIR=$(COOKIEDIR)/off
+ # The ones with html tags?
+ WCOOKIEDIR=$(COOKIEDIR)/html
+ # Where do strfile and unstr go?
+-BINDIR=/usr/local/bin
++BINDIR=${PREFIX}/bin
+ # What is the proper mode for strfile and unstr? 755= everyone, 700= root only
+ BINMODE=0755
+ #BINMODE=0700
+ # Where do the man pages for strfile and unstr go?
+-BINMANDIR=/usr/local/man/man1
++BINMANDIR=${PREFIX}/${PKGMANDIR}/man1
+ # What is their proper extension?
+ BINMANEXT=1
+ # And the same for the fortune man page
+-FORTMANDIR=/usr/local/man/man6
++FORTMANDIR=${PREFIX}/${PKGMANDIR}/man6
+ FORTMANEXT=6
+ # Do we want to install the offensive files? (0 no, 1 yes)
+-OFFENSIVE=1
++#OFFENSIVE=1
+ # Do we want to install files with html tags? (0 no, 1 yes)
+ # (Note: These files are not yet available)
+ WEB=0
+@@ -46,7 +46,7 @@ WEB=0
+ # NB. Under Linux, the BSD regex functions are _MUCH_ faster
+ #     than the POSIX ones, but your mileage may vary.
+ #
+-REGEXDEFS=-DHAVE_REGEX_H -DBSD_REGEX
++REGEXDEFS=-DHAVE_REGEX_H -DPOSIX_REGEX
+ 
+ #
+ # If your system's regex functions are not in its standard C library,
+@@ -55,8 +55,8 @@ REGEXDEFS=-DHAVE_REGEX_H -DBSD_REGEX
+ REGEXLIBS=
+ 
+ DEFINES=-DFORTDIR="\"$(COOKIEDIR)\"" -DOFFDIR="\"$(OCOOKIEDIR)\""
+-CFLAGS=-O2 $(DEFINES) -Wall -fomit-frame-pointer -pipe
+-LDFLAGS=-s
++CFLAGS += $(DEFINES)
++#LDFLAGS=-s
+ 
+ # The above flags are used by default; the debug flags are used when make
+ # is called with a debug target, such as 'make debug'
+@@ -71,12 +71,12 @@ DEBUGCFLAGS=-g -DDEBUG $(DEFINES) -Wall
+ DEBUGLDFLAGS=
+ 
+ # Only ANSI-compatible C compilers are currently supported
+-CC=gcc
++#CC=gcc
+ 
+ # ----------------------------------------
+ # Nothing below this line should have to be changed
+ 
+-SUBDIRS=fortune util datfiles
++SUBDIRS=fortune datfiles
+ 
+ .PHONY: all debug fortune-bin fortune-debug util-bin randstr rot \
+       util-debug cookies cookies-z install install-fortune \
+@@ -118,18 +118,18 @@ cookies:
+       @echo "Sorry, just joking."
+       $(MAKE) cookies-z
+ 
+-cookies-z: util-bin
++cookies-z:
+       cd datfiles && $(MAKE) COOKIEDIR=$(COOKIEDIR) \
+                   OCOOKIEDIR=$(OCOOKIEDIR) WCOOKIEDIR=$(WCOOKIEDIR) \
+                   OFFENSIVE=$(OFFENSIVE) WEB=$(WEB)
+ 
+ # Install everything
+-install: install-fortune install-util install-man install-cookie
++install: install-fortune install-fman install-cookie
+ 
+ # Install just the fortune program
+ install-fortune: fortune-bin
+-      install -m 0755 -d $(FORTDIR)
+-      install -m 0755 fortune/fortune $(FORTDIR)
++      install -m 0755 -d $(DESTDIR)$(FORTDIR)
++      install -m 0755 fortune/fortune $(DESTDIR)$(FORTDIR)
+ 
+ # Install just the utilities strfile and unstr
+ install-util: util-bin
+@@ -155,8 +155,8 @@ fortune/fortune.man: fortune/fortune-man
+ 
+ # Install the fortune man pages
+ install-fman: fortune/fortune.man
+-      install -m 0755 -d $(FORTMANDIR)
+-      install -m 0644 fortune/fortune.man $(FORTMANDIR)/fortune.$(FORTMANEXT)
++      install -m 0755 -d $(DESTDIR)$(FORTMANDIR)
++      install -m 0644 fortune/fortune.man $(DESTDIR)$(FORTMANDIR)/fortune.$(FORTMANEXT)
+ 
+ # Install the utilities man pages
+ install-uman:
Index: pkgsrc/games/fortune/patches/patch-datfiles_Makefile
diff -u /dev/null pkgsrc/games/fortune/patches/patch-datfiles_Makefile:1.1
--- /dev/null   Mon Aug  7 11:10:32 2017
+++ pkgsrc/games/fortune/patches/patch-datfiles_Makefile        Mon Aug  7 11:10:32 2017
@@ -0,0 +1,30 @@
+$NetBSD: patch-datfiles_Makefile,v 1.1 2017/08/07 11:10:32 jperkin Exp $
+
+Use pkgsrc strfile.
+Support DESTDIR.
+
+--- datfiles/Makefile.orig     1997-08-28 16:38:25.000000000 +0000
++++ datfiles/Makefile
+@@ -5,7 +5,7 @@ COOKIES=art ascii-art computers cookie d
+       platitudes politics riddles science songs-poems sports \
+       startrek translate-me wisdom work zippy
+ 
+-STRFILE=../util/strfile
++#STRFILE=../util/strfile
+ 
+ .PHONY: all cookies o-cookies w-cookies install clean
+ 
+@@ -27,11 +27,11 @@ cookies-stamp:
+       touch cookies-stamp
+ 
+ install: cookies-stamp
+-      install -m 0755 -d $(COOKIEDIR)
++      install -m 0755 -d $(DESTDIR)$(COOKIEDIR)
+       if [ $(OFFENSIVE) = 1 ] ; then cd off && $(MAKE) install ; fi
+       if [ $(WEB) = 1 ] ; then cd html && $(MAKE) install ; fi
+       for i in $(COOKIES) ; do \
+-              install -m 0644 $$i $$i.dat $(COOKIEDIR) || exit $? ; done
++              install -m 0644 $$i $$i.dat $(DESTDIR)$(COOKIEDIR) || exit $? ; done
+ 
+ clean:
+       rm -f cookies-stamp *.dat
Index: pkgsrc/games/fortune/patches/patch-datfiles_html_Makefile
diff -u /dev/null pkgsrc/games/fortune/patches/patch-datfiles_html_Makefile:1.1
--- /dev/null   Mon Aug  7 11:10:32 2017
+++ pkgsrc/games/fortune/patches/patch-datfiles_html_Makefile   Mon Aug  7 11:10:32 2017
@@ -0,0 +1,28 @@
+$NetBSD: patch-datfiles_html_Makefile,v 1.1 2017/08/07 11:10:32 jperkin Exp $
+
+Use pkgsrc strfile.
+Support DESTDIR.
+
+--- datfiles/html/Makefile.orig        1997-08-28 16:41:26.000000000 +0000
++++ datfiles/html/Makefile
+@@ -1,7 +1,7 @@
+ 
+ WCOOKIES=
+ 
+-STRFILE=../util/strfile
++#STRFILE=../util/strfile
+ 
+ 
+ all: wcookies-stamp
+@@ -12,9 +12,9 @@ wcookies-stamp:
+       touch cookies-stamp
+ 
+ install: wcookies-stamp
+-      install -m 0755 -d $(WCOOKIEDIR)
++      install -m 0755 -d $(DESTDIR)$(WCOOKIEDIR)
+       for i in $(WCOOKIES) ; do \
+-              install -m 0644 $$i $$i.dat $(WCOOKIEDIR) || exit $$? ; done
++              install -m 0644 $$i $$i.dat $(DESTDIR)$(WCOOKIEDIR) || exit $$? ; done
+ 
+ clean:
+       rm -f wcookies-stamp *.dat
Index: pkgsrc/games/fortune/patches/patch-datfiles_off_Makefile
diff -u /dev/null pkgsrc/games/fortune/patches/patch-datfiles_off_Makefile:1.1
--- /dev/null   Mon Aug  7 11:10:32 2017
+++ pkgsrc/games/fortune/patches/patch-datfiles_off_Makefile    Mon Aug  7 11:10:32 2017
@@ -0,0 +1,35 @@
+$NetBSD: patch-datfiles_off_Makefile,v 1.1 2017/08/07 11:10:32 jperkin Exp $
+
+Use pkgsrc strfile.
+Support DESTDIR.
+
+--- datfiles/off/Makefile.orig 1997-08-28 16:40:42.000000000 +0000
++++ datfiles/off/Makefile
+@@ -7,7 +7,7 @@ OCOOKIES_ROTATED=
+ 
+ OCOOKIES=$(OCOOKIES_UNROTATED) $(OCOOKIES_ROTATED)
+ 
+-STRFILE=../../util/strfile
++#STRFILE=../../util/strfile
+ ROT=../../util/rot
+ 
+ 
+@@ -18,15 +18,15 @@ ocookies-stamp:    rotated-stamp
+       for i in $(OCOOKIES) ; do $(STRFILE) -x $$i || exit $$? ; done
+       touch ocookies-stamp
+ 
+-rotated-stamp:
++rotated-stamp: ${ROT}
+       for i in $(OCOOKIES_UNROTATED) ; \
+           do $(ROT) < unrotated/$$i > $$i || exit $$? ; done
+       touch rotated-stamp
+ 
+ install:
+-      install -m 0755 -d $(OCOOKIEDIR)
++      install -m 0755 -d $(DESTDIR)$(OCOOKIEDIR)
+       for i in $(OCOOKIES) ; \
+-          do install -m 0644 $$i $$i.dat $(OCOOKIEDIR) || exit $$? ; done
++          do install -m 0644 $$i $$i.dat $(DESTDIR)$(OCOOKIEDIR) || exit $$? ; done
+ 
+ clean:
+       rm -f ocookies-stamp rotated-stamp *.dat $(OCOOKIES_UNROTATED)
Index: pkgsrc/games/fortune/patches/patch-fortune_fortune.c
diff -u /dev/null pkgsrc/games/fortune/patches/patch-fortune_fortune.c:1.1
--- /dev/null   Mon Aug  7 11:10:32 2017
+++ pkgsrc/games/fortune/patches/patch-fortune_fortune.c        Mon Aug  7 11:10:32 2017
@@ -0,0 +1,48 @@
+$NetBSD: patch-fortune_fortune.c,v 1.1 2017/08/07 11:10:32 jperkin Exp $
+
+Make fortune compatible with BSD strfile datfiles.
+
+--- fortune/fortune.c.orig     1997-08-28 19:43:52.000000000 +0000
++++ fortune/fortune.c
+@@ -142,6 +142,15 @@ static char rcsid[] = "$NetBSD: fortune.
+ #define       NDEBUG  1
+ #endif
+ 
++#ifdef __APPLE__
++#include <libkern/OSByteOrder.h>
++#define BE32TOH(x) x = OSSwapBigToHostInt32(x)
++#define BE64TOH(x) x = OSSwapBigToHostInt64(x)
++#elif defined __sun
++#define BE32TOH(x) x = BE_IN32(&(x))
++#define BE64TOH(x) x = BE_IN64(&(x))
++#endif
++
+ typedef struct fd
+ {
+     int percent;
+@@ -925,10 +934,10 @@ void get_tbl(FILEDESC * fp)
+           exit(1);
+       }
+       /* fp->tbl.str_version = ntohl(fp->tbl.str_version); */
+-      fp->tbl.str_numstr = ntohl(fp->tbl.str_numstr);
+-      fp->tbl.str_longlen = ntohl(fp->tbl.str_longlen);
+-      fp->tbl.str_shortlen = ntohl(fp->tbl.str_shortlen);
+-      fp->tbl.str_flags = ntohl(fp->tbl.str_flags);
++      BE32TOH(fp->tbl.str_numstr);
++      BE32TOH(fp->tbl.str_longlen);
++      BE32TOH(fp->tbl.str_shortlen);
++      BE32TOH(fp->tbl.str_flags);
+       close(fd);
+     }
+     else
+@@ -1098,8 +1107,8 @@ void get_fort(void)
+     lseek(fp->datfd,
+         (off_t) (sizeof fp->tbl + fp->pos * sizeof Seekpts[0]), 0);
+     read(fp->datfd, Seekpts, sizeof Seekpts);
+-    Seekpts[0] = ntohl(Seekpts[0]);
+-    Seekpts[1] = ntohl(Seekpts[1]);
++    BE64TOH(Seekpts[0]);
++    BE64TOH(Seekpts[1]);
+ }
+ 
+ /*
Index: pkgsrc/games/fortune/patches/patch-util_strfile.h
diff -u /dev/null pkgsrc/games/fortune/patches/patch-util_strfile.h:1.1
--- /dev/null   Mon Aug  7 11:10:32 2017
+++ pkgsrc/games/fortune/patches/patch-util_strfile.h   Mon Aug  7 11:10:32 2017
@@ -0,0 +1,26 @@
+$NetBSD: patch-util_strfile.h,v 1.1 2017/08/07 11:10:32 jperkin Exp $
+
+Make fortune compatible with BSD strfile datfiles.
+
+--- util/strfile.h.orig        1995-03-23 11:04:08.000000000 +0000
++++ util/strfile.h
+@@ -43,14 +43,14 @@
+ 
+ typedef struct {                              /* information table */
+ #define       VERSION         1
+-      unsigned long   str_version;            /* version number */
+-      unsigned long   str_numstr;             /* # of strings in the file */
+-      unsigned long   str_longlen;            /* length of longest string */
+-      unsigned long   str_shortlen;           /* length of shortest string */
++      uint32_t        str_version;            /* version number */
++      uint32_t        str_numstr;             /* # of strings in the file */
++      uint32_t        str_longlen;            /* length of longest string */
++      uint32_t        str_shortlen;           /* length of shortest string */
+ #define       STR_RANDOM      0x1                     /* randomized pointers */
+ #define       STR_ORDERED     0x2                     /* ordered pointers */
+ #define       STR_ROTATED     0x4                     /* rot-13'd text */
+-      unsigned long   str_flags;              /* bit field for flags */
++      uint32_t        str_flags;              /* bit field for flags */
+       unsigned char   stuff[4];               /* long aligned space */
+ #define       str_delim       stuff[0]                /* delimiting character */
+ } STRFILE;



Home | Main Index | Thread Index | Old Index