1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-09 22:38:01 -08:00
Commit Graph

1379 Commits

Author SHA1 Message Date
schwarze
6e88d42dcd fix inverted exit status of fortune -m;
bug reported and patch provided
by Tilo Stritzky <lfsdc at gmx dot de> on bugs@;
OK martijn@
2021-01-02 21:35:11 +00:00
zhuk
cb8ad17457 Avoid NULL dereference after returning from copy().
okay martijn@
2020-12-15 14:06:32 +00:00
daniel
166ddc28d1 the names com1 to com9 are reserved filenames on windows
Rename these files in the same way as NetBSD did in 2001. Requested by
John Carmack so OpenBSD source code can be checked out on Windows.

ok deraadt@, sthen@, "go ahead" jsg@
2020-12-15 00:38:18 +00:00
jmc
cbe702d0ae fix unmarked/ignored descriptive mix up;
from rafa
2020-12-13 15:47:32 +00:00
cheloha
fb669f8977 grdc(6): implement timeout with alarm(3)
grdc(6) has an optional argument indicating a timeout in seconds.
For example, one could do:

	$ grdc 60

to to tell grdc(6) to run for sixty seconds and then exit gracefully.

As implemented, however, the timeout may occur too early or too late
if the system clock is reset with settimeofday(2).

To avoid this problem we can instead use alarm(3) and a signal handler
to implement the timeout.  alarm(3) is unaffected by settimeofday(2).
2020-06-06 17:03:16 +00:00
cheloha
6222ba341e grdc(6): miscellaneous style(9)
- Sort includes alphabetically
- Sort function prototypes alphabetically
- Add missing whitespace after commas
- Remove extra whitespace after commas
- Add missing whitespace between binary operators
- Add missing whitespace between reserved words and parens, i.e. fix "if("
- Add missing __dead to usage() definition
2020-06-06 13:21:40 +00:00
schwarze
d167610cf6 no need to declare "extern optarg" and "extern optind"
when <unistd.h> is included;
patch from Jan Stary <hans at stare dot cz>;
OK millert
2020-02-14 19:17:33 +00:00
espie
3367dcf595 a few depend:-related thingies that were still in.
okay millert@, tb@
2019-12-21 21:39:59 +00:00
jmc
81b7b661bd fix gary zukav's "acceptance without proof" quote, which just appeared on
my screen.

i don;t have a copy of this book, and a brief search online shows conflicting
punctuation, but i've chosen to replace the comma splice with a full stop,
which is at least grammatically correct, and seems the most likely solution.

whether this quote needs to be in two files escapes me...
2019-09-27 20:44:22 +00:00
schwarze
32a8c8b51d Be more specific regarding which encoding this simulator generates:
the existing text encouraged the misconception that punched card
encodings were somehow standardized, which they were not.  Lots of
different encodings existed, and the one simulated here was a
proprietary one of one specific vendor (GE).  Also correct the
history: the folks at Bell Labs already played with this.

HISTORY mistake noticed by Sevan Janiyan <venture37 at geeklan
dot co dot uk>, who also agrees with the final patch.

tweak and OK jmc@
2019-09-08 22:43:46 +00:00
deraadt
4d9461faa6 Move 4 manual pages from not-a-function filenames to a correct filename,
and correct Xr.
ok jmc
2019-08-30 18:33:17 +00:00
jmc
4279707e7c spelling fix and zap a stray line while here; 2019-08-22 16:32:26 +00:00
deraadt
df69c215c7 When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
2019-06-28 13:32:41 +00:00
lteo
41daf97413 Remove unused variables; no binary change.
From Jake Champlin
2019-05-20 02:11:22 +00:00
rob
41b007386b Unveil tetris.
ok brynet@, tedu@
2019-05-18 19:38:25 +00:00
schwarze
ab9f6680fc patch from <tleguern at bouledef dot eu> to support backward rotation,
hoping to save somebody's life from the Leather Goddesses of Phobos
2019-05-15 15:59:24 +00:00
jmc
724fe9d8c7 eaktway eviouspray; 2019-05-12 06:07:36 +00:00
tedu
189fbbeead add an example to the man page. discovered by mlarkin 2019-05-11 23:52:17 +00:00
tedu
84f04a3e43 rm lists of hereditary wizards and bad users to ensure level playing field
ok benno mlarkin tb
2019-05-09 20:19:22 +00:00
jmc
75bcd186ff macro args and punctuation should be space spearated;
from fabio scotoni
2019-04-08 17:49:07 +00:00
bentley
dc14b708bc Fix hack(6).
- Write savegames and scorefiles to the current directory instead of /var
- Save oc_name and oc_descr alongside oc_uname in all situations
- When a levitation potion times out, explicitly float down

