From ef178239f8a825e1c9dfde4c994a8eb7d680c9b2 Mon Sep 17 00:00:00 2001 From: joerg Date: Mon, 23 May 2011 22:53:25 +0000 Subject: Correctly print variables as strings, not as format string. --- hack/hack.apply.c | 6 +++--- hack/hack.eat.c | 6 +++--- hack/hack.invent.c | 8 ++++---- hack/hack.main.c | 10 ++++++---- hack/hack.options.c | 6 +++--- hack/hack.pager.c | 8 ++++---- hack/hack.potion.c | 6 +++--- hack/hack.rumors.c | 6 +++--- hack/hack.timeout.c | 6 +++--- 9 files changed, 32 insertions(+), 30 deletions(-) (limited to 'hack') diff --git a/hack/hack.apply.c b/hack/hack.apply.c index ef8ce2aa..a9984b94 100644 --- a/hack/hack.apply.c +++ b/hack/hack.apply.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.apply.c,v 1.10 2009/06/07 18:30:39 dholland Exp $ */ +/* $NetBSD: hack.apply.c,v 1.11 2011/05/23 22:53:25 joerg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.apply.c,v 1.10 2009/06/07 18:30:39 dholland Exp $"); +__RCSID("$NetBSD: hack.apply.c,v 1.11 2011/05/23 22:53:25 joerg Exp $"); #endif /* not lint */ #include "hack.h" @@ -383,7 +383,7 @@ dig(void) digtxt = "Now what exactly was it that you were digging in?"; mnewsym(dpx, dpy); prl(dpx, dpy); - pline(digtxt); /* after mnewsym & prl */ + pline("%s", digtxt); /* after mnewsym & prl */ return (0); } else { if (IS_WALL(levl[dpx][dpy].typ)) { diff --git a/hack/hack.eat.c b/hack/hack.eat.c index c8fae24f..aca3643c 100644 --- a/hack/hack.eat.c +++ b/hack/hack.eat.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.eat.c,v 1.9 2009/08/12 07:28:40 dholland Exp $ */ +/* $NetBSD: hack.eat.c,v 1.10 2011/05/23 22:53:25 joerg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.eat.c,v 1.9 2009/08/12 07:28:40 dholland Exp $"); +__RCSID("$NetBSD: hack.eat.c,v 1.10 2011/05/23 22:53:25 joerg Exp $"); #endif /* not lint */ #include "hack.h" @@ -138,7 +138,7 @@ opentin(void) useup(tin.tin); r = rn2(2 * TTSZ); if (r < TTSZ) { - pline(tintxts[r].txt); + pline("%s", tintxts[r].txt); lesshungry(tintxts[r].nut); if (r == 1) { /* SALMON */ Glib = rnd(15); diff --git a/hack/hack.invent.c b/hack/hack.invent.c index 8f9f768e..a259c855 100644 --- a/hack/hack.invent.c +++ b/hack/hack.invent.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.invent.c,v 1.14 2009/08/12 07:28:40 dholland Exp $ */ +/* $NetBSD: hack.invent.c,v 1.15 2011/05/23 22:53:25 joerg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.invent.c,v 1.14 2009/08/12 07:28:40 dholland Exp $"); +__RCSID("$NetBSD: hack.invent.c,v 1.15 2011/05/23 22:53:25 joerg Exp $"); #endif /* not lint */ #include @@ -655,7 +655,7 @@ askchain(struct obj *objchn, char *olets, int allflag, if (ckfn && !(*ckfn) (otmp)) continue; if (!allflag) { - pline(xprname(otmp, ilet)); + pline("%s", xprname(otmp, ilet)); addtopl(" [nyaq]? "); sym = readchar(); } else @@ -699,7 +699,7 @@ obj_to_let(struct obj *obj) void prinv(struct obj *obj) { - pline(xprname(obj, obj_to_let(obj))); + pline("%s", xprname(obj, obj_to_let(obj))); } static char * diff --git a/hack/hack.main.c b/hack/hack.main.c index cfa379b9..cb0537f3 100644 --- a/hack/hack.main.c +++ b/hack/hack.main.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.main.c,v 1.15 2010/02/03 15:34:38 roy Exp $ */ +/* $NetBSD: hack.main.c,v 1.16 2011/05/23 22:53:25 joerg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.main.c,v 1.15 2010/02/03 15:34:38 roy Exp $"); +__RCSID("$NetBSD: hack.main.c,v 1.16 2011/05/23 22:53:25 joerg Exp $"); #endif /* not lint */ #include @@ -418,8 +418,10 @@ not_recovered: } if (multi < 0) { if (!++multi) { - pline(nomovemsg ? nomovemsg : - "You can move again."); + if (nomovemsg) + pline("%s", nomovemsg); + else + pline("You can move again."); nomovemsg = 0; if (afternmv) (*afternmv) (); diff --git a/hack/hack.options.c b/hack/hack.options.c index 7f0789c1..ff2622a8 100644 --- a/hack/hack.options.c +++ b/hack/hack.options.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.options.c,v 1.10 2009/08/12 07:28:41 dholland Exp $ */ +/* $NetBSD: hack.options.c,v 1.11 2011/05/23 22:53:25 joerg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.options.c,v 1.10 2009/08/12 07:28:41 dholland Exp $"); +__RCSID("$NetBSD: hack.options.c,v 1.11 2011/05/23 22:53:25 joerg Exp $"); #endif /* not lint */ #include @@ -271,7 +271,7 @@ doset(void) if (*--eop == ',') *eop = 0; } - pline(buf); + pline("%s", buf); } else parseoptions(buf, FALSE); diff --git a/hack/hack.pager.c b/hack/hack.pager.c index eb6484be..dca670d8 100644 --- a/hack/hack.pager.c +++ b/hack/hack.pager.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.pager.c,v 1.14 2010/02/03 15:34:38 roy Exp $ */ +/* $NetBSD: hack.pager.c,v 1.15 2011/05/23 22:53:25 joerg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.pager.c,v 1.14 2010/02/03 15:34:38 roy Exp $"); +__RCSID("$NetBSD: hack.pager.c,v 1.15 2011/05/23 22:53:25 joerg Exp $"); #endif /* not lint */ /* This file contains the command routine dowhatis() and a pager. */ @@ -114,7 +114,7 @@ dowhatis(void) buf[0] = q; (void) strncpy(buf + 1, " ", 7); } - pline(buf); + pline("%s", buf); if (ep[-1] == ';') { pline("More info? "); if (readchar() == 'y') { @@ -302,7 +302,7 @@ cornline(int mode, const char *text) } /* --- now we really do it --- */ if (mode == 2 && linect == 1) /* topline only */ - pline(texthead->line_text); + pline("%s", texthead->line_text); else if (mode == 2) { int curline, lth; diff --git a/hack/hack.potion.c b/hack/hack.potion.c index 5707217b..09c00bc9 100644 --- a/hack/hack.potion.c +++ b/hack/hack.potion.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.potion.c,v 1.8 2009/08/12 07:28:41 dholland Exp $ */ +/* $NetBSD: hack.potion.c,v 1.9 2011/05/23 22:53:25 joerg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.potion.c,v 1.8 2009/08/12 07:28:41 dholland Exp $"); +__RCSID("$NetBSD: hack.potion.c,v 1.9 2011/05/23 22:53:25 joerg Exp $"); #endif /* not lint */ #include "hack.h" @@ -286,7 +286,7 @@ strange_feeling(struct obj *obj, const char *txt) if (flags.beginner) pline("You have a strange feeling for a moment, then it passes."); else - pline(txt); + pline("%s", txt); if (!objects[obj->otyp].oc_name_known && !objects[obj->otyp].oc_uname) docall(obj); useup(obj); diff --git a/hack/hack.rumors.c b/hack/hack.rumors.c index b8a3c9b2..be0f0bba 100644 --- a/hack/hack.rumors.c +++ b/hack/hack.rumors.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.rumors.c,v 1.7 2009/08/12 07:28:41 dholland Exp $ */ +/* $NetBSD: hack.rumors.c,v 1.8 2011/05/23 22:53:25 joerg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.rumors.c,v 1.7 2009/08/12 07:28:41 dholland Exp $"); +__RCSID("$NetBSD: hack.rumors.c,v 1.8 2011/05/23 22:53:25 joerg Exp $"); #endif /* not lint */ #include "hack.h" /* for RUMORFILE and BSD (strchr) */ @@ -115,7 +115,7 @@ outline(FILE *rumf) if ((ep = strchr(line, '\n')) != 0) *ep = 0; pline("This cookie has a scrap of paper inside! It reads: "); - pline(line); + pline("%s", line); } void diff --git a/hack/hack.timeout.c b/hack/hack.timeout.c index 381205c5..17b3c177 100644 --- a/hack/hack.timeout.c +++ b/hack/hack.timeout.c @@ -1,4 +1,4 @@ -/* $NetBSD: hack.timeout.c,v 1.8 2009/08/12 07:28:41 dholland Exp $ */ +/* $NetBSD: hack.timeout.c,v 1.9 2011/05/23 22:53:25 joerg Exp $ */ /* * Copyright (c) 1985, Stichting Centrum voor Wiskunde en Informatica, @@ -63,7 +63,7 @@ #include #ifndef lint -__RCSID("$NetBSD: hack.timeout.c,v 1.8 2009/08/12 07:28:41 dholland Exp $"); +__RCSID("$NetBSD: hack.timeout.c,v 1.9 2011/05/23 22:53:25 joerg Exp $"); #endif /* not lint */ #include "hack.h" @@ -128,7 +128,7 @@ stoned_dialogue(void) long i = (Stoned & TIMEOUT); if (i > 0 && i <= SIZE(stoned_texts)) - pline(stoned_texts[SIZE(stoned_texts) - i]); + pline("%s", stoned_texts[SIZE(stoned_texts) - i]); if (i == 5) Fast = 0; if (i == 3) -- cgit v1.2.3-56-ge451