From 350aac765d3e94494f9b3db3a16f3b09d454bd5b Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 3 Feb 2008 21:24:58 +0000 Subject: Once upon a time, larn 12.0 had functions named getchar() and putchar() that conflicted with libc. We changed them to lgetchar() and xputchar() respectively; larn 12.2 changed them to ttgetch() and ttputch(). After reflecting on this for a while I've decided to adopt the larn 12.2 names; not so much for compatibility but for consistency going forward. So, massrename them. Also make ttputch() static. --- larn/extern.h | 5 ++--- larn/global.c | 10 +++++----- larn/help.c | 8 ++++---- larn/io.c | 53 +++++++++++++++++++++++++++-------------------------- larn/main.c | 10 +++++----- larn/monster.c | 14 +++++++------- larn/moreobj.c | 16 ++++++++-------- larn/object.c | 42 +++++++++++++++++++++--------------------- larn/store.c | 20 ++++++++++---------- 9 files changed, 89 insertions(+), 89 deletions(-) (limited to 'larn') diff --git a/larn/extern.h b/larn/extern.h index 9b342a45..dba6a213 100644 --- a/larn/extern.h +++ b/larn/extern.h @@ -1,4 +1,4 @@ -/* $NetBSD: extern.h,v 1.9 2008/02/03 20:11:04 dholland Exp $ */ +/* $NetBSD: extern.h,v 1.10 2008/02/03 21:24:58 dholland Exp $ */ /* * Copyright (c) 1997 Christos Zoulas. All rights reserved. @@ -109,7 +109,7 @@ void retcont(void); /* io.c */ void setupvt100(void); void clearvt100(void); -int lgetchar(void); +int ttgetch(void); void scbr(void); void sncbr(void); void newgame(void); @@ -136,7 +136,6 @@ void cl_dn(int, int); void standout(const char *); void set_score_output(void); void lflush(void); -int xputchar(int); char *tmcapcnv(char *, char *); void beep(void); diff --git a/larn/global.c b/larn/global.c index 82e1ef44..678ae639 100644 --- a/larn/global.c +++ b/larn/global.c @@ -1,4 +1,4 @@ -/* $NetBSD: global.c,v 1.10 2008/02/03 20:11:05 dholland Exp $ */ +/* $NetBSD: global.c,v 1.11 2008/02/03 21:24:58 dholland Exp $ */ /* * global.c Larn is copyrighted 1986 by Noah Morgan. @@ -23,7 +23,7 @@ */ #include #ifndef lint -__RCSID("$NetBSD: global.c,v 1.10 2008/02/03 20:11:05 dholland Exp $"); +__RCSID("$NetBSD: global.c,v 1.11 2008/02/03 21:24:58 dholland Exp $"); #endif /* not lint */ #include @@ -432,7 +432,7 @@ quit() strcpy(lastmonst, ""); lprcat("\n\nDo you really want to quit?"); while (1) { - i = lgetchar(); + i = ttgetch(); if (i == 'y') { died(300); return; @@ -463,7 +463,7 @@ more() lprcat("\n --- press "); standout("space"); lprcat(" to continue --- "); - while (lgetchar() != ' '); + while (ttgetch() != ' '); } /* @@ -830,7 +830,7 @@ getyn() int i; i = 0; while (i != 'y' && i != 'n' && i != '\33') - i = lgetchar(); + i = ttgetch(); return (i); } diff --git a/larn/help.c b/larn/help.c index 47350d10..05e7656b 100644 --- a/larn/help.c +++ b/larn/help.c @@ -1,9 +1,9 @@ -/* $NetBSD: help.c,v 1.6 2008/02/03 19:20:41 dholland Exp $ */ +/* $NetBSD: help.c,v 1.7 2008/02/03 21:24:58 dholland Exp $ */ /* help.c Larn is copyrighted 1986 by Noah Morgan. */ #include #ifndef lint -__RCSID("$NetBSD: help.c,v 1.6 2008/02/03 19:20:41 dholland Exp $"); +__RCSID("$NetBSD: help.c,v 1.7 2008/02/03 21:24:58 dholland Exp $"); #endif /* not lint */ #include @@ -54,7 +54,7 @@ help() lprcat(" for more help ---- "); i = 0; while ((i != ' ') && (i != '\n') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if ((i == '\n') || (i == '\33')) { lrclose(); setscroll(); @@ -105,7 +105,7 @@ retcont() lprcat("Press "); standout("return"); lprcat(" to continue: "); - while (lgetchar() != '\n'); + while (ttgetch() != '\n'); setscroll(); } diff --git a/larn/io.c b/larn/io.c index 36e950cd..0186d0a8 100644 --- a/larn/io.c +++ b/larn/io.c @@ -1,4 +1,4 @@ -/* $NetBSD: io.c,v 1.22 2008/02/03 20:11:05 dholland Exp $ */ +/* $NetBSD: io.c,v 1.23 2008/02/03 21:24:58 dholland Exp $ */ /* * io.c Larn is copyrighted 1986 by Noah Morgan. @@ -7,7 +7,7 @@ * * setupvt100() Subroutine to set up terminal in correct mode for game * clearvt100() Subroutine to clean up terminal when the game is over - * lgetchar() Routine to read in one character from the terminal + * ttgetch() Routine to read in one character from the terminal * scbr() Function to set cbreak -echo for the terminal * sncbr() Function to set -cbreak echo for the terminal * newgame() Subroutine to save the initial time and seed rnd() @@ -51,7 +51,7 @@ * from [x,1] to current line. cl_dn(x,y) * lear screen from [1,y] to end of display. standout(str) * rint the string in standout mode. set_score_output() - * alled when output should be literally printed. * xputchar(ch) + * alled when output should be literally printed. * ttputch(ch) * rint one character in decoded output buffer. * flush_buf() * lush buffer with decoded output. * init_term() * erminal initialization -- setup termcap info * char *tmcapcnv(sd,ss) @@ -62,7 +62,7 @@ */ #include #ifndef lint -__RCSID("$NetBSD: io.c,v 1.22 2008/02/03 20:11:05 dholland Exp $"); +__RCSID("$NetBSD: io.c,v 1.23 2008/02/03 21:24:58 dholland Exp $"); #endif /* not lint */ #include "header.h" @@ -127,6 +127,7 @@ typedef char *va_list; #define va_arg(plist,mode) ((mode *)(plist += sizeof(mode)))[-1] #endif /* NOVARARGS */ +static int ttputch(int ch); static void flush_buf(void); #define LINBUFSIZE 128 /* size of the lgetw() and lgetl() buffer */ @@ -164,10 +165,10 @@ clearvt100() } /* - * lgetchar() Routine to read in one character from the terminal + * ttgetch() Routine to read in one character from the terminal */ int -lgetchar() +ttgetch() { char byt; #ifdef EXTRA @@ -834,29 +835,29 @@ lflush() } for (str = lpbuf; str < lpnt; str++) { if (*str >= 32) { - xputchar(*str); + ttputch(*str); curx++; } else switch (*str) { case CLEAR: - tputs(CL, 0, xputchar); + tputs(CL, 0, ttputch); curx = cury = 0; break; case CL_LINE: - tputs(CE, 0, xputchar); + tputs(CE, 0, ttputch); break; case CL_DOWN: - tputs(CD, 0, xputchar); + tputs(CD, 0, ttputch); break; case ST_START: - tputs(SO, 0, xputchar); + tputs(SO, 0, ttputch); break; case ST_END: - tputs(SE, 0, xputchar); + tputs(SE, 0, ttputch); break; case CURSOR: @@ -864,7 +865,7 @@ lflush() cury = *++str - 1; if (t_goto(info, CM, curx, cury, tgoto_buf, 255) == 0) - tputs(tgoto_buf, 0, xputchar); + tputs(tgoto_buf, 0, ttputch); break; case '\n': @@ -881,8 +882,8 @@ lflush() 255) == 0) tputs(tgoto_buf, 0, - xputchar); - tputs(CE, 0, xputchar); + ttputch); + tputs(CE, 0, ttputch); if (--scrline < 19) scrline = 23; @@ -892,8 +893,8 @@ lflush() 255) == 0) tputs(tgoto_buf, 0, - xputchar); - tputs(CE, 0, xputchar); + ttputch); + tputs(CE, 0, ttputch); } else { if (t_goto(info, CM, 0, 19, @@ -901,29 +902,29 @@ lflush() 255) == 0) tputs(tgoto_buf, 0, - xputchar); - tputs(DL, 0, xputchar); + ttputch); + tputs(DL, 0, ttputch); if (t_goto(info, CM, 0, 23, tgoto_buf, 255) == 0) tputs(tgoto_buf, 0, - xputchar); + ttputch); /* * tputs (AL, 0, - * xputchar); + * ttputch); */ } } else { - xputchar('\n'); + ttputch('\n'); cury++; } curx = 0; break; default: - xputchar(*str); + ttputch(*str); curx++; }; } @@ -955,10 +956,10 @@ lflush() #ifndef VT100 static int vindex = 0; /* - * xputchar(ch) Print one character in decoded output buffer. + * ttputch(ch) Print one character in decoded output buffer. */ -int -xputchar(int ch) +static int +ttputch(int ch) { outbuf[vindex++] = ch; if (vindex >= BUFBIG) diff --git a/larn/main.c b/larn/main.c index 14f1caef..241c9199 100644 --- a/larn/main.c +++ b/larn/main.c @@ -1,9 +1,9 @@ -/* $NetBSD: main.c,v 1.22 2008/02/03 19:20:42 dholland Exp $ */ +/* $NetBSD: main.c,v 1.23 2008/02/03 21:24:58 dholland Exp $ */ /* main.c */ #include #ifndef lint -__RCSID("$NetBSD: main.c,v 1.22 2008/02/03 19:20:42 dholland Exp $"); +__RCSID("$NetBSD: main.c,v 1.23 2008/02/03 21:24:58 dholland Exp $"); #endif /* not lint */ #include @@ -1277,7 +1277,7 @@ whatitem(const char *str) lprintf("\nWhat do you want to %s [* for all] ? ", str); i = 0; while (i > 'z' || (i < 'a' && i != '*' && i != '\33' && i != '.')) - i = lgetchar(); + i = ttgetch(); if (i == '\33') lprcat(" aborted"); return (i); @@ -1294,7 +1294,7 @@ readnum(mx) int i; unsigned long amt = 0; sncbr(); - if ((i = lgetchar()) == '*') + if ((i = ttgetch()) == '*') amt = mx; /* allow him to say * for all gold */ else while (i != '\n') { @@ -1305,7 +1305,7 @@ readnum(mx) } if ((i <= '9') && (i >= '0') && (amt < 99999999)) amt = amt * 10 + i - '0'; - i = lgetchar(); + i = ttgetch(); } scbr(); return (amt); diff --git a/larn/monster.c b/larn/monster.c index 00f01163..a4f6bbce 100644 --- a/larn/monster.c +++ b/larn/monster.c @@ -1,4 +1,4 @@ -/* $NetBSD: monster.c,v 1.15 2008/02/03 20:11:05 dholland Exp $ */ +/* $NetBSD: monster.c,v 1.16 2008/02/03 21:24:58 dholland Exp $ */ /* * monster.c Larn is copyrighted 1986 by Noah Morgan. @@ -100,7 +100,7 @@ */ #include #ifndef lint -__RCSID("$NetBSD: monster.c,v 1.15 2008/02/03 20:11:05 dholland Exp $"); +__RCSID("$NetBSD: monster.c,v 1.16 2008/02/03 21:24:58 dholland Exp $"); #endif /* not lint */ #include @@ -237,16 +237,16 @@ cast() } lprcat(eys); --c[SPELLS]; - while ((a = lgetchar()) == 'D') { + while ((a = ttgetch()) == 'D') { seemagic(-1); cursors(); lprcat(eys); } if (a == '\33') goto over; /* to escape casting a spell */ - if ((b = lgetchar()) == '\33') + if ((b = ttgetch()) == '\33') goto over; /* to escape casting a spell */ - if ((d = lgetchar()) == '\33') { + if ((d = ttgetch()) == '\33') { over: lprcat(aborted); c[SPELLS]++; return; @@ -1000,7 +1000,7 @@ dirsub(x, y) int i; lprcat("\nIn What Direction? "); for (i = 0;;) - switch (lgetchar()) { + switch (ttgetch()) { case 'b': i++; case 'n': @@ -1901,7 +1901,7 @@ genmonst() int i, j; cursors(); lprcat("\nGenocide what monster? "); - for (i = 0; (!isalpha(i)) && (i != ' '); i = lgetchar()); + for (i = 0; (!isalpha(i)) && (i != ' '); i = ttgetch()); lprc(i); for (j = 0; j < MAXMONST; j++) /* search for the monster type */ if (monstnamelist[j] == i) { /* have we found it? */ diff --git a/larn/moreobj.c b/larn/moreobj.c index 70853acb..7854cf7d 100644 --- a/larn/moreobj.c +++ b/larn/moreobj.c @@ -1,4 +1,4 @@ -/* $NetBSD: moreobj.c,v 1.8 2008/01/28 05:38:54 dholland Exp $ */ +/* $NetBSD: moreobj.c,v 1.9 2008/02/03 21:24:58 dholland Exp $ */ /* * moreobj.c Larn is copyrighted 1986 by Noah Morgan. @@ -9,7 +9,7 @@ */ #include #ifndef lint -__RCSID("$NetBSD: moreobj.c,v 1.8 2008/01/28 05:38:54 dholland Exp $"); +__RCSID("$NetBSD: moreobj.c,v 1.9 2008/02/03 21:24:58 dholland Exp $"); #endif /* not lint */ #include #include @@ -35,11 +35,11 @@ oaltar() iopts(); while (1) { while (1) - switch (lgetchar()) { + switch (ttgetch()) { case 'p': lprcat(" pray\nDo you (m) give money or (j) just pray? "); while (1) - switch (lgetchar()) { + switch (ttgetch()) { case 'j': if (rnd(100) < 75) lprcat("\nnothing happens"); @@ -153,7 +153,7 @@ othrone(arg) iopts(); while (1) { while (1) - switch (lgetchar()) { + switch (ttgetch()) { case 'p': lprcat(" pry off"); k = rnd(101); @@ -203,7 +203,7 @@ odeadthrone() iopts(); while (1) { while (1) - switch (lgetchar()) { + switch (ttgetch()) { case 's': lprcat(" sit down"); k = rnd(101); @@ -238,7 +238,7 @@ ochest() iopts(); while (1) { while (1) - switch (lgetchar()) { + switch (ttgetch()) { case 'o': lprcat(" open it"); k = rnd(101); @@ -307,7 +307,7 @@ ofountain() lprcat("\nDo you (d) drink, (w) wash yourself"); iopts(); while (1) - switch (lgetchar()) { + switch (ttgetch()) { case 'd': lprcat("drink"); if (rnd(1501) < 2) { diff --git a/larn/object.c b/larn/object.c index a5564723..691f9780 100644 --- a/larn/object.c +++ b/larn/object.c @@ -1,10 +1,10 @@ -/* $NetBSD: object.c,v 1.12 2008/01/28 05:38:54 dholland Exp $ */ +/* $NetBSD: object.c,v 1.13 2008/02/03 21:24:59 dholland Exp $ */ /* object.c Larn is copyrighted 1986 by Noah Morgan. */ #include #ifndef lint -__RCSID("$NetBSD: object.c,v 1.12 2008/01/28 05:38:54 dholland Exp $"); +__RCSID("$NetBSD: object.c,v 1.13 2008/02/03 21:24:59 dholland Exp $"); #endif /* not lint */ #include "header.h" #include "extern.h" @@ -149,7 +149,7 @@ lookforobject() lprcat("\nDo you (g) go inside, or (i) stay here? "); i = 0; while ((i != 'g') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if (i == 'g') { oschool(); /* the college of larn */ } else @@ -174,7 +174,7 @@ lookforobject() lprcat("\nDo you (g) go inside, or (i) stay here? "); j = 0; while ((j != 'g') && (j != 'i') && (j != '\33')) - j = lgetchar(); + j = ttgetch(); if (j == 'g') { if (i == OBANK) obank(); @@ -197,7 +197,7 @@ lookforobject() lprcat("\nDo you (g) go inside, or (i) stay here? "); i = 0; while ((i != 'g') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if (i == 'g') dndstore(); /* the dnd adventurers store */ else @@ -220,7 +220,7 @@ lookforobject() iopts(); i = 0; while ((i != 'c') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if ((i == '\33') || (i == 'i')) { ignore(); break; @@ -239,7 +239,7 @@ lookforobject() iopts(); i = 0; while ((i != 'o') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if ((i == '\33') || (i == 'i')) { ignore(); playerx = lastpx; @@ -290,7 +290,7 @@ lookforobject() iopts(); i = 0; while ((i != 'g') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if (i == 'g') { newcavelevel(1); playerx = 33; @@ -310,7 +310,7 @@ lookforobject() iopts(); i = 0; while ((i != 'c') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if ((i == '\33') || (i == 'i')) { ignore(); break; @@ -350,7 +350,7 @@ lookforobject() iopts(); i = 0; while ((i != 'c') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if ((i == '\33') || (i == 'i')) { ignore(); break; @@ -446,7 +446,7 @@ lookforobject() lprcat("\nDo you (g) go inside, or (i) stay here? "); i = 0; while ((i != 'g') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if (i == 'g') otradepost(); else @@ -460,7 +460,7 @@ lookforobject() lprcat("\nDo you (g) go inside, or (i) stay here? "); i = 0; while ((i != 'g') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if (i == 'g') ohome(); else @@ -481,7 +481,7 @@ lookforobject() lprcat("\nDo you (g) go inside, or (i) stay here? "); i = 0; while ((i != 'g') && (i != 'i') && (i != '\33')) - i = lgetchar(); + i = ttgetch(); if (i == 'g') olrs(); /* the larn revenue service */ else @@ -524,7 +524,7 @@ finditem(int theitem) iopts(); i = 0; while (i != 't' && i != 'i' && i != '\33') - i = lgetchar(); + i = ttgetch(); if (i == 't') { lprcat("take"); if (take(theitem, tmp) == 0) @@ -557,7 +557,7 @@ ostairs(dir) lprcat("or (f) kick stairs? "); while (1) - switch (lgetchar()) { + switch (ttgetch()) { case '\33': case 's': case 'i': @@ -662,7 +662,7 @@ opotion(pot) lprcat("\nDo you (d) drink it, (t) take it"); iopts(); while (1) - switch (lgetchar()) { + switch (ttgetch()) { case '\33': case 'i': ignore(); @@ -878,7 +878,7 @@ oscroll(typ) lprcat("(t) take it"); iopts(); while (1) - switch (lgetchar()) { + switch (ttgetch()) { case '\33': case 'i': ignore(); @@ -1172,7 +1172,7 @@ obook() lprcat("(t) take it"); iopts(); while (1) - switch (lgetchar()) { + switch (ttgetch()) { case '\33': case 'i': ignore(); @@ -1223,7 +1223,7 @@ ocookie(void) lprcat("\nDo you (e) eat it, (t) take it"); iopts(); while (1) - switch (lgetchar()) { + switch (ttgetch()) { case '\33': case 'i': ignore(); @@ -1323,9 +1323,9 @@ ohome() lprcat(" to continue, "); standout("escape"); lprcat(" to leave ----- "); - i = lgetchar(); + i = ttgetch(); while (i != '\33' && i != '\n') - i = lgetchar(); + i = ttgetch(); if (i == '\33') { drawscreen(); nosignal = 0; /* enable signals */ diff --git a/larn/store.c b/larn/store.c index ff1eecc7..4eb5ec52 100644 --- a/larn/store.c +++ b/larn/store.c @@ -1,4 +1,4 @@ -/* $NetBSD: store.c,v 1.13 2008/02/03 19:29:50 dholland Exp $ */ +/* $NetBSD: store.c,v 1.14 2008/02/03 21:24:59 dholland Exp $ */ /*- * Copyright (c) 1988 The Regents of the University of California. @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)store.c 5.4 (Berkeley) 5/13/91"; #else -__RCSID("$NetBSD: store.c,v 1.13 2008/02/03 19:29:50 dholland Exp $"); +__RCSID("$NetBSD: store.c,v 1.14 2008/02/03 21:24:59 dholland Exp $"); #endif #endif /* not lint */ @@ -251,7 +251,7 @@ dndstore() lflush(); i = 0; while (i != '\33') - i = lgetchar(); + i = ttgetch(); drawscreen(); nosignal = 0; /* enable signals */ return; @@ -269,7 +269,7 @@ dndstore() lprcat(" to leave]? "); i = 0; while ((i < 'a' || i > 'z') && (i != ' ') && (i != '\33') && (i != 12)) - i = lgetchar(); + i = ttgetch(); if (i == 12) { clear(); dnd_2hed(); @@ -404,7 +404,7 @@ oschool() yrepcount = 0; i = 0; while ((i < 'a' || i > 'h') && (i != '\33') && (i != 12)) - i = lgetchar(); + i = ttgetch(); if (i == 12) { sch_hed(); continue; @@ -543,7 +543,7 @@ banktitle(const char *str) lflush(); i = 0; while (i != '\33') - i = lgetchar(); + i = ttgetch(); drawscreen(); nosignal = 0; /* enable signals */ return; @@ -624,7 +624,7 @@ obanksub() yrepcount = 0; i = 0; while (i != 'd' && i != 'w' && i != 's' && i != '\33') - i = lgetchar(); + i = ttgetch(); switch (i) { case 'd': lprcat("deposit\nHow much? "); @@ -662,7 +662,7 @@ obanksub() lprcat("\nWhich stone would you like to sell? "); i = 0; while ((i < 'a' || i > 'z') && i != '*') - i = lgetchar(); + i = ttgetch(); if (i == '*') for (i = 0; i < 26; i++) { if (gemvalue[i]) { @@ -768,7 +768,7 @@ otradepost() lprcat("] ? "); i = 0; while (i > 'z' || (i < 'a' && i != '*' && i != '\33' && i != '.')) - i = lgetchar(); + i = ttgetch(); if (i == '\33') { setscroll(); recalc(); @@ -872,7 +872,7 @@ olrs() yrepcount = 0; i = 0; while (i != 'p' && i != '\33') - i = lgetchar(); + i = ttgetch(); switch (i) { case 'p': lprcat("pay taxes\nHow much? "); -- cgit v1.2.3-56-ge451