These patches were contributed last year by "tonypony76"; thanks!

ok deraadt@, with added enthusiasm from tedu@
2019-04-05 09:02:27 +00:00
tb
d2ba0c38d7 g/c unused robots_roll file.
From Randy Hartman
2019-02-26 07:14:35 +00:00
schwarze
b28c290522 missing word found in my tree 2019-02-06 15:02:01 +00:00
schwarze
a44abf720c give the fake latin proverb "per aspera ad astra" in the more
commonly used and metrically and logically more pleasant word
order, and fix the wrong translation;
translation error reported by Alessandro de Laurenzis on tech@;
OK pascal@ jmc@
2019-02-03 13:35:33 +00:00
tedu
3bce2bd62b printing the pinball bonus in the corner is confusing when you lose.
just let the bonus happen if it does, players will figure it out.
2019-01-20 04:14:19 +00:00
tedu
59bfb9d6a7 remove some obsolete comments about deleted code 2019-01-20 04:12:58 +00:00
tedu
ae3bacb543 quick fix to keep the cursor in the corner during space warp.
less distracting this way.
2019-01-20 04:10:12 +00:00
tedu
e87918d773 if the snake ran over the money, print the treasure instead of empty.
bug noticed by mlarkin
2019-01-20 04:09:15 +00:00
tedu
8ca82b0009 allow q to exit the program.
ok cheloha deraadt schwarze
2019-01-06 18:27:14 +00:00
tedu
2e2e33a122 convert to unsigned variables to avoid some overflows.
analysis and patch from David Fifield
2018-12-27 17:27:23 +00:00
schwarze
6106ce73d6 Move a badly positioned parenthesis that caused nonsensical movement
properties for the Wumpus.  The bug has been present since 4.3BSD-Reno
and was introduced by Keith Bostic on February 14, 1990 when committing
the major rewrite from Dave Taylor.

Patch (accompanied by a detailed functional and historical analysis)
from David Fifield <david at bamsoftware dot com> on bugs@.

With all the bats in these caves, how could a bug possibly survive
for twenty-eight years?
2018-12-20 09:55:44 +00:00
tb
b5c67e29cb More fixes from David Fifield:
First, fill a missing pixel in the glyph for 'U'.

Second, fix an off-by-one in the line output routine. This caused an
extra space character to be output at the end of every line. It might
have caused a buffer overflow if any glyph had used the entire possible
width of 132 pixels, but as it is the widest is only 124 pixels.

Third, output blank lines instead of lines full of spaces (the number of
spaces was equal to the width of the most recent non-blank line).

Finally, add bounds checks to protect against buffer overflows that could arise
in case the data table were ever modified to draw out of bounds (characters
wider or taller than 132 pixels, or a two-byte code where the second byte is
past the end of the table).

ok bcallah
2018-10-16 20:06:42 +00:00
tb
76b6612d58 Remove unused data table entries: 174 out of 9271 entries of the bitmap
data table are unused and can be eliminated by rendering al glyphs and
re-encoding them. A few more entries can be eliminated through more
efficient encoding.

Patch generated with a python program by David Fifield.
For details see https://marc.info/?l=openbsd-bugs&m=153955110702704&w=2

ok bcallah
2018-10-16 19:56:55 +00:00
bentley
378bc3c488 Fix fortune underlines and use the right number of underscores in Notes.
ok sthen@
2018-09-15 09:44:19 +00:00
mestre
e4a577c2d1 During our refactor with tedu@ tb@ and myself we moved the score file to the
user's home folder and setgid was removed. Therefore it's not possible to have a
single score file with all the users anymore but we forgot to change a comment
that still implied that.

