Commit Graph

1358 Commits

Author SHA1 Message Date
christos 44fa0e017a Coverity CID 1195: Check for possible negative index. 2006-03-18 23:33:38 +00:00
christos 8319a6a7da Coverity CID 777: Fix NULL pointer deref and de-obfuscate code. 2006-03-18 23:31:19 +00:00
christos c873d1eb57 Coverity CID 1230: Remove spurious close(). 2006-03-18 23:25:30 +00:00
christos e0b976a0ae Coverity CID 1294: Avoid negative variable used as index. 2006-03-18 23:23:33 +00:00
christos 2a67d42737 Coverity CID 1295: Don't allow cchose to return a negative number. It is
used as an index.
2006-03-18 23:14:45 +00:00
rtr 969e2244d4 fclose() open FILE * even though we are returning to fail anyway.
silences coverity, CID 1590 / run 5
2006-03-18 09:40:46 +00:00
rtr 0c0f6ae5dc don't access out of bounds element of static alloc array.
found by Coverity, CID 1519 / Run 5

XXX possible that intention was to start with i = 0.
2006-03-18 05:16:46 +00:00
abs a3edf3e145 If none of the boarding parties are set do not fall off the end of the
list. Addresses Coverity CID 1507. Also put pointers before shorts in
a struct rather than mixing them up
2006-03-18 01:43:52 +00:00
abs e0d5463807 add more "ifdef notdef" around unused sections - addresses Coverity CID 564 2006-03-17 23:36:38 +00:00
abs b4f3ebd201 Add a missing bp->b_score not null check - addresses Coverity CID 1003 2006-03-17 23:34:37 +00:00
abs 2c2c60a0ef if getpwuid() returns null, print out the uid rather than dereferencing
Addresses Coverity CID 930
2006-03-17 23:22:59 +00:00
abs f0ff12503e Fix overrun in players[] array. Addresses Coverty CID 1457 2006-03-17 23:15:02 +00:00
abs b317f83344 If getpwuid() returns null, its not usually a good idea to dereference
that to try to assign a default value. Just copy the default value into
the final destination.
Addresses Coverty CID 925
2006-03-17 23:11:47 +00:00
abs f4f2f41178 Call fclose() appropriately if there is a problem with the save file.
Coverty CID 2063
2006-03-17 23:04:01 +00:00
simonb 5cfbf7bf76 Use MKPRIVATELIB instead of NOLINKLIB/NOMAN/NOPIC/NOLINT. 2006-02-25 12:04:23 +00:00
simonb feaaa5ed4c Change DPADD from LIBTERM (which doesn't exist) and LIBCOMPAT (which it
doesn't use) to LIBTERMCAP (which it does use).
2006-02-25 11:56:51 +00:00
wiz f19f5c87cc Fix typo in the instructions. 2006-02-25 02:06:08 +00:00
wiz 5fcd22e873 Remove duplicate and uncredited "Plan for the Improvement of English
Spelling", which is also in the file "fortunes".
2006-02-25 01:40:22 +00:00
jnemeth df4822d1f0 Correct The Hitchhiker's Guide to the Galaxy entry about dolphins as per
page 119 of the book.
2006-02-20 03:00:27 +00:00
elad c53cd0c067 moduli utils moved from games to usr.bin. 2006-01-24 19:01:45 +00:00
elad c1ef323e1a Remove qsiefe/qsafe from games. Will be put back in usr.bin. 2006-01-24 18:51:20 +00:00
wiz cfebedec7e Bump date for previous. 2006-01-22 21:22:30 +00:00
wiz 5e86832ad4 Drop trailing whitespace. Remove superfluous .br. 2006-01-22 00:32:54 +00:00
elad 271a419065 better handle ^d in getinp(), so we dont loop endlessly.
i have no idea why i wanted to play this game.
2006-01-20 21:40:08 +00:00
elad 202106feb9 oops, make this install to /usr/games and not /...
noted by hannken@, thanks.
2006-01-20 14:19:31 +00:00
elad d4bdf04e28 Descend to moduli too. 2006-01-19 23:25:19 +00:00
elad 0e71d2c846 Add qsieve and qsafe, two programs used for generating the moduli file.
These were written by William Allen Simpson and submitted in PR 21983,
and are added with minor adjustments and nits from christos@ and myself.

Approved by christos@ and groo@.
2006-01-19 23:23:58 +00:00
garbled 19fe295582 Fix some minor buglets in wump:
1) Don't put two pits in the same room.
2) Don't put bats and pits in the same room.  (you will never hit the bat)
3) Don't start the player in a room with a pit or bad, if possible.  Some
caves are so crowded the loop may go on forever, so we give up after 100
tries to put them in a safe location (as long as it's not with the wumpus).
4) Make the manpage reflect reality WRT the default number of rooms.

