From: Shlomi Fish Date: Sat, 2 Feb 2019 16:52:38 +0000 (+0200) Subject: consolidate includes. X-Git-Tag: fortune-mod-2.8.0~19 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=a1172d35ce32139524c3c4f70e50d24ae6c75220;p=fortune-mod consolidate includes. --- diff --git a/fortune-mod/fortune/fortune.c b/fortune-mod/fortune/fortune.c index 9fbfc03..f417b3a 100644 --- a/fortune-mod/fortune/fortune.c +++ b/fortune-mod/fortune/fortune.c @@ -98,23 +98,10 @@ static char rcsid[] = "$NetBSD: fortune.c,v 1.8 1995/03/23 08:28:40 cgd Exp $"; #define PROGRAM_NAME "fortune-mod" -#include - -#include -#include -#include -#include -#include - -#include +#include "fortune-mod-common.h" #include #include #include -#include -#include -#include -#include -#include #include #include #include @@ -132,7 +119,6 @@ static char rcsid[] = "$NetBSD: fortune.c,v 1.8 1995/03/23 08:28:40 cgd Exp $"; #endif #include "config.h" -#include "strfile.h" #define TRUE 1 #define FALSE 0 diff --git a/fortune-mod/util/fortune-mod-common.h b/fortune-mod/util/fortune-mod-common.h new file mode 100644 index 0000000..baab677 --- /dev/null +++ b/fortune-mod/util/fortune-mod-common.h @@ -0,0 +1,59 @@ +/*- + * Copyright (c) 1991, 1993 + * The Regents of the University of California. All rights reserved. + * + * This code is derived from software contributed to Berkeley by + * Ken Arnold. + * + * 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. + * + * @(#)strfile.h 8.1 (Berkeley) 5/31/93 + */ +#pragma once +#include +#include +/* For ntohl() */ +#ifdef _WIN32 +#include +#define getpid() 0 +#else +#include +#include +#endif +#include +#include "strfile.h" +#include +#include +#include +#include +#include +#include +#ifndef MAXPATHLEN +#define MAXPATHLEN 1024 +#endif /* MAXPATHLEN */ diff --git a/fortune-mod/util/randstr.c b/fortune-mod/util/randstr.c index 061d8fb..e6b9f68 100644 --- a/fortune-mod/util/randstr.c +++ b/fortune-mod/util/randstr.c @@ -86,23 +86,7 @@ * Who're you gonna quote? Dan Quayle? */ -/* For ntohl() */ -#ifdef _WIN32 -#include -#define getpid() 0 -#else -#include -#include -#endif -#include "strfile.h" -#include -#include -#include -#include -#include -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif /* MAXPATHLEN */ +#include "fortune-mod-common.h" char *Infile, /* name of input file */ Datafile[MAXPATHLEN], /* name of data file */ diff --git a/fortune-mod/util/strfile.c b/fortune-mod/util/strfile.c index bab41e2..005dde3 100644 --- a/fortune-mod/util/strfile.c +++ b/fortune-mod/util/strfile.c @@ -72,20 +72,7 @@ *I haven't the faintest flipping idea what all that is, so kill the warnings */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "strfile.h" - -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif /* MAXPATHLEN */ +#include "fortune-mod-common.h" /* * This program takes a file composed of strings separated by diff --git a/fortune-mod/util/unstr.c b/fortune-mod/util/unstr.c index d8dddbb..b66cf15 100644 --- a/fortune-mod/util/unstr.c +++ b/fortune-mod/util/unstr.c @@ -88,19 +88,8 @@ static char sccsid[] = "@(#)unstr.c 8.1 (Berkeley) 5/31/93"; * get a fortune that contains nothing but a newline. Karo syrup, syrup. * For the gory details, and lots of cussing, see strfile.c */ -#include -#include -#include -#include "strfile.h" -#include -#include -#include -#include -#include - -#ifndef MAXPATHLEN -#define MAXPATHLEN 1024 -#endif /* MAXPATHLEN */ + +#include "fortune-mod-common.h" static char *Infile, /* name of input file */ Datafile[MAXPATHLEN], /* name of data file */