diff options
author | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-05-30 02:23:18 +0000 |
---|---|---|
committer | Paul Janzen <pjanzen@cvs.openbsd.org> | 1999-05-30 02:23:18 +0000 |
commit | c37a824a5731bbf062ef51886e87e3518150da78 (patch) | |
tree | 2cec83a38c04242325f3bd21e510c0319fe52d26 /games | |
parent | 43007dc359f95c901be348fc1b2a2d4ea237cb0e (diff) |
use standard isalpha() and isdigit(); check that screen is big enough;
correct a typo, and fix up some man page paths.
Diffstat (limited to 'games')
-rw-r--r-- | games/larn/data.c | 54 | ||||
-rw-r--r-- | games/larn/global.c | 5 | ||||
-rw-r--r-- | games/larn/header.h | 12 | ||||
-rw-r--r-- | games/larn/io.c | 12 | ||||
-rw-r--r-- | games/larn/larn.6 | 8 | ||||
-rw-r--r-- | games/larn/monster.c | 5 | ||||
-rw-r--r-- | games/larn/object.c | 6 | ||||
-rw-r--r-- | games/larn/tok.c | 5 |
8 files changed, 32 insertions, 75 deletions
diff --git a/games/larn/data.c b/games/larn/data.c index 3ab1b5b2025..6808170ee08 100644 --- a/games/larn/data.c +++ b/games/larn/data.c @@ -1,4 +1,4 @@ -/* $OpenBSD: data.c,v 1.6 1999/03/27 03:45:49 pjanzen Exp $ */ +/* $OpenBSD: data.c,v 1.7 1999/05/30 02:23:16 pjanzen Exp $ */ /* $NetBSD: data.c,v 1.9 1997/10/25 01:40:47 thorpej Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static char sccsid[] = "@(#)data.c 5.3 (Berkeley) 5/13/91"; #else -static char rcsid[] = "$OpenBSD: data.c,v 1.6 1999/03/27 03:45:49 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: data.c,v 1.7 1999/05/30 02:23:16 pjanzen Exp $"; #endif #endif /* not lint */ @@ -623,56 +623,6 @@ char *spelmes[] = {"", /* 16 */ "the %s loves the water!" }; -u_char to_lower[] = /* tolower[character] = lower case converted - * character */ -{ - 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017, /* NUL-SI */ - 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027, 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037, /* DLE-US */ - 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047, 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057, /* SP-/ */ - 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077, /* 0-? */ - 0100, 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157, /* @-O */ - 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 0170, 0171, 0172, 0133, 0134, 0135, 0136, 0137, /* P-_ */ - 0140, 0141, 0142, 0143, 0144, 0145, 0146, 0147, 0150, 0151, 0152, 0153, 0154, 0155, 0156, 0157, /* `-o */ - 0160, 0161, 0162, 0163, 0164, 0165, 0166, 0167, 0170, 0171, 0172, 0173, 0174, 0175, 0176, 0177, /* p-DEL */ -}; - -u_char to_upper[] = /* toupper[character] = upper case converted - * character */ -{ - 0000, 0001, 0002, 0003, 0004, 0005, 0006, 0007, 0010, 0011, 0012, 0013, 0014, 0015, 0016, 0017, /* NUL-SI */ - 0020, 0021, 0022, 0023, 0024, 0025, 0026, 0027, 0030, 0031, 0032, 0033, 0034, 0035, 0036, 0037, /* DLE-US */ - 0040, 0041, 0042, 0043, 0044, 0045, 0046, 0047, 0050, 0051, 0052, 0053, 0054, 0055, 0056, 0057, /* SP-/ */ - 0060, 0061, 0062, 0063, 0064, 0065, 0066, 0067, 0070, 0071, 0072, 0073, 0074, 0075, 0076, 0077, /* 0-? */ - 0100, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, /* @-O */ - 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0130, 0131, 0132, 0133, 0134, 0135, 0136, 0137, /* P-_ */ - 0140, 0101, 0102, 0103, 0104, 0105, 0106, 0107, 0110, 0111, 0112, 0113, 0114, 0115, 0116, 0117, /* `-o */ - 0120, 0121, 0122, 0123, 0124, 0125, 0126, 0127, 0130, 0131, 0132, 0173, 0174, 0175, 0176, 0177, /* p-DEL */ -}; - -u_char is_digit[] = /* isdigit[character] = TRUE || FALSE */ -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* NUL-SI */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* DLE-US */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* SP-/ */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, /* 0-? */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* @-O */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* P-_ */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* `-o */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* p-DEL */ -}; - -u_char is_alpha[] = /* isalpha[character] = TRUE || FALSE */ -{ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* NUL-SI */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* DLE-US */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* SP-/ */ - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0-? */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* @-O */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* P-_ */ - 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, /* `-o */ - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, /* p-DEL */ -}; - /* * function to create scroll numbers with appropriate probability of * occurrence diff --git a/games/larn/global.c b/games/larn/global.c index c23bb76e7b4..172afe95aaf 100644 --- a/games/larn/global.c +++ b/games/larn/global.c @@ -1,4 +1,4 @@ -/* $OpenBSD: global.c,v 1.4 1999/03/27 03:45:49 pjanzen Exp $ */ +/* $OpenBSD: global.c,v 1.5 1999/05/30 02:23:16 pjanzen Exp $ */ /* $NetBSD: global.c,v 1.6 1997/10/18 20:03:20 christos Exp $ */ /* @@ -23,9 +23,10 @@ * quit() subroutine to ask if the player really wants to quit */ #ifndef lint -static char rcsid[] = "$OpenBSD: global.c,v 1.4 1999/03/27 03:45:49 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: global.c,v 1.5 1999/05/30 02:23:16 pjanzen Exp $"; #endif /* not lint */ +#include <stdlib.h> #include <string.h> #include <unistd.h> #include "header.h" diff --git a/games/larn/header.h b/games/larn/header.h index f228dfd839f..9b3ba8a8cd4 100644 --- a/games/larn/header.h +++ b/games/larn/header.h @@ -1,4 +1,4 @@ -/* $OpenBSD: header.h,v 1.8 1999/03/27 03:45:49 pjanzen Exp $ */ +/* $OpenBSD: header.h,v 1.9 1999/05/30 02:23:16 pjanzen Exp $ */ /* $NetBSD: header.h,v 1.12 1997/10/25 01:40:48 thorpej Exp $ */ /* header.h Larn is copyrighted 1986 by Noah Morgan. */ @@ -335,7 +335,7 @@ extern u_char *class[], course[]; extern char diagfile[], helpfile[], ckpfile[], larnlevels[], playerids[], optsfile[], psname[], savefilename[1024], scorefile[]; -extern u_char *inbuffer, is_alpha[], is_digit[]; +extern u_char *inbuffer; extern u_char item[MAXX][MAXY], iven[], know[MAXX][MAXY]; extern char *levelname[], logfile[], loginname[], logname[], lastmonst[]; @@ -352,7 +352,7 @@ extern u_char predostuff, restorflag, scprob[]; extern u_char screen[MAXX][MAXY], sex; extern char *speldescript[], *scrollhide[], *scrollname[]; extern u_char spelknow[]; -extern u_char splev[], stealth[MAXX][MAXY], to_lower[], to_upper[], wizard; +extern u_char splev[], stealth[MAXX][MAXY], wizard; extern short diroffx[], diroffy[], hitflag, hit2flag, hit3flag, hitp[MAXX][MAXY]; extern short iarg[MAXX][MAXY], ivenarg[], lasthx, lasthy, lastnum, lastpx, lastpy; @@ -437,10 +437,4 @@ extern unsigned long randx; /* macros for miscellaneous data conversion */ #define min(x,y) (((x)>(y))?(y):(x)) #define max(x,y) (((x)>(y))?(x):(y)) -#define isalpha(x) (is_alpha[x]) -#define isdigit(x) (is_digit[x]) -#define tolower(x) (to_lower[x]) -#define toupper(x) (to_upper[x]) -#define lcc(x) (to_lower[x]) -#define ucc(x) (to_upper[x]) #endif /* NODEFS */ diff --git a/games/larn/io.c b/games/larn/io.c index fd5480a21cc..2fa92111e92 100644 --- a/games/larn/io.c +++ b/games/larn/io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: io.c,v 1.5 1999/03/27 03:45:49 pjanzen Exp $ */ +/* $OpenBSD: io.c,v 1.6 1999/05/30 02:23:16 pjanzen Exp $ */ /* $NetBSD: io.c,v 1.7 1997/10/18 20:03:26 christos Exp $ */ /* @@ -61,11 +61,12 @@ */ #ifndef lint -static char rcsid[] = "$OpenBSD: io.c,v 1.5 1999/03/27 03:45:49 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: io.c,v 1.6 1999/05/30 02:23:16 pjanzen Exp $"; #endif /* not lint */ #include "header.h" #include "extern.h" +#include <ctype.h> #include <string.h> #include <unistd.h> #include <stdlib.h> @@ -783,6 +784,7 @@ init_term() char termbuf[1024]; char *capptr = cap + 10; char *term; + int co, li; switch (tgetent(termbuf, term = getenv("TERM"))) { case -1: @@ -805,6 +807,8 @@ init_term() SO = tgetstr("so", &capptr); /* Begin standout mode */ SE = tgetstr("se", &capptr); /* End standout mode */ CD = tgetstr("cd", &capptr); /* Clear to end of display */ + co = tgetnum("co"); /* columns */ + li = tgetnum("li"); /* lines */ if (!CM) { /* can't find cursor motion entry */ write(2, "Sorry, for a ", 13); @@ -824,6 +828,10 @@ init_term() write(2, ", I can't find the clear entire screen entry in termcap\n", 56); exit(1); } + if (co < 80 || li < 25) { + write(2, "Sorry, screen too small (80x25 min)\n", 36); + exit(1); + } if ((outbuf = malloc(BUFBIG + 16)) == 0) { /* get memory for * decoded output buffer */ write(2, "Error malloc'ing memory for decoded output buffer\n", 50); diff --git a/games/larn/larn.6 b/games/larn/larn.6 index 4476a2b146b..3ce82af2b95 100644 --- a/games/larn/larn.6 +++ b/games/larn/larn.6 @@ -1,4 +1,4 @@ -.\" $OpenBSD: larn.6,v 1.6 1999/03/27 03:45:50 pjanzen Exp $ +.\" $OpenBSD: larn.6,v 1.7 1999/05/30 02:23:16 pjanzen Exp $ .\" $NetBSD: larn.6,v 1.3 1995/03/23 08:33:42 cgd Exp $ .\" .\" Copyright (c) 1990 The Regents of the University of California. @@ -175,11 +175,13 @@ of the spell you are casting. .Sh AUTHOR Noah Morgan .Sh FILES -.Bl -tag -width "/var/games/larn.scores" -compact -.It Pa /var/games/larn.scores +.Bl -tag -width "/var/games/larn/lscore12.0" -compact +.It Pa /var/games/larn/lscore12.0 Score file. .It Pa /var/games/larn/llog12.0 Log file. .It Pa ~/.larnopts Options file. +.It Pa ~/Larn.sav +Default save file. .El diff --git a/games/larn/monster.c b/games/larn/monster.c index fd4d2871d53..65dc04589a5 100644 --- a/games/larn/monster.c +++ b/games/larn/monster.c @@ -1,4 +1,4 @@ -/* $OpenBSD: monster.c,v 1.3 1998/09/15 05:12:32 pjanzen Exp $ */ +/* $OpenBSD: monster.c,v 1.4 1999/05/30 02:23:16 pjanzen Exp $ */ /* $NetBSD: monster.c,v 1.5 1997/10/18 20:03:29 christos Exp $ */ /* @@ -100,9 +100,10 @@ * */ #ifndef lint -static char rcsid[] = "$OpenBSD: monster.c,v 1.3 1998/09/15 05:12:32 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: monster.c,v 1.4 1999/05/30 02:23:16 pjanzen Exp $"; #endif /* not lint */ +#include <ctype.h> #include <string.h> #include <stdlib.h> #include "header.h" diff --git a/games/larn/object.c b/games/larn/object.c index 754cae70ce7..34d7fb5aff7 100644 --- a/games/larn/object.c +++ b/games/larn/object.c @@ -1,11 +1,11 @@ -/* $OpenBSD: object.c,v 1.3 1998/09/15 05:12:32 pjanzen Exp $ */ +/* $OpenBSD: object.c,v 1.4 1999/05/30 02:23:17 pjanzen Exp $ */ /* $NetBSD: object.c,v 1.8 1997/10/18 20:03:38 christos Exp $ */ /* object.c Larn is copyrighted 1986 by Noah Morgan. */ #include <sys/cdefs.h> #ifndef lint -static char rcsid[] = "$OpenBSD: object.c,v 1.3 1998/09/15 05:12:32 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: object.c,v 1.4 1999/05/30 02:23:17 pjanzen Exp $"; #endif /* not lint */ #include "header.h" #include "extern.h" @@ -1306,7 +1306,7 @@ ohome() died(269); } else { lprcat("\nThe doctor is now administering the potion, and in a few moments\n"); - lprcat("Your daughter should be well on her way to recovery.\n"); + lprcat("your daughter should be well on her way to recovery.\n"); nap(6000); lprcat("\nThe potion is"); nap(3000); diff --git a/games/larn/tok.c b/games/larn/tok.c index 432d58d677c..2b2c8d873cb 100644 --- a/games/larn/tok.c +++ b/games/larn/tok.c @@ -1,12 +1,13 @@ -/* $OpenBSD: tok.c,v 1.3 1999/03/27 03:45:50 pjanzen Exp $ */ +/* $OpenBSD: tok.c,v 1.4 1999/05/30 02:23:17 pjanzen Exp $ */ /* $NetBSD: tok.c,v 1.5 1997/10/18 20:03:54 christos Exp $ */ /* tok.c Larn is copyrighted 1986 by Noah Morgan. */ #ifndef lint -static char rcsid[] = "$OpenBSD: tok.c,v 1.3 1999/03/27 03:45:50 pjanzen Exp $"; +static char rcsid[] = "$OpenBSD: tok.c,v 1.4 1999/05/30 02:23:17 pjanzen Exp $"; #endif /* not lint */ #include <sys/types.h> +#include <ctype.h> #include <string.h> #include <sys/ioctl.h> #include <stdlib.h> |