Bug #3 pointed out by salo.
2006-01-19 21:20:35 +00:00
garbled b2fc76e5cb Apply patch from PR bin/26501 to fix hang in wump if you play too many
games in a row.  Also modify change made in rev 1.18 to work correctly.
take_action() returns 1 if the player dies, causing the game to allways
exit after any death, now the game correctly asks if the player would
like to play again.
2006-01-19 20:15:31 +00:00
christos 1e463fb58d Simplify error checking. 2005-11-19 18:01:42 +00:00
rillig c64619d462 Replaced one instance of err() with errx(), as the value of errno might not
be correct at that time.
2005-11-19 14:22:21 +00:00
mjl 7c7f1fe0ab Typos, duplicate words, consistent formatting. 2005-10-29 22:49:36 +00:00
mjl 4866f93355 Remove trailing spaces, double spaces between words, fix some typos. 2005-10-29 22:35:41 +00:00
mjl 6b25b3147c Correct typos. 2005-10-29 17:04:10 +00:00
rillig 40245fbcfd Removed the unnecessary #include <ctype.h>. 2005-10-18 20:13:04 +00:00
rpaulo 4b939f034f Fix two lines which were broken by previous commit. Noticed by Thomas
Klausner.
2005-10-12 15:33:41 +00:00
rpaulo 099795b92c misc/31566: Jaap Boender: update African and Asian capitals to the
current situation.
2005-10-12 15:14:27 +00:00
rillig 1e30fb707b Added an empty line to conform to KNF. 2005-10-08 18:18:18 +00:00
wiz 0c305c1a7e Drop trailing whitespace. 2005-09-15 02:10:37 +00:00
wiz d9f5a9df01 Use standard AUTHORS section header. From YOMURA Masanori in private mail
Sort sections if necessary. Use more/better markup.
2005-09-15 02:09:41 +00:00
perry 995abc5571 Sulfur|Sulphur -> Sul[f|ph]ur 2005-08-14 21:19:35 +00:00
perry 2b5ff6359d Sulfur -> Sulfur | Sulphur 2005-08-14 21:17:37 +00:00
perry 5b7baeda3b er, forgot the C{a}esium change in the last 2005-08-14 20:31:34 +00:00
perry 0874287eda 1) Update atomic weights.
The weights here are taken from
     http://www.iupac.org/publications/pac/2003/7508/7508x1107.html
   and have been rounded to four significant figures in all cases.
   In the case of elements that have no isotopes stable enough for
   reasonable measurement, numbers have been updated from Zumdahl,
   "Chemistry", Fifth edition and are presented (as before) in parentheses.
2) Cesium is now C{a}esium
3) A number of new elements have been added at the end of the periodic
   table.
