Subject: bin/36185: [dM] larn typo & output fixes
To: None <gnats-admin@netbsd.org, netbsd-bugs@netbsd.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: netbsd-bugs
Date: 04/21/2007 04:55:00
>Number: 36185
>Category: bin
>Synopsis: [dM] larn typos & other minor bugs
>Confidential: no
>Severity: non-critical
>Priority: low
>Responsible: bin-bug-people
>State: open
>Class: change-request
>Submitter-Id: net
>Arrival-Date: Sat Apr 21 04:55:00 +0000 2007
>Originator: der Mouse
>Release: NetBSD 3.1
>Organization:
Dis-
>Environment:
System: NetBSD NetBSD-3-1.Rodents.Montreal.QC.CA 3.1 NetBSD 3.1 (GENERIC) #0: Thu Mar 8 22:46:51 EST 2007 mouse@NetBSD-3-1.Rodents.Montreal.QC.CA:/usr/src/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
Based on how similar these are to my diffs to fix the same problems
under 1.4T, I expect them to apply to -current painlessly too.
>Description:
larn contains various typos and grammar mistakes ("Your lucky
to have leather on", "hit my your own magic", "to the casters
dexterity"), some grating sex assumptions ("the caster...things
around him") and some minor bugs in its output. It's also
difficult to use debuggers on, because it calls seteuid()
unconditionally.
>How-To-Repeat:
Play larn. Notice all the grammar and typo botches. Notice
output hiccups when writing the scorefile under some
circumstances. Try to debug it non-set-id and find you lose
control of it needlessly.
Even though the output glitches really are bugs, I've classed
this as change-request because the bugs are not serious, and
most of these changes are not bugs. (Arguably I should send
two PRs, one for the output bugs and one for the typo fixes, or
perhaps three, for the language fixes, for the output bugs, and
for the debugger fixes. I've rolled them all into a single
patchset for convenience, both mine and the patch applier,
because I believe they all will be uncontroversial changes. If
this was a wrong choice, please tell me.)
>Fix:
Relative to 3.1 sources,
diff -u -r larn/data.c larn.fixed/data.c
--- larn/data.c 2003-08-07 05:37:23.000000000 -0400
+++ larn.fixed/data.c 2007-04-15 20:44:03.000000000 -0400
@@ -453,15 +453,15 @@
char *speldescript[] = {
/* 1 */
"generates a +2 protection field",
- "creates and hurls a magic missile equivalent to a + 1 magic arrow",
- "adds +2 to the casters dexterity",
+ "creates and hurls a magic missile equivalent to a +1 magic arrow",
+ "adds +2 to the caster's dexterity",
"causes some monsters to go to sleep",
"some monsters may be awed at your magnificence",
"causes your hands to emit a screeching sound toward what they point",
/* 7 */
"causes strands of sticky thread to entangle an enemy",
- "adds +2 to the casters strength for a short term",
- "the caster becomes aware of things around him",
+ "adds +2 to the caster's strength for a short term",
+ "the caster becomes aware of things in the vicinity",
"restores some hp to the caster",
"restores sight to one so unfortunate as to be blinded",
"creates a monster near the caster appropriate for the location",
@@ -471,20 +471,20 @@
"makes a ball of fire that burns on what it hits",
"sends forth a cone of cold which freezes what it touches",
"you can find out what this does for yourself",
- "negates the ability of a monster to use his special abilities",
- "speeds up the casters movements",
+ "negates the ability of a monster to use its special abilities",
+ "speeds up the caster's movements",
"creates a fog of poisonous gas which kills all that is within it",
"this changes rock to air",
/* 22 */
"dries up water in the immediate vicinity",
- "you finger will emit a lightning bolt when this spell is cast",
+ "your finger will emit a lightning bolt when this spell is cast",
"subtracts hit points from both you and a monster",
"this globe helps to protect the player from physical attack",
"this creates an avalanche of H2O to flood the immediate chamber",
"this is a holy spell and calls upon your god to back you up",
/* 28 */
- "terrifies the monster so that hopefully he wont hit the magic user",
- "the monster is frozen in his tracks if this is successful",
+ "terrifies the monster so that hopefully it won't hit the magic user",
+ "the monster is frozen in its tracks if this is successful",
"all movement in the caverns ceases for a limited duration",
"moves a particular monster around in the dungeon (hopefully away from you)",
"this causes a curtain of fire to appear all around you",
diff -u -r larn/io.c larn.fixed/io.c
--- larn/io.c 2005-02-02 21:23:02.000000000 -0500
+++ larn.fixed/io.c 2007-04-15 20:47:34.000000000 -0400
@@ -572,6 +572,7 @@
lcreat(str)
char *str;
{
+ lflush();
lpnt = lpbuf;
lpend = lpbuf + BUFBIG;
if (str == NULL)
diff -u -r larn/main.c larn.fixed/main.c
--- larn/main.c 2001-02-04 19:57:33.000000000 -0500
+++ larn.fixed/main.c 2007-04-15 20:51:17.000000000 -0400
@@ -808,7 +808,7 @@
case ODARTRAP:
case OTRAPARROW:
case OTELEPORTER:
- lprcat("\nIts ");
+ lprcat("\nIt's ");
lprcat(objectname[item[i][j]]);
flag++;
};
diff -u -r larn/monster.c larn.fixed/monster.c
--- larn/monster.c 2004-01-27 15:30:30.000000000 -0500
+++ larn.fixed/monster.c 2007-04-15 20:54:39.000000000 -0400
@@ -740,7 +740,7 @@
goto fool;
} else {
lastnum = 278;
- lprintf(str, "spell caster (thats you)", (long) arg);
+ lprintf(str, "spell caster (that's you)", (long) arg);
beep();
losehp(dam);
return;
@@ -800,7 +800,7 @@
}
if ((x == playerx) && (y == playery)) { /* if energy hits player */
cursors();
- lprcat("\nYou are hit my your own magic!");
+ lprcat("\nYou are hit by your own magic!");
beep();
lastnum = 278;
losehp(dam);
@@ -1215,7 +1215,7 @@
vxy(&x, &y); /* verify coordinates are within range */
lastnum = mster = mitem[x][y];
/*
- * spirit naga's and poltergeist's do nothing if scarab of negate
+ * spirit nagas and poltergeists do nothing if scarab of negate
* spirit
*/
if (c[NEGATESPIRIT] || c[SPIRITPRO])
@@ -1534,10 +1534,10 @@
if (j == 0) /* if rusting did not occur */
switch (m) {
case OLEATHER:
- p = "\nThe %s hit you -- Your lucky you have leather on";
+ p = "\nThe %s hit you -- You're lucky you have leather on";
break;
case OSSPLATE:
- p = "\nThe %s hit you -- Your fortunate to have stainless steel armor!";
+ p = "\nThe %s hit you -- You're fortunate to have stainless steel armor!";
break;
}
else {
@@ -1550,7 +1550,7 @@
i = rnd(15) + 8 - c[AC];
spout: p = "\nThe %s breathes fire at you!";
if (c[FIRERESISTANCE])
- p = "\nThe %s's flame doesn't phase you!";
+ p = "\nThe %s's flame doesn't faze you!";
else
spout2: if (p) {
lprintf(p, lastmonst);
diff -u -r larn/scores.c larn.fixed/scores.c
--- larn/scores.c 2004-02-13 06:36:08.000000000 -0500
+++ larn.fixed/scores.c 2007-04-17 00:32:24.000000000 -0400
@@ -112,9 +112,11 @@
{
int i;
- seteuid(euid);
+ if (uid != euid)
+ seteuid(euid);
i = lopen(scorefile);
- seteuid(uid);
+ if (uid != euid)
+ seteuid(uid);
if (i < 0) {
lprcat("Can't read scoreboard\n");
lflush();
@@ -138,9 +140,11 @@
int i;
set_score_output();
- seteuid(euid);
+ if (uid != euid)
+ seteuid(euid);
i = lcreat(scorefile);
- seteuid(uid);
+ if (uid != euid)
+ seteuid(uid);
if (i < 0) {
lprcat("Can't write scoreboard\n");
lflush();
@@ -162,15 +166,18 @@
makeboard()
{
int i;
+ set_score_output();
for (i = 0; i < SCORESIZE; i++) {
winr[i].taxes = winr[i].score = sco[i].score = 0;
winr[i].order = sco[i].order = i;
}
if (writeboard())
return (-1);
- seteuid(euid);
+ if (uid != euid)
+ seteuid(euid);
chmod(scorefile, 0660);
- seteuid(uid);
+ if (uid != euid)
+ seteuid(uid);
return (0);
}
@@ -226,6 +233,7 @@
* (Ughhhhh) */
winr[i].taxes -= amt;
outstanding_taxes -= amt;
+ set_score_output();
if (writeboard() < 0)
return (0);
return (amt);
@@ -643,7 +651,8 @@
set_score_output();
if ((wizard == 0) && (c[GOLD] > 0)) { /* wizards can't score */
#ifndef NOLOG
- seteuid(euid);
+ if (uid != euid)
+ seteuid(euid);
if (lappend(logfile) < 0) { /* append to file */
if (lcreat(logfile) < 0) { /* and can't create new
* log file */
@@ -654,11 +663,14 @@
lflush();
exit(0);
}
- seteuid(euid);
+ if (uid != euid)
+ seteuid(euid);
chmod(logfile, 0660);
- seteuid(uid);
+ if (uid != euid)
+ seteuid(uid);
}
- seteuid(uid);
+ if (uid != euid)
+ seteuid(uid);
strcpy(logg.who, loginname);
logg.score = c[GOLD];
logg.diff = c[HARDGAME];
@@ -700,8 +712,10 @@
* game
*/
if (x != 257) {
- if (sortboard())
+ if (sortboard()) {
+ set_score_output();
scorerror = writeboard();
+ }
}
}
if ((x == 256) || (x == 257) || (f != 0))
/~\ The ASCII der Mouse
\ / Ribbon Campaign
X Against HTML mouse@rodents.montreal.qc.ca
/ \ Email! 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B