From c8a08e056ff2a0f7268ba7df647b69afcc26d11e Mon Sep 17 00:00:00 2001 From: jwise <jwise@NetBSD.org> Date: Thu, 4 Jan 2001 03:51:23 +0000 Subject: [PATCH] More rationalization of include files: a.) Don't include a zillion system headers from "extern.h" (actually, don't include any). b.) Break a global jmp_buf variable into a new file, so <setjmp.h> doesn't have to be pulled in everywhere (it's only used in two places). The (one line) new file is (c) TNF with a three-clause license, FW(L)IW. --- sail/dr_1.c | 6 ++++-- sail/dr_2.c | 6 ++++-- sail/dr_3.c | 5 +++-- sail/dr_5.c | 5 +++-- sail/dr_main.c | 5 +++-- sail/extern.h | 9 +-------- sail/game.c | 5 +++-- sail/globals.c | 6 ++++-- sail/main.c | 7 +++++-- sail/misc.c | 5 +++-- sail/parties.c | 5 +++-- sail/pl_1.c | 5 +++-- sail/pl_2.c | 5 +++-- sail/pl_3.c | 5 +++-- sail/pl_4.c | 5 +++-- sail/pl_5.c | 6 ++++-- sail/pl_6.c | 5 +++-- sail/pl_7.c | 5 +++-- sail/pl_main.c | 8 ++++++-- sail/restart.h | 32 ++++++++++++++++++++++++++++++++ sail/sync.c | 6 ++++-- 21 files changed, 100 insertions(+), 46 deletions(-) create mode 100644 sail/restart.h diff --git a/sail/dr_1.c b/sail/dr_1.c index 6106190d..7fa015ee 100644 --- a/sail/dr_1.c +++ b/sail/dr_1.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_1.c,v 1.14 2001/01/04 03:21:16 jwise Exp $ */ +/* $NetBSD: dr_1.c,v 1.15 2001/01/04 03:51:23 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,12 +38,14 @@ #if 0 static char sccsid[] = "@(#)dr_1.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dr_1.c,v 1.14 2001/01/04 03:21:16 jwise Exp $"); +__RCSID("$NetBSD: dr_1.c,v 1.15 2001/01/04 03:51:23 jwise Exp $"); #endif #endif /* not lint */ +#include <ctype.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include "extern.h" #include "driver.h" diff --git a/sail/dr_2.c b/sail/dr_2.c index f2787532..10930c7a 100644 --- a/sail/dr_2.c +++ b/sail/dr_2.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_2.c,v 1.15 2001/01/04 03:21:17 jwise Exp $ */ +/* $NetBSD: dr_2.c,v 1.16 2001/01/04 03:51:23 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,11 +38,13 @@ #if 0 static char sccsid[] = "@(#)dr_2.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dr_2.c,v 1.15 2001/01/04 03:21:17 jwise Exp $"); +__RCSID("$NetBSD: dr_2.c,v 1.16 2001/01/04 03:51:23 jwise Exp $"); #endif #endif /* not lint */ +#include <stdio.h> #include <stdlib.h> +#include <string.h> #include "extern.h" #include "driver.h" diff --git a/sail/dr_3.c b/sail/dr_3.c index 27bf0472..3efe79f1 100644 --- a/sail/dr_3.c +++ b/sail/dr_3.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_3.c,v 1.11 2001/01/04 03:21:17 jwise Exp $ */ +/* $NetBSD: dr_3.c,v 1.12 2001/01/04 03:51:23 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,11 +38,12 @@ #if 0 static char sccsid[] = "@(#)dr_3.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dr_3.c,v 1.11 2001/01/04 03:21:17 jwise Exp $"); +__RCSID("$NetBSD: dr_3.c,v 1.12 2001/01/04 03:51:23 jwise Exp $"); #endif #endif /* not lint */ #include <stdlib.h> +#include <string.h> #include "extern.h" #include "driver.h" diff --git a/sail/dr_5.c b/sail/dr_5.c index 857f00dc..80a2b4db 100644 --- a/sail/dr_5.c +++ b/sail/dr_5.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_5.c,v 1.8 2001/01/04 01:53:24 jwise Exp $ */ +/* $NetBSD: dr_5.c,v 1.9 2001/01/04 03:51:23 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,10 +38,11 @@ #if 0 static char sccsid[] = "@(#)dr_5.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: dr_5.c,v 1.8 2001/01/04 01:53:24 jwise Exp $"); +__RCSID("$NetBSD: dr_5.c,v 1.9 2001/01/04 03:51:23 jwise Exp $"); #endif #endif /* not lint */ +#include <sys/types.h> #include "extern.h" void subtract(struct ship *, int, int *, struct ship *, int); diff --git a/sail/dr_main.c b/sail/dr_main.c index 99144e05..2366a8b3 100644 --- a/sail/dr_main.c +++ b/sail/dr_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_main.c,v 1.9 2001/01/04 03:21:17 jwise Exp $ */ +/* $NetBSD: dr_main.c,v 1.10 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,10 +38,11 @@ #if 0 static char sccsid[] = "@(#)dr_main.c 8.2 (Berkeley) 4/16/94"; #else -__RCSID("$NetBSD: dr_main.c,v 1.9 2001/01/04 03:21:17 jwise Exp $"); +__RCSID("$NetBSD: dr_main.c,v 1.10 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ +#include <signal.h> #include <stdio.h> #include <stdlib.h> #include <unistd.h> diff --git a/sail/extern.h b/sail/extern.h index 987e2a1f..a7b68357 100644 --- a/sail/extern.h +++ b/sail/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.21 2001/01/04 02:43:32 jwise Exp $ */ +/* $NetBSD: extern.h,v 1.22 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -35,17 +35,10 @@ * @(#)externs.h 8.1 (Berkeley) 5/31/93 */ -#include <stdio.h> -#include <signal.h> -#include <string.h> -#include <ctype.h> -#include <setjmp.h> -#include <sys/types.h> #include "machdep.h" /* program mode */ extern int mode; -extern jmp_buf restart; #define MODE_PLAYER 1 #define MODE_DRIVER 2 #define MODE_LOGGER 3 diff --git a/sail/game.c b/sail/game.c index 5819a6e8..0f74cd19 100644 --- a/sail/game.c +++ b/sail/game.c @@ -1,4 +1,4 @@ -/* $NetBSD: game.c,v 1.8 2001/01/04 01:53:24 jwise Exp $ */ +/* $NetBSD: game.c,v 1.9 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,10 +38,11 @@ #if 0 static char sccsid[] = "@(#)game.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: game.c,v 1.8 2001/01/04 01:53:24 jwise Exp $"); +__RCSID("$NetBSD: game.c,v 1.9 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ +#include <sys/types.h> #include "extern.h" int maxturns(struct ship *, char *); diff --git a/sail/globals.c b/sail/globals.c index 26ee3026..1c1f41be 100644 --- a/sail/globals.c +++ b/sail/globals.c @@ -1,4 +1,4 @@ -/* $NetBSD: globals.c,v 1.10 2001/01/04 01:56:28 jwise Exp $ */ +/* $NetBSD: globals.c,v 1.11 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,10 +38,12 @@ #if 0 static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: globals.c,v 1.10 2001/01/04 01:56:28 jwise Exp $"); +__RCSID("$NetBSD: globals.c,v 1.11 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ +#include <sys/types.h> +#include <setjmp.h> #include "extern.h" struct scenario scene[] = { diff --git a/sail/main.c b/sail/main.c index fff86df2..e824acd7 100644 --- a/sail/main.c +++ b/sail/main.c @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.18 2001/01/04 03:21:17 jwise Exp $ */ +/* $NetBSD: main.c,v 1.19 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -43,15 +43,18 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 1993\n\ #if 0 static char sccsid[] = "@(#)main.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: main.c,v 1.18 2001/01/04 03:21:17 jwise Exp $"); +__RCSID("$NetBSD: main.c,v 1.19 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ #include <fcntl.h> +#include <setjmp.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include "extern.h" +#include "restart.h" int main(int argc, char **argv) diff --git a/sail/misc.c b/sail/misc.c index 1e475d53..2336c9c0 100644 --- a/sail/misc.c +++ b/sail/misc.c @@ -1,4 +1,4 @@ -/* $NetBSD: misc.c,v 1.9 2001/01/04 03:21:17 jwise Exp $ */ +/* $NetBSD: misc.c,v 1.10 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,10 +38,11 @@ #if 0 static char sccsid[] = "@(#)misc.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: misc.c,v 1.9 2001/01/04 03:21:17 jwise Exp $"); +__RCSID("$NetBSD: misc.c,v 1.10 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ +#include <ctype.h> #include <stdio.h> #include <unistd.h> #include "extern.h" diff --git a/sail/parties.c b/sail/parties.c index 28b266c9..c41d37af 100644 --- a/sail/parties.c +++ b/sail/parties.c @@ -1,4 +1,4 @@ -/* $NetBSD: parties.c,v 1.8 2001/01/04 02:43:32 jwise Exp $ */ +/* $NetBSD: parties.c,v 1.9 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,10 +38,11 @@ #if 0 static char sccsid[] = "@(#)parties.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: parties.c,v 1.8 2001/01/04 02:43:32 jwise Exp $"); +__RCSID("$NetBSD: parties.c,v 1.9 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ +#include <sys/types.h> #include "extern.h" int meleeing(struct ship *, struct ship *); diff --git a/sail/pl_1.c b/sail/pl_1.c index d003a56a..1ce113ec 100644 --- a/sail/pl_1.c +++ b/sail/pl_1.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_1.c,v 1.11 2001/01/04 03:21:17 jwise Exp $ */ +/* $NetBSD: pl_1.c,v 1.12 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,12 +38,13 @@ #if 0 static char sccsid[] = "@(#)pl_1.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_1.c,v 1.11 2001/01/04 03:21:17 jwise Exp $"); +__RCSID("$NetBSD: pl_1.c,v 1.12 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ #include <sys/types.h> #include <sys/wait.h> +#include <signal.h> #include <stdio.h> #include <unistd.h> #include "player.h" diff --git a/sail/pl_2.c b/sail/pl_2.c index efd66ddd..009cb3d0 100644 --- a/sail/pl_2.c +++ b/sail/pl_2.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_2.c,v 1.6 2001/01/04 02:43:32 jwise Exp $ */ +/* $NetBSD: pl_2.c,v 1.7 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,10 +38,11 @@ #if 0 static char sccsid[] = "@(#)pl_2.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_2.c,v 1.6 2001/01/04 02:43:32 jwise Exp $"); +__RCSID("$NetBSD: pl_2.c,v 1.7 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ +#include <signal.h> #include "player.h" void play(void); diff --git a/sail/pl_3.c b/sail/pl_3.c index 2cf7c055..20ab7146 100644 --- a/sail/pl_3.c +++ b/sail/pl_3.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_3.c,v 1.12 2001/01/04 03:21:17 jwise Exp $ */ +/* $NetBSD: pl_3.c,v 1.13 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,10 +38,11 @@ #if 0 static char sccsid[] = "@(#)pl_3.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_3.c,v 1.12 2001/01/04 03:21:17 jwise Exp $"); +__RCSID("$NetBSD: pl_3.c,v 1.13 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ +#include <signal.h> #include <stdlib.h> #include "player.h" diff --git a/sail/pl_4.c b/sail/pl_4.c index 56c6dba8..73f78a30 100644 --- a/sail/pl_4.c +++ b/sail/pl_4.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_4.c,v 1.10 2001/01/04 02:43:32 jwise Exp $ */ +/* $NetBSD: pl_4.c,v 1.11 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,10 +38,11 @@ #if 0 static char sccsid[] = "@(#)pl_4.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_4.c,v 1.10 2001/01/04 02:43:32 jwise Exp $"); +__RCSID("$NetBSD: pl_4.c,v 1.11 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ +#include <ctype.h> #include "player.h" void changesail(void); diff --git a/sail/pl_5.c b/sail/pl_5.c index 369fae93..f2762186 100644 --- a/sail/pl_5.c +++ b/sail/pl_5.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_5.c,v 1.10 2001/01/04 03:21:17 jwise Exp $ */ +/* $NetBSD: pl_5.c,v 1.11 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,10 +38,12 @@ #if 0 static char sccsid[] = "@(#)pl_5.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_5.c,v 1.10 2001/01/04 03:21:17 jwise Exp $"); +__RCSID("$NetBSD: pl_5.c,v 1.11 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ +#include <ctype.h> +#include <signal.h> #include <stdio.h> #include "player.h" diff --git a/sail/pl_6.c b/sail/pl_6.c index 0f071f68..e13378e5 100644 --- a/sail/pl_6.c +++ b/sail/pl_6.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_6.c,v 1.7 2001/01/04 02:43:32 jwise Exp $ */ +/* $NetBSD: pl_6.c,v 1.8 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,10 +38,11 @@ #if 0 static char sccsid[] = "@(#)pl_6.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_6.c,v 1.7 2001/01/04 02:43:32 jwise Exp $"); +__RCSID("$NetBSD: pl_6.c,v 1.8 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ +#include <signal.h> #include "player.h" void repair(void); diff --git a/sail/pl_7.c b/sail/pl_7.c index 643045d9..620403e4 100644 --- a/sail/pl_7.c +++ b/sail/pl_7.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_7.c,v 1.18 2001/01/04 03:21:17 jwise Exp $ */ +/* $NetBSD: pl_7.c,v 1.19 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,10 +38,11 @@ #if 0 static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_7.c,v 1.18 2001/01/04 03:21:17 jwise Exp $"); +__RCSID("$NetBSD: pl_7.c,v 1.19 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ +#include <signal.h> #include <stdarg.h> #include <stdio.h> #include <unistd.h> diff --git a/sail/pl_main.c b/sail/pl_main.c index 50cd14ed..545748c1 100644 --- a/sail/pl_main.c +++ b/sail/pl_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_main.c,v 1.12 2001/01/04 03:21:17 jwise Exp $ */ +/* $NetBSD: pl_main.c,v 1.13 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,14 +38,18 @@ #if 0 static char sccsid[] = "@(#)pl_main.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_main.c,v 1.12 2001/01/04 03:21:17 jwise Exp $"); +__RCSID("$NetBSD: pl_main.c,v 1.13 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ +#include <setjmp.h> +#include <signal.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <unistd.h> #include "player.h" +#include "restart.h" int pl_main(void); static void initialize(void); diff --git a/sail/restart.h b/sail/restart.h new file mode 100644 index 00000000..768b7916 --- /dev/null +++ b/sail/restart.h @@ -0,0 +1,32 @@ +/* $NetBSD: restart.h,v 1.1 2001/01/04 03:51:24 jwise Exp $ */ + +/*- + * Copyright (c) 2001 The NetBSD Foundation, Inc. + * All rights reserved. + * + * 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. Neither the name of The NetBSD Foundation 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 NETBSD FOUNDATION, INC. 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 FOUNDATION 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. + */ + +extern jmp_buf restart; diff --git a/sail/sync.c b/sail/sync.c index 144f25e7..d793aac5 100644 --- a/sail/sync.c +++ b/sail/sync.c @@ -1,4 +1,4 @@ -/* $NetBSD: sync.c,v 1.17 2001/01/04 03:21:17 jwise Exp $ */ +/* $NetBSD: sync.c,v 1.18 2001/01/04 03:51:24 jwise Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,15 +38,17 @@ #if 0 static char sccsid[] = "@(#)sync.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: sync.c,v 1.17 2001/01/04 03:21:17 jwise Exp $"); +__RCSID("$NetBSD: sync.c,v 1.18 2001/01/04 03:51:24 jwise Exp $"); #endif #endif /* not lint */ #include <fcntl.h> #include <errno.h> +#include <signal.h> #include <stdarg.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <time.h> #include <unistd.h> #include "extern.h" -- 2.47.1