2005-08-14 20:28:25 +00:00
perry a2a84a1ed5 Aluminum -> Alumin{i}um
Aluminium is really the official name, but doing it this way allows
entry of either answer.
2005-08-14 19:34:50 +00:00
perry 4156b28f30 Sulphur -> Sulfur
Although the traditional spelling in commonwealth countries is
"Sulphur", the official IUPAC name of the element is "Sulfur", and
even the Royal Society of Chemistry now spells it "Sulfur".
2005-08-14 17:45:17 +00:00
rpaulo 07b524b43f Added a missing '-' in score list output. 2005-08-10 19:21:21 +00:00
rpaulo b0282a1ea0 Pass lint(1). 2005-08-10 17:53:28 +00:00
rpaulo 16a8e8c2e7 Enable WARNS=3. 2005-08-10 17:52:56 +00:00
rpaulo 279b6fba65 Fixed an output bug where a new-line was added due the usage of puts(3). 2005-08-10 16:10:51 +00:00
rpaulo e58060915c Pass lint(1). 2005-08-10 14:02:26 +00:00
rpaulo 2c43d92fd8 Enable WARNS=3. 2005-08-10 14:02:10 +00:00
christos e31432ec85 add a new style cast to memcpy. 2005-08-09 15:17:41 +00:00
rpaulo dc2f26bcaa Enable WARNS=3 and pass lint(1).
ok christos@
2005-08-09 09:15:23 +00:00
christos 56c9d385d3 Pass WARNS=3 2005-08-09 02:38:32 +00:00
cjs 24b202fa43 Comment from Al. 2005-07-23 08:01:38 +00:00
rillig 80af4a9fa0 Aligned the usage message from the program with the one mentioned in the
man page.
2005-07-22 11:56:50 +00:00
rillig d590f7d069 - caesar(6) is not a SETGIDGAME, so we don't need to revoke any privileges.
- replaced direct POSIX read/write with stdio, which made the code simpler.
- added even more error checking.
- restructured the code to make each function fit on one screen
  (well, except one).
- now the code reflects the intended purpose of the program.
- return 0 instead of EXIT_FAILURE on success.
2005-07-22 11:52:23 +00:00
wiz a2b9f45e1c Quote macro. 2005-07-05 08:48:47 +00:00
jdc 5ffaff9f39 Tidy up curses state when we quit, instead of just doing exit(). 2005-07-02 15:48:03 +00:00
wiz 0dab3b253e Sort sections. Use mdoc macros. Reformat. 2005-07-02 10:46:21 +00:00
wiz 2f511b7404 Removing trailing spaces. 2005-07-02 10:40:50 +00:00
jmc 4f50e1e42e KNF conversion 2005-07-02 08:35:29 +00:00
jmc 1f90022eca KNF and WARNS=3 2005-07-02 08:32:32 +00:00
jmc 52d1fdd324 KNF and WARNS=3 2005-07-01 16:50:55 +00:00
jmc ed65ee1672 KNF and WARNS=3 2005-07-01 16:38:24 +00:00
peter 900682383e Remove the -t flag from the usage. 2005-07-01 14:21:49 +00:00
jmc bd6068f403 KNF and WARNS=3 2005-07-01 06:04:46 +00:00
jmc 86a7383a37 Whitespace fix 2005-07-01 01:13:05 +00:00
jmc fcb317ee49 KNF and WARNS=3 fixes 2005-07-01 01:12:39 +00:00
jmc 4931378a78 KNF and WARNS=3 fixes 2005-07-01 00:48:34 +00:00
jmc 243d04ef01 KNF and WARNS=3 2005-07-01 00:03:36 +00:00
perry 4acb374aa2 add ching, and also break up the SUBDIR line a bit more to make future
additions easier.

now if we could only get "dungeon"...
2005-06-30 15:35:17 +00:00
martin 844e014ade Initialize lnum and unum to avoid a "might be used uninitialized"
warning.
2005-06-30 13:44:48 +00:00
perry 2442385313 missing paragraph break from the original 2005-06-30 13:34:29 +00:00
perry 5175ead765 ching(6) -- The Book of Changes, not seen in BSD since 4.4BSD.
The C code is a complete rewrite done by Guy Harris for 4.4BSD and is
not the original from v7 at all. Unfortunately, the data file itself,
without which the rest isn't useful, was not freed until Caldera
released all of 32v a few years ago, so it was not in 4.4lite.

The data file, the ching nroff macros, and the driver script are under
Caldera or Caldera+Berkeley copyright.

I've partially redone the driver script from 4.4 (there was no point
in using a temporary file for the hexagram), which was already
partially redone from 32v. (As an aside, it is nutty that the script
needs a copyright so many times longer than the code.)

