summaryrefslogtreecommitdiff
path: root/games
AgeCommit message (Collapse)Author
2017-04-08snprintf() format string should be literalGleydson Soares
avoid compiler silly warnings sure deraadt@
2017-04-08format string is better be literalGleydson Soares
OK deraadt
2017-01-21Nuke whitespace foolish enough to expose itself during the greatKenneth R Westerback
"warning:" rectification.
2017-01-20In "%.*s" the * takes (int). gcc whines if you try to use the resultKenneth R Westerback
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-20mark the prototypes of tutor() and leave() as __dead as well.Theo Buehler
ok guenther, krw
2017-01-20Mark functions that do not return as __dead to quiet gcc warnings.Kenneth R Westerback
ok beck@
2017-01-20Nuke some excess whitespace.Kenneth R Westerback
2016-12-25gcc says "if you define labels and don't use them, I will whine."Kenneth R Westerback
ok tom@
2016-12-21Eliminate another 'calculated, not used' warning by nuking a spuriousKenneth R Westerback
dereference. Same change made in NetBSD in 1997. ok tb@ millert@ tom@
2016-12-03elements 113, 115, 117, and 118; from pjanzenJason McIntyre
2016-12-01Remove useless #ifndef in atc(6) and pom(6).Frederic Cambus
M_PI is always defined, so we can drop those directives. OK deraadt@, millert@
2016-11-05spelling fix from eric van gyzen, freebsd r308293;Jason McIntyre
2016-09-12If boardspec doesn't consist entirely of lower case letters, there will beTheo Buehler
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-12fix init, from randy hartman; ok tb@Otto Moerbeek
2016-09-11Callers of time(3) should #include <time.h>.Theo Buehler
ok deraadt
2016-09-11KNF: Break an overlong line. No binary change.Theo Buehler
2016-09-09These games have been broken for the better part of a year, ever sinceTheo Buehler
their setgid bits got removed. Mark them as such in their manuals. ok deraadt, help with wording jmc
2016-09-02Make build deterministic by not randomizing the datfiles themselves,Theo Buehler
random lines are selected on output and that's enough. From daniel, ok tb
2016-09-01In 32 bits sqrt(val) + 1 can overflow, so some big primes stillTheo Buehler
aren't recognized as such, for example 18446744073709551577 given in the commit message of factor.c r1.7 from NetBSD. Move the return type of usqrt() from u_int32_t to u_int64_t. ok guenther, tom, otto
2016-08-31Fix a bogus comment: "factors of" -> "coprime to". Replace theTheo Buehler
nonsensical "if and only iff" with "if and only if" and zap some trailing whitespace.
2016-08-27the quotes in "unkempt thoughts" were authored by stanislaw lec,Jason McIntyre
not stanislaw lem (an easy blunder, i'd say); i've also inserted the "J." into one of these credits (Stanislaw J. Lec) since all the others have them; credit to antoni grzymala; diff pockled from netbsd
2016-08-27Pull in <stdio.h> for NULLPhilip Guenther
ok deraadt@
2016-08-27Pull in <sys/select.h> for fd_setPhilip Guenther
Pull in <time.h> for time() ok deraadt@
2016-08-27Pull in <sys/select.h> for fd_setPhilip Guenther
ok deraadt@
2016-08-27Pull in <sys/time.h> for struct timespec, gettimeofday(), clock_gettime(),Philip Guenther
and setitimer() ok deraadt@
2016-08-27Pull in <time.h> for time() and perhaps other functionsPhilip Guenther
ok deraadt@
2016-08-14Convert remaining calls to strtoq/strtouq in base with strtoll/strtoull.Philip Guenther
Fix a type mismatch in ftp's "page" command and could make transfers restart at the wrong position. ok and a ull->ll tweak from natano@, ok tedu@
2016-07-11Instead of using the floating point square root, use an integer versionTheo Buehler
of the Newton method from ping.c. Fixes a rounding issue that caused failure to factor numbers close to 2^64, e.g. 18446744030759878681. While there, fix an off by one error that caused 4295360521 to be reported as a prime. Issues reported by Paul Stoeber and Michael Bozon. ok tedu, deraadt
2016-06-10Clean up gcc -Wshadow warnings: 'numnames' is public in <term.h>.Theo Buehler
'i' shadows the local loop indexing variable of scr_update(), so no need to rename it. No binary change on amd64. ok millert
2016-06-10When eliding a row, clear the invisible row zero, so that no columnsTheo Buehler
can become unusable during game play. Same fix was made in NetBSD's tetris.c -r1.31 by Christos Zoulas almost exactly a year ago. ok tedu
2016-03-30for some time now mandoc has not required MLINKS to functionJason McIntyre
correctly - logically complete that now by removing MLINKS from base; authors need only to ensure there is an entry in NAME for any function/ util being added. MLINKS will still work, and remain for perl to ease upgrades; ok nicm (curses) bcook (ssl) ok schwarze, who provided a lot of feedback and assistance ok tb natano jung
2016-03-28remove unused variablesCharles Longeau
ok millert@
2016-03-21Instead of creating a socket with socket() or accept() and thenPhilip Guenther
setting the O_NONBLOCK flag on it with fcntl(F_SETFL) afterwards, just pass SOCK_NONBLOCK to socket() or accept4() and get it right to begin with. ok millert@ krw@ beck@ deraadt@ jca@
2016-03-16Prefer fseek(3) over rewind(3) since the latter although it also calls fseekmestre
then additionally it calls clearerr(3) deliberately but we want to catch any error that may happen and this way we couldn't catch it OK tb@
2016-03-15execl(3) calls must have the last argument casted to (char *)NULLmestre
At the time when this was commited me and tb@ discussed that it shouldn't be changed, but still snucked in within a larger diff that we didn't notice. OK tb@
2016-03-08- ranf() and franf() are prototyped on trek.h but ranf.c doesn't include it somestre
do it - Replace random() >> 5 by only random(): this was discussed a few months ago and naddy@ said at the time "Those games were originally written with the rand(3) function. The lower bits returned by rand(3) suffered from notoriously poor randomness, so this idiom developed where people would use the higher, more random bits." OK tb@ after his remarks
2016-03-08Headers cleanup with and OK tb@mestre
This was prompted by an initial patch sent by Edgar Pettijohn <edgar ! pettijohn-web.com> but the actual commit is different
2016-03-07eliminate do_malloc() and do_free().tb
These are wrappers for malloc(3) and free(3) with NULL checks. do_free() is pointless since free() already checks for NULL. do_malloc() is used only three times, once asprintf(3) seems more appropriate, and for just two calls the benefit of a custom wrapper is minimal. ok millert@
2016-03-07Remove unused fields posfile and was_pos_file from FILEDESC andtb
simplify is_fortfile() accordingly. The last use of them was guarded by OK_TO_WRITE_DISK, which was unifdef'ed in revision 1.43 last fall. tweak + ok mestre@
2016-03-07remove -u? from usage();Jason McIntyre
2016-03-07- General changes:mestre
- Remove -? from getopt(3) options, but still keep (or add) -h where applicable - Replace hardcoded program strings by getprogname(3) - Specific changes: - atc(6): this used -? and -u for usage(), remove both from game and manpage - bcd(6): use __progname instead of getprogname(3), no need to include stdlib.h - hunt(6): replace fputs(3) by fprintf(3) OK tb@ after his suggestions
2016-03-05Convert a hand-rolled strtonum to a call to strtonum(3). This preventstb
integer overflow on bogus input and bizarre error messages. Moreover, fortune files can now be named anything except names matching the regex ^[0-9][0-9.]*%$ ok mestre@
2016-03-05KNF: wrap three overly long lines. No binary change.tb
2016-03-04- Convert atoi(3) to strtonum(3)mestre
- Replace hardcoded program string by getprogname(3) - Remove '?' from getopt(3)'s switch default case (but still keep 'h') OK tb@ after his suggestions
2016-03-02Fix score file nameTim van der Molen
2016-02-28Add back undocumented -h switch defaulting to usage().tb
pjanzen@ correctly pointed out that a majority of games do this, so no need to deviate here.
2016-02-27Untangle a mess of nested ternary operators.tb
ok mestre@
2016-02-26- Remove -h and -? from getopt(3), they weren't documented on manpage anywaymestre
- Replace hardcoded string "hangman" by getprogname(3) OK tb@
2016-02-26- Convert atoi(3) to strtonum(3)mestre
- Remove lint-style comment - Remove usage() since errors are now more informative (the usage is still available in the manpage) With this diff I made it accept 0 as rotation whereas before it didn't, but alas if you use 0 then it defeats the whole purpose of the game. Initial diff sent by Peter Williams <peterbw at gmail.com>, tweaked by me and several hints and OK by tb@. I'm in desperate need of a coffee, thank you tb@ for making me notice that!
2016-02-09- Remove parameter fd from snscore() since it's never usedmestre
- And while here, fwrite(3) returns size_t whereas nscores is an int, so cast nscores to u_int. This is a false positive, but silences a compiler warning with -Wextra -pedantic tb@ : "Looks ok to me" after suggestion from him