Modify

Opened 11 years ago

Closed 11 years ago

#2136 closed enhancement (fixed)

[patch] - fix fortune mod so that for the build libc6-i386-dev is not needed

Reported by: h3sp4wn Owned by: developers
Priority: low Milestone:
Component: packages Version:
Keywords: Cc:

Description

+--- fortune-mod-1.2.1/util/strfile.c.orig	2007-07-27 00:40:54.687140050 +0100
++++ fortune-mod-1.2.1/util/strfile.c	2007-07-27 00:41:14.184165656 +0100
+@@ -144,7 +135,7 @@
+ typedef struct
+ {
+     char first;
+-    off_t pos;
++    int32_t pos;
+ }
+ STR;
+ 
+@@ -159,7 +150,7 @@
+ int Xflag = FALSE;		/* set rotated bit */
+ long Num_pts = 0;		/* number of pointers/strings */
+ 
+-off_t *Seekpts;
++int32_t *Seekpts;
+ 
+ FILE *Sort_1, *Sort_2;		/* pointers for sorting */
+ 
+@@ -237,9 +228,9 @@
+  * add_offset:
+  *      Add an offset to the list, or write it out, as appropriate.
+  */
+-void add_offset(FILE * fp, off_t off)
++void add_offset(FILE * fp, int32_t off)
+ {
+-    off_t net;
++    int32_t net;
+ 
+     if (!STORING_PTRS)
+     {
+@@ -258,9 +249,9 @@
+  * fix_last_offset:
+  *     Used when we have two separators in a row.
+  */
+-void fix_last_offset(FILE * fp, off_t off)
++void fix_last_offset(FILE * fp, int32_t off)
+ {
+-    off_t net;
++    int32_t net;
+ 
+     if (!STORING_PTRS)
+     {
+@@ -333,7 +324,7 @@
+   do_order(void)
+ {
+     register long i;
+-    register off_t *lp;
++    register int32_t *lp;
+     register STR *fp;
+ 
+     Sort_1 = fopen(Infile, "r");
+@@ -384,8 +375,8 @@
+ void randomize(void)
+ {
+     register int cnt, i;
+-    register off_t tmp;
+-    register off_t *sp;
++    register int32_t tmp;
++    register int32_t *sp;
+     extern time_t time(time_t *);
+ 
+     srandom((int) (time((time_t *) NULL) + getpid()));
+@@ -422,7 +413,7 @@
+ {
+     register unsigned char *sp;
+     register FILE *inf, *outf;
+-    register off_t last_off, length, pos, *p;
++    register int32_t last_off, length, pos, *p;
+     register int first, cnt;
+     register char *nsp;
+     register STR *fp;
+@@ -514,14 +505,19 @@
+     if (!Sflag)
+     {
+ 	printf("\"%s\" created\n", Outfile);
+-	if (Num_pts == 2)
+-	    puts("There was 1 string");
++	if (Num_pts == 1)
++	    puts("There was no string");
+ 	else
+-	    printf("There were %ld strings\n", Num_pts - 1);
+-	printf("Longest string: %lu byte%s\n", Tbl.str_longlen,
+-	       Tbl.str_longlen == 1 ? "" : "s");
+-	printf("Shortest string: %lu byte%s\n", Tbl.str_shortlen,
+-	       Tbl.str_shortlen == 1 ? "" : "s");
++	{
++	    if (Num_pts == 2)
++		puts("There was 1 string");
++	    else
++		printf("There were %ld strings\n", Num_pts - 1);
++	    printf("Longest string: %lu byte%s\n", Tbl.str_longlen, 
++		Tbl.str_longlen == 1 ? "" : "s");
++	    printf("Shortest string: %lu byte%s\n", Tbl.str_shortlen,
++		Tbl.str_shortlen == 1 ? "" : "s");
++	}
+     }
+ 
+     fseek(outf, (off_t) 0, 0);
+@@ -533,12 +529,19 @@
+     Tbl.str_longlen = htonl(Tbl.str_longlen);
+     Tbl.str_shortlen = htonl(Tbl.str_shortlen);
+     Tbl.str_flags = htonl(Tbl.str_flags);
+-    fwrite((char *) &Tbl, sizeof Tbl, 1, outf);
++    fwrite(&Tbl.str_version,  sizeof Tbl.str_version,  1, outf);
++    fwrite(&Tbl.str_numstr,   sizeof Tbl.str_numstr,   1, outf);
++    fwrite(&Tbl.str_longlen,  sizeof Tbl.str_longlen,  1, outf);
++    fwrite(&Tbl.str_shortlen, sizeof Tbl.str_shortlen, 1, outf);
++    fwrite(&Tbl.str_flags,    sizeof Tbl.str_flags,    1, outf);
++    fwrite( Tbl.stuff,        sizeof Tbl.stuff,        1, outf);
+     if (STORING_PTRS)
+     {
+ 	for (p = Seekpts, cnt = Num_pts; cnt--; ++p)
++	{
+ 	    *p = htonl(*p);
+-	fwrite((char *) Seekpts, sizeof *Seekpts, (int) Num_pts, outf);
++	    fwrite(p, sizeof *p, 1, outf);
++	}
+     }
+     fclose(outf);
+     exit(0);
+--- fortune-mod-1.2.1/util/strfile.h	2000-01-29 11:14:34.000000000 +0000
++++ fortune-mod-1.2.1/util/strfile.h	2007-07-27 00:25:46.825640014 +0100
+@@ -38,24 +38,19 @@
+  *	@(#)strfile.h	8.1 (Berkeley) 5/31/93
+  */
+ 
+-/* Modified Jan 2000, Chris Ausbrooks <weed@bucket.pp.ualr.edu>
+- *  + Changed VERSION to FILE_VERSION to avoid warnings caused by
+- *    automake/autoconf.
+- */
+-
+ #define	STR_ENDSTRING(line,tbl) \
+ 	((line)[0] == (tbl).str_delim && (line)[1] == '\n')
+ 
+ typedef struct {				/* information table */
+-#define	FILE_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 */
++#define	FILE_VERSION		2
++	u_int32_t	str_version;		/* version number */
++	u_int32_t	str_numstr;		/* # of strings in the file */
++	u_int32_t	str_longlen;		/* length of longest string */
++	u_int32_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 */
+-	unsigned char	stuff[4];		/* long aligned space */
++	u_int32_t	str_flags;		/* bit field for flags */
++	u_int8_t	stuff[4];		/* long aligned space */
+ #define	str_delim	stuff[0]		/* delimiting character */
+ } STRFILE;
Index: utils/fortune-mod/Makefile
===================================================================
--- utils/fortune-mod/Makefile	(revision 8186)
+++ utils/fortune-mod/Makefile	(working copy)
@@ -10,7 +10,7 @@
 
 PKG_NAME:=fortune-mod
 PKG_VERSION:=1.2.1
-PKG_RELEASE:=1
+PKG_RELEASE:=2
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
 PKG_SOURCE_URL:=http://freeware.sgi.com/source/fortune-mod
@@ -30,7 +30,7 @@
 endef
 
 define Build/Compile
-	$(HOSTCC) -Wall -m32 -o $(PKG_BUILD_DIR)/util/strfile-host $(PKG_BUILD_DIR)/util/strfile.c -DVERSION=\"$(PKG_VERSION)\"
+	$(HOSTCC) -Wall -o $(PKG_BUILD_DIR)/util/strfile-host $(PKG_BUILD_DIR)/util/strfile.c -DVERSION=\"$(PKG_VERSION)\"
 	$(PKG_BUILD_DIR)/util/strfile-host $(PKG_BUILD_DIR)/datfiles/fortunes $(PKG_BUILD_DIR)/datfiles/fortunes.dat
 	$(MAKE) -C $(PKG_BUILD_DIR)/fortune
 endef

Attachments (1)

Make-strfile-64bit-safe-svn-diff (5.9 KB) - added by h3sp4wn 11 years ago.
svn diff (tested and works with armeb)

Download all attachments as: .zip

Change History (2)

Changed 11 years ago by h3sp4wn

svn diff (tested and works with armeb)

comment:1 Changed 11 years ago by florian

  • Resolution set to fixed
  • Status changed from new to closed

Fixed with [8192], thanks !

Add Comment

Modify Ticket

Action
as closed .
The resolution will be deleted. Next status will be 'reopened'.
Author


E-mail address and user name can be saved in the Preferences.

 
Note: See TracTickets for help on using tickets.