summaryrefslogtreecommitdiffstats
path: root/fortune/unstr/unstr.c
diff options
context:
space:
mode:
authorsimonb <simonb@NetBSD.org>1999-08-21 07:02:46 +0000
committersimonb <simonb@NetBSD.org>1999-08-21 07:02:46 +0000
commit9f5f92a0f3b2deed923c1d9c5613fe2dc55e605f (patch)
treed48210e3e87ce7617ea961b9d8cc43db484bccfe /fortune/unstr/unstr.c
parente6838d71c5f48786e0e7ce3a0ff47d9b1f71abcf (diff)
downloadbsdgames-darwin-9f5f92a0f3b2deed923c1d9c5613fe2dc55e605f.tar.gz
bsdgames-darwin-9f5f92a0f3b2deed923c1d9c5613fe2dc55e605f.tar.zst
bsdgames-darwin-9f5f92a0f3b2deed923c1d9c5613fe2dc55e605f.zip
Use new endian-specific conversion macros - 64-bit off_t's are now
the stored the same regardess of the byte order of the generating host. Note in the strfile(8) man page that all fields are big-endian, not in network byte order.
Diffstat (limited to 'fortune/unstr/unstr.c')
-rw-r--r--fortune/unstr/unstr.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/fortune/unstr/unstr.c b/fortune/unstr/unstr.c
index 19df3464..8d52fc35 100644
--- a/fortune/unstr/unstr.c
+++ b/fortune/unstr/unstr.c
@@ -1,4 +1,4 @@
-/* $NetBSD: unstr.c,v 1.4 1997/10/11 07:59:09 lukem Exp $ */
+/* $NetBSD: unstr.c,v 1.5 1999/08/21 07:02:46 simonb Exp $ */
/*-
* Copyright (c) 1991, 1993
@@ -46,7 +46,7 @@ __COPYRIGHT("@(#) Copyright (c) 1991, 1993\n\
#if 0
static char sccsid[] = "@(#)unstr.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: unstr.c,v 1.4 1997/10/11 07:59:09 lukem Exp $");
+__RCSID("$NetBSD: unstr.c,v 1.5 1999/08/21 07:02:46 simonb Exp $");
#endif
#endif /* not lint */
@@ -100,11 +100,11 @@ main(ac, av)
if ((Dataf = fopen(Datafile, "r")) == NULL)
err(1, "fopen %s", Datafile);
(void) fread((char *) &tbl, sizeof tbl, 1, Dataf);
- tbl.str_version = ntohl(tbl.str_version);
- tbl.str_numstr = ntohl(tbl.str_numstr);
- tbl.str_longlen = ntohl(tbl.str_longlen);
- tbl.str_shortlen = ntohl(tbl.str_shortlen);
- tbl.str_flags = ntohl(tbl.str_flags);
+ BE32TOH(tbl.str_version);
+ BE32TOH(tbl.str_numstr);
+ BE32TOH(tbl.str_longlen);
+ BE32TOH(tbl.str_shortlen);
+ BE32TOH(tbl.str_flags);
if (!(tbl.str_flags & (STR_ORDERED | STR_RANDOM))) {
fprintf(stderr, "nothing to do -- table in file order\n");
exit(1);
@@ -140,7 +140,7 @@ order_unstr(tbl)
for (i = 0; i < tbl->str_numstr; i++) {
(void) fread((char *) &pos, 1, sizeof pos, Dataf);
- (void) fseek(Inf, ntohl(pos), 0);
+ (void) fseek(Inf, be64toh(pos), 0);
if (i != 0)
(void) printf("%c\n", Delimch);
for (;;) {