summaryrefslogtreecommitdiffstats
path: root/fortune
diff options
context:
space:
mode:
authordholland <dholland@NetBSD.org>2011-08-17 18:16:51 +0000
committerdholland <dholland@NetBSD.org>2011-08-17 18:16:51 +0000
commit8201c646f17ce8cd7ed8bd80ce677f535d505202 (patch)
tree57616354a2c18aa5ec901f107e23db22196a5264 /fortune
parentad0312c45756a5ad1ce7ebda2a0b1b17b71353e8 (diff)
downloadbsdgames-darwin-8201c646f17ce8cd7ed8bd80ce677f535d505202.tar.gz
bsdgames-darwin-8201c646f17ce8cd7ed8bd80ce677f535d505202.tar.zst
bsdgames-darwin-8201c646f17ce8cd7ed8bd80ce677f535d505202.zip
Move some things around so declarations appear in a reasonable order.
Diffstat (limited to 'fortune')
-rw-r--r--fortune/strfile/strfile.c65
1 files changed, 32 insertions, 33 deletions
diff --git a/fortune/strfile/strfile.c b/fortune/strfile/strfile.c
index a857b4f9..56cf0d07 100644
--- a/fortune/strfile/strfile.c
+++ b/fortune/strfile/strfile.c
@@ -1,4 +1,4 @@
-/* $NetBSD: strfile.c,v 1.31 2011/08/16 19:53:03 dholland Exp $ */
+/* $NetBSD: strfile.c,v 1.32 2011/08/17 18:16:51 dholland Exp $ */
/*-
* Copyright (c) 1989, 1993
@@ -43,7 +43,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\
#if 0
static char sccsid[] = "@(#)strfile.c 8.1 (Berkeley) 5/31/93";
#else
-__RCSID("$NetBSD: strfile.c,v 1.31 2011/08/16 19:53:03 dholland Exp $");
+__RCSID("$NetBSD: strfile.c,v 1.32 2011/08/17 18:16:51 dholland Exp $");
#endif
#endif /* not lint */
#endif /* __NetBSD__ */
@@ -67,29 +67,13 @@ __RCSID("$NetBSD: strfile.c,v 1.31 2011/08/16 19:53:03 dholland Exp $");
#define MAXPATHLEN 1024
#endif /* MAXPATHLEN */
-static uint32_t h2nl(uint32_t h);
-static void getargs(int argc, char **argv);
-static void usage(void) __dead;
-static void add_offset(FILE *fp, off_t off);
-static void do_order(void);
-static int cmp_str(const void *vp1, const void *vp2);
-static void randomize(void);
-static void fwrite_be_offt(off_t off, FILE *f);
-
-static uint32_t
-h2nl(uint32_t h)
-{
- unsigned char c[4];
- uint32_t rv;
-
- c[0] = (h >> 24) & 0xff;
- c[1] = (h >> 16) & 0xff;
- c[2] = (h >> 8) & 0xff;
- c[3] = (h >> 0) & 0xff;
- memcpy(&rv, c, sizeof rv);
-
- return (rv);
-}
+#if defined(__NetBSD__) || defined(__dead)
+#define NORETURN __dead
+#elif defined __GNUC__
+#define NORETURN __attribute__((__noreturn__))
+#else
+#define NORETURN
+#endif
/*
* This program takes a file composed of strings separated by
@@ -153,15 +137,15 @@ static STRFILE Tbl; /* statistics table */
static STR *Firstch; /* first chars of each string */
-#ifdef __GNUC__
-#define NORETURN __dead
-#else
-#define NORETURN
-#endif
-#ifndef __dead /* not NetBSD, presumably */
-#define __dead ;
-#endif
+static uint32_t h2nl(uint32_t h);
+static void getargs(int argc, char **argv);
+static void usage(void) NORETURN;
+static void add_offset(FILE *fp, off_t off);
+static void do_order(void);
+static int cmp_str(const void *vp1, const void *vp2);
+static void randomize(void);
+static void fwrite_be_offt(off_t off, FILE *f);
void add_offset(FILE *, off_t);
int cmp_str(const void *, const void *);
@@ -492,3 +476,18 @@ fwrite_be_offt(off_t off, FILE *f)
}
fwrite(c, sizeof(c), 1, f);
}
+
+static uint32_t
+h2nl(uint32_t h)
+{
+ unsigned char c[4];
+ uint32_t rv;
+
+ c[0] = (h >> 24) & 0xff;
+ c[1] = (h >> 16) & 0xff;
+ c[2] = (h >> 8) & 0xff;
+ c[3] = (h >> 0) & 0xff;
+ memcpy(&rv, c, sizeof rv);
+
+ return (rv);
+}