diff options
Diffstat (limited to 'sail')
| -rw-r--r-- | sail/assorted.c | 8 | ||||
| -rw-r--r-- | sail/dr_1.c | 16 | ||||
| -rw-r--r-- | sail/dr_2.c | 12 | ||||
| -rw-r--r-- | sail/driver.h | 4 | ||||
| -rw-r--r-- | sail/extern.h | 48 | ||||
| -rw-r--r-- | sail/globals.c | 36 | ||||
| -rw-r--r-- | sail/lo_main.c | 6 | ||||
| -rw-r--r-- | sail/pl_3.c | 6 | ||||
| -rw-r--r-- | sail/pl_4.c | 6 | ||||
| -rw-r--r-- | sail/pl_7.c | 24 |
10 files changed, 85 insertions, 81 deletions
diff --git a/sail/assorted.c b/sail/assorted.c index 4a4b143f..5101a207 100644 --- a/sail/assorted.c +++ b/sail/assorted.c @@ -1,4 +1,4 @@ -/* $NetBSD: assorted.c,v 1.7 1999/02/10 00:45:45 hubertf Exp $ */ +/* $NetBSD: assorted.c,v 1.8 1999/09/08 21:17:58 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)assorted.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: assorted.c,v 1.7 1999/02/10 00:45:45 hubertf Exp $"); +__RCSID("$NetBSD: assorted.c,v 1.8 1999/09/08 21:17:58 jsm Exp $"); #endif #endif /* not lint */ @@ -60,8 +60,8 @@ int rig, shot, hittable, roll; int crew[3]; int n; int rigg[4]; - char *message; - struct Tables *tp; + const char *message; + const struct Tables *tp; pc = on->file->pcrew; hull = on->specs->hull; diff --git a/sail/dr_1.c b/sail/dr_1.c index f2a5c8a1..69ca2d30 100644 --- a/sail/dr_1.c +++ b/sail/dr_1.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_1.c,v 1.8 1999/02/10 00:45:45 hubertf Exp $ */ +/* $NetBSD: dr_1.c,v 1.9 1999/09/08 21:17:58 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)dr_1.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dr_1.c,v 1.8 1999/02/10 00:45:45 hubertf Exp $"); +__RCSID("$NetBSD: dr_1.c,v 1.9 1999/09/08 21:17:58 jsm Exp $"); #endif #endif /* not lint */ @@ -421,11 +421,15 @@ next() } } if (best > 0.0) { - char *p = getenv("WOTD"); - if (p == 0) + char *tp = getenv("WOTD"); + const char *p; + if (tp == 0) p = "Driver"; - if (islower(*p)) - *p = toupper(*p); + else { + if (islower(*tp)) + *tp = toupper(*tp); + p = tp; + } (void) strncpy(bestship->file->captain, p, sizeof bestship->file->captain); bestship->file->captain diff --git a/sail/dr_2.c b/sail/dr_2.c index 53730515..439c3218 100644 --- a/sail/dr_2.c +++ b/sail/dr_2.c @@ -1,4 +1,4 @@ -/* $NetBSD: dr_2.c,v 1.9 1999/02/10 00:45:45 hubertf Exp $ */ +/* $NetBSD: dr_2.c,v 1.10 1999/09/08 21:17:58 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)dr_2.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: dr_2.c,v 1.9 1999/02/10 00:45:45 hubertf Exp $"); +__RCSID("$NetBSD: dr_2.c,v 1.10 1999/09/08 21:17:58 jsm Exp $"); #endif #endif /* not lint */ @@ -129,9 +129,9 @@ prizecheck() int strend(str) -char *str; + const char *str; { - char *p; + const char *p; for (p = str; *p; p++) ; @@ -152,7 +152,7 @@ int ma, ta, af; try(command, temp, ma, ta, af, ma, from->file->dir, from, to, &high, 0); } -int dtab[] = {0,1,1,2,3,4,4,5}; /* diagonal distances in x==y */ +const int dtab[] = {0,1,1,2,3,4,4,5}; /* diagonal distances in x==y */ int score(movement, ship, to, onlytemp) @@ -190,7 +190,7 @@ char onlytemp; void move_ship(p, ship, dir, row, col, drift) -char *p; +const char *p; struct ship *ship; unsigned char *dir; short *row, *col; diff --git a/sail/driver.h b/sail/driver.h index 033e1ed0..14385d6c 100644 --- a/sail/driver.h +++ b/sail/driver.h @@ -1,4 +1,4 @@ -/* $NetBSD: driver.h,v 1.5 1998/03/29 04:57:19 mrg Exp $ */ +/* $NetBSD: driver.h,v 1.6 1999/09/08 21:17:58 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -37,4 +37,4 @@ #include "extern.h" -extern int dtab[]; +extern const int dtab[]; diff --git a/sail/extern.h b/sail/extern.h index 73c4dded..80a274f5 100644 --- a/sail/extern.h +++ b/sail/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.9 1999/02/10 00:45:45 hubertf Exp $ */ +/* $NetBSD: extern.h,v 1.10 1999/09/08 21:17:58 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -214,7 +214,7 @@ struct File { }; struct ship { - char *shipname; /* 0 */ + const char *shipname; /* 0 */ struct shipspecs *specs; /* 2 */ unsigned char nationality; /* 4 */ short shiprow; /* 6 */ @@ -228,7 +228,7 @@ struct scenario { char windspeed; /* 2 */ char windchange; /* 4 */ unsigned char vessels; /* 12 */ - char *name; /* 14 */ + const char *name; /* 14 */ struct ship ship[NSHIP]; /* 16 */ }; extern struct scenario scene[]; @@ -266,29 +266,29 @@ struct ship *ls; /* &cc->ship[cc->vessels] */ struct windeffects { char A, B, C, D; }; -struct windeffects WET[7][6]; +const struct windeffects WET[7][6]; struct Tables { char H, G, C, R; }; -struct Tables RigTable[11][6]; -struct Tables HullTable[11][6]; +const struct Tables RigTable[11][6]; +const struct Tables HullTable[11][6]; -char AMMO[9][4]; -char HDT[9][10]; -char HDTrake[9][10]; -char QUAL[9][5]; -char MT[9][3]; +const char AMMO[9][4]; +const char HDT[9][10]; +const char HDTrake[9][10]; +const char QUAL[9][5]; +const char MT[9][3]; -extern char *countryname[]; -extern char *classname[]; -extern char *directionname[]; -extern char *qualname[]; -extern char loadname[]; +extern const char *const countryname[]; +extern const char *const classname[]; +extern const char *const directionname[]; +extern const char *const qualname[]; +extern const char loadname[]; -extern char rangeofshot[]; +extern const char rangeofshot[]; -extern char dr[], dc[]; +extern const char dr[], dc[]; int winddir; int windspeed; @@ -314,10 +314,10 @@ int next __P((void)); void thinkofgrapples __P((void)); void checkup __P((void)); void prizecheck __P((void)); -int strend __P((char *)); +int strend __P((const char *)); void closeon __P((struct ship *, struct ship *, char[], int, int, int)); int score __P((char[], struct ship *, struct ship *, int)); -void move_ship __P((char *, struct ship *, unsigned char *, short *, short *, char *)); +void move_ship __P((const char *, struct ship *, unsigned char *, short *, short *, char *)); void try __P((char[], char [], int, int, int, int, int, struct ship *, struct ship *, int *, int)); void rmend __P((char *)); @@ -383,7 +383,7 @@ void unfoulplayer __P((void)); void changesail __P((void)); void acceptsignal __P((void)); void lookout __P((void)); -char *saywhat __P((struct ship *, int)); +const char *saywhat __P((struct ship *, int)); void eyeball __P((struct ship *)); /* pl_5.c */ @@ -405,10 +405,10 @@ void Signal __P((const char *, struct ship *, ...)) void Msg __P((const char *, ...)) __attribute__((__format__(__printf__,1,2))); void Scroll __P((void)); -void prompt __P((char *, struct ship *)); +void prompt __P((const char *, struct ship *)); void endprompt __P((int)); -int sgetch __P((char *, struct ship *, int)); -void sgetstr __P((char *, char *, int)); +int sgetch __P((const char *, struct ship *, int)); +void sgetstr __P((const char *, char *, int)); void draw_screen __P((void)); void draw_view __P((void)); void draw_turn __P((void)); diff --git a/sail/globals.c b/sail/globals.c index 01c1415c..4e84fdce 100644 --- a/sail/globals.c +++ b/sail/globals.c @@ -1,4 +1,4 @@ -/* $NetBSD: globals.c,v 1.6 1997/10/13 19:44:17 christos Exp $ */ +/* $NetBSD: globals.c,v 1.7 1999/09/08 21:17:58 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)globals.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: globals.c,v 1.6 1997/10/13 19:44:17 christos Exp $"); +__RCSID("$NetBSD: globals.c,v 1.7 1999/09/08 21:17:58 jsm Exp $"); #endif #endif /* not lint */ @@ -406,7 +406,7 @@ struct shipspecs specs[] = { /* class qual crew2 gunL carL rig1 rig3 */ }; -struct windeffects WET[7][6] = { +const struct windeffects WET[7][6] = { { {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9}, {9,9,9,9} }, { {3,2,2,0}, {3,2,1,0}, {3,2,1,0}, {3,2,1,0}, {2,1,0,0}, {2,1,0,0} }, { {1,1,1,0}, {1,1,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,0}, {1,0,0,0} }, @@ -416,7 +416,7 @@ struct windeffects WET[7][6] = { { {2,1,1,0}, {3,2,1,0}, {3,2,1,0}, {3,2,1,0}, {3,3,2,0}, {3,3,2,0} } }; -struct Tables RigTable[11][6] = { +const struct Tables RigTable[11][6] = { { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,1}, {0,0,1,0} }, { {0,0,0,0}, {0,0,0,0}, {0,0,0,1}, {0,0,1,0}, {1,0,0,1}, {0,1,1,1} }, { {0,0,0,0}, {0,0,0,1}, {0,0,1,1}, {0,1,0,1}, {0,1,0,1}, {1,0,1,2} }, @@ -429,7 +429,7 @@ struct Tables RigTable[11][6] = { { {1,1,0,4}, {1,0,1,4}, {2,0,0,5}, {0,2,1,5}, {0,1,2,6}, {0,2,0,7} }, { {1,0,1,5}, {0,2,0,6}, {1,2,0,6}, {1,1,1,6}, {2,0,2,6}, {1,1,2,7} } }; -struct Tables HullTable[11][6] = { +const struct Tables HullTable[11][6] = { { {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {0,0,0,0}, {1,0,0,0}, {0,1,0,0} }, { {0,0,0,0}, {0,0,0,0}, {0,1,0,0}, {1,1,0,0}, {1,0,1,0}, {1,0,1,1} }, { {0,1,0,0}, {1,0,0,0}, {1,1,0,0}, {1,0,1,0}, {1,0,1,1}, {2,1,0,0} }, @@ -443,7 +443,7 @@ struct Tables HullTable[11][6] = { { {2,2,4,0}, {3,3,1,1}, {4,2,1,1}, {5,1,0,2}, {5,1,2,1}, {6,2,2,0} }, }; -char AMMO[9][4] = { +const char AMMO[9][4] = { { -1, 1, 0, 1 }, { -1, 1, 0, 1 }, { -1, 1, 0, 1 }, @@ -455,7 +455,7 @@ char AMMO[9][4] = { { -3, 2, 0, 3 } }; -char HDT[9][10] = { +const char HDT[9][10] = { { 1, 0,-1,-2,-3,-3,-4,-4,-4,-4 }, { 1, 1, 0,-1,-2,-2,-3,-3,-3,-3 }, { 2, 1, 0,-1,-2,-2,-3,-3,-3,-3 }, @@ -467,7 +467,7 @@ char HDT[9][10] = { { 5, 4, 3, 2, 1, 1, 0, 0, 0, 0 } }; -char HDTrake[9][10] = { +const char HDTrake[9][10] = { { 2, 1, 0,-1,-2,-2,-3,-3,-3,-3 }, { 2, 2, 1, 0,-1,-1,-2,-2,-2,-2 }, { 3, 2, 1, 0,-1,-1,-2,-2,-2,-2 }, @@ -479,7 +479,7 @@ char HDTrake[9][10] = { { 9, 8, 7, 6, 5, 5, 4, 4, 4, 4 } }; -char QUAL[9][5] = { +const char QUAL[9][5] = { { -1, 0, 0, 1, 1 }, { -1, 0, 0, 1, 1 }, { -1, 0, 0, 1, 2 }, @@ -491,7 +491,7 @@ char QUAL[9][5] = { { -2,-1, 0, 2, 3 } }; -char MT[9][3] = { +const char MT[9][3] = { { 1, 0, 0 }, { 1, 1, 0 }, { 2, 1, 0 }, @@ -503,7 +503,7 @@ char MT[9][3] = { { 4, 4, 2 } }; -char rangeofshot[] = { +const char rangeofshot[] = { 0, 1, /* grape */ 3, /* chain */ @@ -511,12 +511,12 @@ char rangeofshot[] = { 1 /* double */ }; -char *countryname[] = { +const char *const countryname[] = { "American", "British", "Spanish", "French", "Japanese", "Federation", "Klingon", "Orion" }; -char *classname[] = { +const char *const classname[] = { "Drift wood", "Ship of the Line", "Ship of the Line", @@ -526,7 +526,7 @@ char *classname[] = { "Brig" }; -char *directionname[] = { +const char *const directionname[] = { "dead ahead", "off the starboard bow", "off the starboard beam", @@ -538,9 +538,9 @@ char *directionname[] = { "dead ahead" }; -char *qualname[] = { "dead", "mutinous", "green", "mundane", "crack", "elite" }; +const char *const qualname[] = { "dead", "mutinous", "green", "mundane", "crack", "elite" }; -char loadname[] = { '-', 'G', 'C', 'R', 'D', 'E' }; +const char loadname[] = { '-', 'G', 'C', 'R', 'D', 'E' }; -char dr[] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 }; -char dc[] = { 0, 0, -1, -1, -1, 0, 1, 1, 1 }; +const char dr[] = { 0, 1, 1, 0, -1, -1, -1, 0, 1 }; +const char dc[] = { 0, 0, -1, -1, -1, 0, 1, 1, 1 }; diff --git a/sail/lo_main.c b/sail/lo_main.c index 92c50123..71f3f099 100644 --- a/sail/lo_main.c +++ b/sail/lo_main.c @@ -1,4 +1,4 @@ -/* $NetBSD: lo_main.c,v 1.5 1997/10/13 19:44:24 christos Exp $ */ +/* $NetBSD: lo_main.c,v 1.6 1999/09/08 21:17:59 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)lo_main.c 8.2 (Berkeley) 4/28/95"; #else -__RCSID("$NetBSD: lo_main.c,v 1.5 1997/10/13 19:44:24 christos Exp $"); +__RCSID("$NetBSD: lo_main.c,v 1.6 1999/09/08 21:17:59 jsm Exp $"); #endif #endif /* not lint */ @@ -52,7 +52,7 @@ __RCSID("$NetBSD: lo_main.c,v 1.5 1997/10/13 19:44:24 christos Exp $"); #include "extern.h" #include "pathnames.h" -char *title[] = { +const char *const title[] = { "Admiral", "Commodore", "Captain", "Captain", "Captain", "Captain", "Captain", "Commander", "Commander", "Lieutenant" diff --git a/sail/pl_3.c b/sail/pl_3.c index 4be189be..be5cbb21 100644 --- a/sail/pl_3.c +++ b/sail/pl_3.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_3.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $ */ +/* $NetBSD: pl_3.c,v 1.8 1999/09/08 21:17:59 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pl_3.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_3.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $"); +__RCSID("$NetBSD: pl_3.c,v 1.8 1999/09/08 21:17:59 jsm Exp $"); #endif #endif /* not lint */ @@ -181,7 +181,7 @@ acceptcombat() if (load == L_GRAPE) chits = hit; else { - struct Tables *t; + const struct Tables *t; if (hit > 10) hit = 10; t = &(shootat == RIGGING ? RigTable : HullTable) diff --git a/sail/pl_4.c b/sail/pl_4.c index 163594d7..37c16446 100644 --- a/sail/pl_4.c +++ b/sail/pl_4.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_4.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $ */ +/* $NetBSD: pl_4.c,v 1.8 1999/09/08 21:17:59 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pl_4.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_4.c,v 1.7 1999/02/10 00:45:46 hubertf Exp $"); +__RCSID("$NetBSD: pl_4.c,v 1.8 1999/09/08 21:17:59 jsm Exp $"); #endif #endif /* not lint */ @@ -104,7 +104,7 @@ lookout() } } -char * +const char * saywhat(sp, flag) struct ship *sp; char flag; diff --git a/sail/pl_7.c b/sail/pl_7.c index 3091a521..b281cd81 100644 --- a/sail/pl_7.c +++ b/sail/pl_7.c @@ -1,4 +1,4 @@ -/* $NetBSD: pl_7.c,v 1.10 1999/02/10 00:45:46 hubertf Exp $ */ +/* $NetBSD: pl_7.c,v 1.11 1999/09/08 21:17:59 jsm Exp $ */ /* * Copyright (c) 1983, 1993 @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)pl_7.c 8.1 (Berkeley) 5/31/93"; #else -__RCSID("$NetBSD: pl_7.c,v 1.10 1999/02/10 00:45:46 hubertf Exp $"); +__RCSID("$NetBSD: pl_7.c,v 1.11 1999/09/08 21:17:59 jsm Exp $"); #endif #endif /* not lint */ @@ -57,8 +57,8 @@ __RCSID("$NetBSD: pl_7.c,v 1.10 1999/02/10 00:45:46 hubertf Exp $"); */ static char sc_hasprompt; -static char *sc_prompt; -static char *sc_buf; +static const char *sc_prompt; +static const char *sc_buf; static int sc_line; void @@ -217,8 +217,8 @@ Scroll() void prompt(p, ship) -char *p; -struct ship *ship; + const char *p; + struct ship *ship; { static char buf[BUFSIZ]; @@ -240,9 +240,9 @@ char flag; int sgetch(p, ship, flag) -char *p; -struct ship *ship; -char flag; + const char *p; + struct ship *ship; + char flag; { int c; prompt(p, ship); @@ -259,9 +259,9 @@ char flag; void sgetstr(pr, buf, n) -char *pr; -char *buf; -int n; + const char *pr; + char *buf; + int n; { int c; char *p = buf; |