Suggested by tb@ to just delete the comment.
2018-08-24 11:31:17 +00:00
mestre
b9f1292116 Remove a few too early pledge(2)s on games/ and apply them a little bit later
but with much reduced permissions ("stdio tty" if ncurses based and "stdio"
for the ones that only perform basic operations).

There's still a few games that we cannot yet remove their fs access, through
pledge(2), since they open files on demand and too late, this might get
revisited in the future.

OK tb@
2018-08-24 11:14:49 +00:00
mestre
8ac81e2dac reduce pledge(2) to "stdio tty" after ncurses initialization. robots(6) uses a
scorefile nevertheless an fd is opened way in advance and therefore we can
disable any further access to the filesystem.

OK tb@
2018-08-23 06:26:35 +00:00
mestre
c5ef424a48 reduce pledge(2) to "stdio tty" after ncurses initialization.
OK tb@
2018-08-23 06:25:01 +00:00
mestre
e6afc4b502 The game is playable without the need to access any files therefore we can
effectively disable all fs access by dropping "rpath wpath cpath" from
pledge(2) right at the beginning of the program.

"looks right" tb@
2018-08-09 17:51:22 +00:00
mestre
20ac8c99cc Drop "rpath" from pledge(2) after ncurses initialization.
Discussed with and OK tb@
OK cheloha@ on previous version
2018-08-06 06:27:32 +00:00
schwarze
d5b157b095 remove duplicate installation of the SIGINT handler;
from Martin Kopta <martin at kopta dot eu>
2018-08-05 13:32:25 +00:00
tb
f26e040b81 Use a NUMKEYS macro instead of magic and use a more familiar idiom
in for loops.