I've renamed "cno" to "castching", "phx" to "printching", (the
traditional names were opaque), and put them in /usr/libexec/ching
instead of the v7 /usr/games/ching.d. The data file and nroff macros
are in /usr/share/games/ching
2005-06-30 13:30:33 +00:00
symka 944ff7f105 Fixed error on a nonexistent mail spool file, when countmail can't find it\n\nCloses PR misc/29526\n\n\(Code submitted in PR misc/29526 by Andreas Eder) 2005-06-30 06:08:56 +00:00
rillig 1a815e1f74 Fixed a comment that said the factors in the output would be strictly
ascending.
2005-06-27 20:49:31 +00:00
rillig 556489aa53 Changed the type of data_table to be unsigned char[] instead of char[],
because it is initialized with values >= SCHAR_MAX. Also removed two
unnecessary bit mask operations. These changes do not affect the actual
behavior. Also replaced an "#ifdef notdef" with "#if 0". All these
changes are mainly for reducing lint(1) warnings.
2005-06-27 20:32:07 +00:00
rillig 45a38dbbe7 Fixed buffer overflow with long command line arguments. 2005-06-27 19:49:20 +00:00
wiz ac79bd4dc2 Drop trailing space. 2005-06-26 10:07:23 +00:00
hubertf e5a0b604a9 * Change program logic to not nest needlessly
* Search all acronyms databases, and don't force the user to
   know in which category to look (-t is gone)
 * If an acronym is not found in the database or by whatis(1),
   also check pkg_info(1). Per PR bin/30539 by Geert Hendrickx
   (geert.hendrickx@ua.ac.be)

OK'd by Julio M. Merino Vidal <jmmv>
2005-06-22 20:11:03 +00:00
tron bd52bf6180 Change marker from "pmppc" to "powerpc" because a NetBSD-macppc build
is also affected.
2005-06-09 12:20:12 +00:00
he 1ce7c753b3 Add an initialization to placate -Wuninitialized.
Marked with XXXGCC for pmppc (found while compiling for it).
2005-06-09 09:36:19 +00:00
rillig 5abe8eb023 Raised WARNS to 4. 2005-05-23 23:08:06 +00:00
rillig 8a7b93ff10 * fixed <ctype> bugs
* removed ASCII dependency
* added input data validation
* added bounds checking
* added error checking
* handle short reads (from pipes or sockets) correctly
  when trying to decode an encoded stream
* added lint(1) directives
2005-05-23 23:02:30 +00:00
kleink e039a7f675 Otto Von Bismarck -> Otto von Bismarck. 2005-05-10 18:41:53 +00:00
bad b09ec2a25b It is Bismarck not Bismark. 2005-05-10 17:47:33 +00:00
jwise 3b4f381581 Sort list, and add Nunavut, which has been a Canadian province since 1999. 2005-05-02 15:48:58 +00:00
jwise 245f508216 Cyprus is part of Europe, not Asia. Turkey is currently listed in both
Europe and Asia, I'm leaving it that way.
2005-05-02 15:39:27 +00:00
jwise 9ea9920e14 The current President of the United States is George Walker Bush, not George
Walker Bush, Jr. (his father was George Herbert Walker Bush).
2005-05-02 15:29:59 +00:00
rillig 4f6457e756 Fixed wrong use of the <ctype.h> functions by adding an explicit conversion
to unsigned char. Approved by christos.
2005-04-19 20:14:29 +00:00
rillig 117d073a60 Fixed wrong use of datatypes. In wait_for(), a char was used together
with getchar(), in readchar(), a char was used to read input, which in
getuchar() is used as an argument to islower() and toupper(). Also removed
a condition which terminated the process if the user typed in character
255. Approved by christos.
2005-04-19 20:12:07 +00:00
atatat 1d1f5d461b Don't assume /usr/games; use the same path as what rot13 was found at
to run caesar.
2005-04-09 02:02:15 +00:00
atatat 460d82b8cc A few minor spelling, grammar, and formatting fixes. 2005-04-09 02:00:27 +00:00
jwise 18de240b6b Fix a long-standing bug in wump(6) whereby hitting ^d to exit would first
print ``Care to play another game? (y-n)'' (but then exit anyway without
waiting for an answer).
2005-03-21 18:45:18 +00:00
christos ceb0805a9b Add -lcrypt where -lcrypto is specified. 2005-03-09 03:11:21 +00:00
simonb 1d351ebc53 Remove a incorrect semicolon at the end of an if().
Magic levels now appear after extensive play testing!
2005-02-25 15:04:43 +00:00
jsm 58b3287ba1 Don't presume phantasia's internal bool (char) is the same as that in
curses.h: define phbool and use it where necessary to avoid declaring
functions with one bool and defining them with the other.