ok stsp, bcallah
2018-04-25 17:41:23 +00:00
tedu
ba58ec645c slightly reduce the difficulty of the adventure game that is reading
the battlestar code by reformatting a few lines.
special request from mlarkin so he'll go back to fixing meltdown.
2018-02-07 20:22:23 +00:00
otto
c60fd96deb Fix table wrt missing element and `, detailed analysis and diff from
David Fifield; ok tb@
2018-01-23 07:06:55 +00:00
jmc
21f32b87f3 apostrophe fix; 2018-01-12 20:13:06 +00:00
cheloha
84915a11ab Consolidate printf(3) calls at the end of main().
Makes reading the classification algorithm easier.

ok tb@
2017-12-24 22:12:49 +00:00
cheloha
b1a8839e5d Use more libm.
adj360() is a modulo operation: use fmod(3) to simplify things.

Adding 0.5 to the phase to steer implicit truncation is a hack:
use lround(3) to simplify things.

Product of a discussion with pjanzen@/jca@/tb@ regarding floating-point
rounding and the importance of correctly classifying a gibbous moon.

ok pjanzen@ jca@ tb@
2017-12-24 16:59:50 +00:00
cheloha
1dfeccb761 As we only use the .tv_sec field, simplify gettimeofday(2) -> time(3).
ok tb@ jca@
2017-12-23 20:53:07 +00:00
tb
77b728da66 The code can be simplified by using clock_gettime(2)'s CLOCK_REALTIME
instead of gettimeofday(2).

From Scott Cheloha, ok jca
2017-12-11 23:33:44 +00:00
tb
b9458a950e than -> then
from scott cheloha
2017-11-25 05:55:40 +00:00
tb
b370adbcee Straightforward conversion to strtonum. Slight change of behavior in that
trailing whitespace is no longer permitted when invoked from stdin.
From Scott Cheloha.

ok jca
2017-11-02 10:37:11 +00:00
mpi
e9d517b1e4 Use <elf.h> instead of <elf_abi.h>
ok jasper@, jca@, deraadt@
2017-10-27 16:47:08 +00:00
tb
170e92b1c8 typo: on -> of
From Scott Cheloha
2017-08-15 17:21:17 +00:00
tedu
176f6ce77d replace gettimeofday with monotonic gettime. from Scott Cheloha
ok tb
2017-08-13 02:12:16 +00:00
tedu
5b2e624307 convert source code frequencies to match those in the man page 2017-08-10 17:24:30 +00:00
millert
3872154d62 Treat backspace as printable in sanitize() for non-UTF8 locales.
Fixes printing of fortunes that use a combination of backspace and
underbars for underlining in non-UTF8 locales.  OK schwarze@
2017-08-10 17:00:08 +00:00
tb
9ab6e3d4ab Convert fprintf(stderr, ...) to errx/warnx (with slight change of output).
From Scott Cheloha
2017-07-13 02:57:52 +00:00
tb
2e6acff8f7 Use an umlaut in Mobius and uppercase one instance of möbius visible in
bentley's previous commit.
2017-07-13 02:45:56 +00:00
bentley
1fa925aa3a Convert fortunes to UTF-8 from the old "backspace punctuation" method.
suggested by tedu, ok schwarze@ stsp@ tb@
2017-07-13 02:05:14 +00:00
schwarze
295a164a8e Inspect LC_CTYPE and if it isn't UTF-8, weed out bytes that are not
printable ASCII.  That makes using UTF-8 in fortune datfiles safe.
Potential usefulness of UTF-8 in fortune datfiles noticed by bentley@.
OK tedu@ millert@.
2017-07-12 11:36:22 +00:00
fcambus
f2b3f156ef User count checks have been compiled out since 1998, get rid of them.
OK mlarkin@
2017-07-11 14:32:16 +00:00
espie
2b34b792e5 remove misc. depend and yacc nits that no longer matter.
okay millert@
2017-07-10 21:30:37 +00:00
espie
b32aa91882 have bsd.prog.mk/bsd.lib.mk generate .y -> .c/.h rules without intermediate
files. This fixes up parallel builds in the default case.
FreeBSD does something similar.

okay millert@
2017-07-09 14:04:50 +00:00
tb
fca8243363 Remove old junk. From Matthew Martin
ok bentley
2017-07-09 08:33:11 +00:00
espie
ac34abcd10 we're not shooting yacception
okay millert@
2017-07-07 12:41:59 +00:00
espie
9410ab6b62 missed BUILDFIRST. Allow stuff to proceed without depends
as found by krw@
2017-07-01 14:37:25 +00:00
mestre
3337783520 Add missing rot13 function prototype 2017-06-30 08:39:16 +00:00
fcambus
595d499329 Remove unused confirm() and datime() functions.
Those functions are unused and have been compiled out since 1998,
it's time to let them go.

OK sthen@, tom@, mestre@
2017-06-23 12:56:25 +00:00
akfaew
8733d36ff9 Fix a path in Makequest and remove hack.sh (it never worked).
OK tb@
2017-06-20 20:40:54 +00:00
bentley
0b7dceae36 No need for a conditional to choose between nroff and troff.
ok jmc@
2017-06-19 06:04:16 +00:00
akfaew
7f46331757 Remove the Installation section and fix a nonexistent path.
OK tb@ (fix paths diff) deraadt@
2017-06-15 20:10:25 +00:00
akfaew
f679ca8d70 /usr/games/lib doesn't exist any more, use the new path.
OK tb@ deraadt@
2017-06-12 20:56:20 +00:00
espie
752051c1bd destroy lint remnants.
okay millert@ deraadt@
2017-06-12 18:49:33 +00:00
fcambus
144df0bdf2 Correct number of players, the program enforces a range from 2 to 9.
OK tb@, jmc@
2017-06-09 15:32:40 +00:00
fcambus
117857630c Use proper bool types in fortune(6).
OK tb@, phessler@ (previous version)
2017-06-04 13:39:25 +00:00
fcambus
f194f74edd Fix an infinite loop in fortune(6).
When invoking fortune with the -l option (to get long dictums only),
the program gets stuck in an infinite loop because fortlen() doesn't
return the fortune length correctly.

OK mestre@, tb@, deraadt@, schwarze@
2017-06-02 20:02:39 +00:00
tedu
d73d827e1d late game space battles require tty pledge to clear screen, etc.
from tomr
2017-05-31 19:51:27 +00:00
tedu
affbef567d remove some escapes that are unnecessary/harmful. ok jmc schwarze 2017-05-28 22:27:10 +00:00
tedu
8be1719951 remove unused macro 2017-05-28 21:13:39 +00:00
tedu
bacfd86d0e there are no bugs; i fixed them 2017-05-28 21:09:24 +00:00
tedu
ebff5be786 if your dying scream would escape the death field, realign to stay within 2017-05-28 21:01:13 +00:00
tedu
1755eb3f54 high scores printed too far to the right, move it left a little 2017-05-28 20:34:33 +00:00
tedu
9283ef5c3b forgot to remove mention of deleted dump/restart.
also delete ancient todo file:
Frankly,
I am getting pretty sick of playing this game.
Hence,
the version which you get may have several bugs
2017-05-26 19:48:28 +00:00
tedu
fc7830f477 save and restore hasn't worked for some time, not since -fPIE, since it
uses a pointer equality check for save game validity. remove it.
discovered by the ever inquisitive mlarkin
2017-05-26 19:19:23 +00:00
tb
37b707d35a Silence a whole slew of clang warnings by doing a no-op in the crazy
internal obfuscation scheme the other way around, thereby avoiding a
signed underflow.

ok mestre
2017-05-19 08:22:53 +00:00
tb
81817b7795 According to termcap(3), char PC, *BC, *UP need to be extern. Fixes an
ld(1) error found by mestre a while ago.

fix suggested and ok naddy
2017-04-16 18:04:02 +00:00
fcambus
1bed50f304 Clean up disabled declaration in the text struct.
OK deraadt@
2017-04-10 13:56:16 +00:00
gsoares
dc90561245 snprintf() format string should be literal
avoid compiler silly warnings

sure deraadt@
2017-04-08 22:59:09 +00:00
gsoares
12fe996ad7 format string is better be literal
OK deraadt
2017-04-08 22:50:41 +00:00
krw
ac1fa6a8a4 Nuke whitespace foolish enough to expose itself during the great
"warning:" rectification.
2017-01-21 08:22:57 +00:00
krw
4b162b9998 In "%.*s" the * takes (int). gcc whines if you try to use the result
of pointer subtraction without a cast. So cast those expressions
to (int).

Switch one local variable to the same type as the parameter it is
compared to.

ok deraadt@ guenther@ beck@
2017-01-20 03:47:31 +00:00
tb
82114a2f3f mark the prototypes of tutor() and leave() as __dead as well.
ok guenther, krw
2017-01-20 01:55:25 +00:00
krw
25bf4423c8 Mark functions that do not return as __dead to quiet gcc warnings.
ok beck@
2017-01-20 01:12:44 +00:00
krw
71cfb2ea07 Nuke some excess whitespace. 2017-01-20 00:50:16 +00:00
krw
ed928af3c9 gcc says "if you define labels and don't use them, I will whine."
ok tom@
2016-12-25 20:30:41 +00:00
krw
152cfd509a Eliminate another 'calculated, not used' warning by nuking a spurious
dereference.

Same change made in NetBSD in 1997.

ok tb@ millert@ tom@
2016-12-21 18:28:19 +00:00
jmc
02dad92ccb elements 113, 115, 117, and 118; from pjanzen 2016-12-03 07:38:38 +00:00
fcambus
f4763835df Remove useless #ifndef in atc(6) and pom(6).
M_PI is always defined, so we can drop those directives.

OK deraadt@, millert@
2016-12-01 20:08:59 +00:00
jmc
611c94fa7f spelling fix from eric van gyzen, freebsd r308293; 2016-11-05 07:56:25 +00:00
tb
23e9b32019 If boardspec doesn't consist entirely of lower case letters, there will be
out of bound accesses of arrays, leading to sefaults or bus errors.  Verify
that at most one boardspec with lower case letters is given, or error out.

ok millert
2016-09-12 20:11:10 +00:00