Reviewed by <hubertf>.
2005-02-15 12:58:21 +00:00
jsm b91a81ab9f Cast last argument of execl to (char *).
Reviewed by <hubertf>.
2005-02-15 12:56:20 +00:00
jsm 2773e864bb Avoid arrays of incomplete types (required to build with GCC 4).
Reviewed by <hubertf>.
2005-02-15 12:54:50 +00:00
perry 1a3bb884dc A preprocessor macro named "srand" was defined which seeded the random
number generator.

Unfortunately, it conflicted with a function of the same defined in
stdlib.h. This was masked by the __P hack, which is now being purged.

I've renamed "srand" to "seedrand" to eliminate the conflict.
2005-02-03 02:23:02 +00:00
jsm a4dab13a3b Correct typos in German fortune. Reported by Charles Senger, csenger at UCSD.
Reviewed by <hubertf>.
2005-01-30 13:49:28 +00:00
nathanw df7bbbcb3c Convert from libc/threadlib-style mutex protection to pthread style.
(XXX this game totally does not need a thread-safe malloc)
2004-12-14 00:21:01 +00:00
jmc 279847975e Redo how void gets init'd.
setup now just creates an empty file. When main starts and loads it in,
it stats and if zero size init's a new location and saves it back out.
Now games.tgz can be shared among MACHINE_ARCH's
2004-12-09 05:15:59 +00:00
christos 42728e787e Slimy worms are clean enough for level 3. 2004-11-13 10:22:13 +00:00
dsl 49f7d8a9b1 Add (unsigned char) cast to ctype functions 2004-11-05 21:30:31 +00:00
christos 82345479d5 Don't try to catch SIGSTOP... 2004-09-12 04:51:32 +00:00
wiz f4d1c39625 Indent header description (from jmc@openbsd).
Sort sections and remove a trailing space.
2004-09-09 22:03:21 +00:00
wiz 8dab296315 Some improvements from jmc@openbsd:
sort option descriptions, add argument to -m, mention strfile
and add some xrefs.
2004-09-09 22:01:08 +00:00
jrf 190b2e4c51 Replaced strncpy with strlcpy. Thanks to Peter Postma who
pointed them our in PR #25762. Approved by christos@NetBSD.org.
2004-09-07 13:20:39 +00:00
christos 111956c585 - sleep a little in autobot mode so that we can see what is happening.
- use refresh() instead of wrefresh()
2004-08-27 09:07:08 +00:00
christos 04c4e386f5 describe the algorithm better. 2004-08-27 09:06:25 +00:00
mjl d2da97557b Fix typo 2004-08-20 11:23:47 +00:00
wiz 2eabcd5e18 Grammar fix, from ray at raylai org via jmc@openbsd. 2004-06-01 10:10:06 +00:00
mjl 3cb55d86f4 Had fun with a spell checker.
Also, try to canonize attributions.
2004-05-22 14:33:50 +00:00
christos fc21964e2e - don't catch STOP, TSTP, QUIT; the first you cannot catch and the other two
you should not.
- don't accept delay == 1000, because it turns to 0 and fix the number parsing
- misc KNF cleanups.
2004-05-02 21:31:23 +00:00
simonb 9bc855a931 s/the the/the/ (only in sources that aren't regularly imported from
elsewhere).
2004-04-23 02:58:27 +00:00
he 9b1375ac78 Undef bool before including <curses.h>, since it tries to typedef
bool.  Otherwise we get (at least on gcc 2.95.3) an empty declaration
warning from "typedef char char;" due to the #define of bool in
phantstruct.h.
2004-04-11 13:35:06 +00:00
ross 9209ce5ad8 Rework to use curses.h only on the target, not on the host. 2004-04-07 17:46:47 +00:00
jdc f015cad4b7 If the current player has no cards, skip to the other player.
While we're here, make this compile with -DDEBUG.
Fixes PR bin/12530 from Thomas Klausner.
2004-04-06 19:15:07 +00:00
hubertf 6162c9b1a1 Properly handle -d 1000, OK'd by jsm 2004-03-29 20:30:03 +00:00
snj e2462f3ddb It's "its". 2004-03-29 07:59:39 +00:00
snj a7b3f75db2 Spell "political" correctly and capitalize a last name. 2004-03-29 02:00:41 +00:00
snj 3eaff3a9c8 s/feal/feel/ 2004-03-28 22:43:03 +00:00
snj f1710feaa1 s/venomenous/venomous/ 2004-03-28 22:42:39 +00:00
wiz dc4cc98b15 becuase -> because. From Peter Postma. 2004-02-24 15:05:53 +00:00
jsm 1775f4fec6 Encode and decode more characters. Don't put commas after every
character.  Don't encode whitespace as "...".  Don't fail decoding
across a 1024-byte boundary.  Mark end of message appropriately.  From
OpenBSD but with punctuation taken from ITU-T Recommendation F.1
(03/98).
2004-02-13 23:16:11 +00:00
wiz d20841bb64 Uppercase CPU, plural is CPUs. 2004-02-13 11:36:08 +00:00
wiz 83a837b7df |fmt; add single quotes around a plus. 2004-02-09 23:25:47 +00:00
jsm 10b61a7cca Mark unused parameters, nonreturning functions and format functions in
the few cases not already marked.
2004-02-08 22:23:50 +00:00
jsm a12bf9a7e0 Hide the cursor if possible. From OpenBSD. 2004-02-08 22:21:57 +00:00
lukem 34fb5c1494 Fix race in parallel make when creating multiple targets in one operation. 2004-02-08 22:14:27 +00:00
jsm 4eccb08bd5 Separate primes manpage from that of factor. Correct DIAGNOSTICS
information.
2004-02-08 13:16:25 +00:00
jsm 4eec310a4f Check large factor for being prime before applying Pollard's
algorithm; fixes "factor 2147483647111311".  Correct comment;
algorithm is Pollard p-1, not Pollard rho.  Increase base if p-1
algorithm reaches 1; fixes "factor 99999999999991".  Testcases from
David A Bagley <bagleyd@tux.org>.
2004-02-08 11:47:36 +00:00
jsm 859993b44f Control -d by #ifdef DEBUG; adjust usage message accordingly. Bug
reported by Malcolm Parsons <malcolm@ivywell.screaming.net> in Debian
bug 84852.
2004-02-08 00:33:31 +00:00
jsm 5c6ba47786 Use standard C abs function rather than local macro. 2004-02-08 00:32:48 +00:00
jsm d035cfe33e Mark variables changed between setjmp and longjmp as volatile rather
than just taking their addresses.
2004-02-08 00:32:07 +00:00
jsm e7d3d51380 Fix grammar (bug reported by Thomas Bushnell BSG <tb@MIT.EDU> in
Debian bug 61846).
2004-02-08 00:31:16 +00:00
jsm cb5fd8342e Remove uses of __P. 2004-01-27 20:30:28 +00:00
jsm 716c7169f3 Include <sys/stat.h>. 2004-01-27 20:27:59 +00:00
jsm 8f5e2162b1 Include <sys/types.h>. 2004-01-27 20:27:29 +00:00
jsm d91509309a Include <sys/endian.h>. 2004-01-27 20:26:55 +00:00
jsm 0752e03df7 Include <limits.h> instead of <machine/limits.h>. 2004-01-27 20:26:20 +00:00
jsm 514bad17d7 Include <sys/endian.h>. 2004-01-27 20:25:48 +00:00
jsm b974cbaba0 Include <sys/endian.h> instead of <machine/endian.h>. Include
<stdlib.h>.
2004-01-27 20:25:07 +00:00
jsm a3b9fbcc3a Include <sys/endian.h>. 2004-01-27 20:24:32 +00:00
jsm a5f914a25a Use int for wait status. 2004-01-27 20:23:36 +00:00
jsm 1a8a5d7903 Rename yn to yncoms to avoid conflict with GCC 3.4 built-in XSI
function.
2004-01-26 09:59:36 +00:00
jsm d8c5384694 Rename rint to receive_intr to avoid conflict with GCC 3.4 built-in C99
function.
2004-01-26 09:58:35 +00:00