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
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
otto
1456f860f6 fix init, from randy hartman; ok tb@ 2016-09-12 14:38:58 +00:00
tb
ee7acb09aa Callers of time(3) should #include <time.h>.
ok deraadt
2016-09-11 14:21:17 +00:00
tb
3a9c9be680 KNF: Break an overlong line. No binary change. 2016-09-11 09:32:47 +00:00
tb
e5fbd3ce79 These games have been broken for the better part of a year, ever since
their setgid bits got removed.  Mark them as such in their manuals.

ok deraadt, help with wording jmc
2016-09-09 15:32:28 +00:00
tb
24605cc5b9 Make build deterministic by not randomizing the datfiles themselves,
random lines are selected on output and that's enough.

From daniel, ok tb
2016-09-02 11:55:24 +00:00
tb
2fde6ebb66 In 32 bits sqrt(val) + 1 can overflow, so some big primes still
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-09-01 10:48:38 +00:00
tb
d496e19d11 Fix a bogus comment: "factors of" -> "coprime to". Replace the
nonsensical "if and only iff" with "if and only if" and zap some
trailing whitespace.
2016-08-31 04:48:43 +00:00
jmc
f29510d43f the quotes in "unkempt thoughts" were authored by stanislaw lec,
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-27 14:29:22 +00:00
guenther
ab29a6f472 Pull in <stdio.h> for NULL
ok deraadt@
2016-08-27 03:34:45 +00:00
guenther
ba202854ff Pull in <sys/select.h> for fd_set
Pull in <time.h> for time()

ok deraadt@
2016-08-27 02:11:27 +00:00
guenther
e29f8a1b72 Pull in <sys/select.h> for fd_set
ok deraadt@
2016-08-27 02:06:40 +00:00
guenther
79af1000e6 Pull in <sys/time.h> for struct timespec, gettimeofday(), clock_gettime(),
and setitimer()

ok deraadt@
2016-08-27 02:02:44 +00:00
guenther
1614e62e07 Pull in <time.h> for time() and perhaps other functions
ok deraadt@
2016-08-27 02:00:10 +00:00
guenther
f5cc6d1c3e Convert remaining calls to strtoq/strtouq in base with strtoll/strtoull.
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-08-14 18:34:48 +00:00
tb
62b9314c61 Instead of using the floating point square root, use an integer version
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-07-11 18:30:21 +00:00
tb
8513344057 Clean up gcc -Wshadow warnings: 'numnames' is public in <term.h>.
'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-10 15:37:09 +00:00
tb
ca027646a6 When eliding a row, clear the invisible row zero, so that no columns
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-06-10 13:07:07 +00:00
jmc
faa33665ab for some time now mandoc has not required MLINKS to function
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-30 06:38:40 +00:00
chl
7c30af4852 remove unused variables
ok millert@
2016-03-28 11:49:45 +00:00
guenther
5f13b87e98 Instead of creating a socket with socket() or accept() and then
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-21 00:49:36 +00:00
mestre
45555366a8 Prefer fseek(3) over rewind(3) since the latter although it also calls fseek
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-16 15:00:35 +00:00
mestre
64f0fa1112 execl(3) calls must have the last argument casted to (char *)NULL
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-15 19:56:20 +00:00
mestre
7bda4eb305 - ranf() and franf() are prototyped on trek.h but ranf.c doesn't include it so
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-08 18:43:47 +00:00
mestre
400fe323ee Headers cleanup with and OK tb@
This was prompted by an initial patch sent by Edgar Pettijohn
<edgar ! pettijohn-web.com> but the actual commit is different
2016-03-08 10:48:39 +00:00
tb
187181395a eliminate do_malloc() and do_free().
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-07 22:49:45 +00:00
tb
6e9facee12 Remove unused fields posfile and was_pos_file from FILEDESC and
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-07 19:49:38 +00:00
jmc
4daa3df4a5 remove -u? from usage(); 2016-03-07 13:48:25 +00:00
mestre
6fa5e1da34 - General changes:
- 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-07 12:07:55 +00:00
tb
01623c91aa Convert a hand-rolled strtonum to a call to strtonum(3). This prevents
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-05 11:06:43 +00:00
tb
c47f841b47 KNF: wrap three overly long lines. No binary change. 2016-03-05 07:47:15 +00:00
mestre
11b125a3b6 - Convert atoi(3) to strtonum(3)
- 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-04 14:37:28 +00:00
tim
bd0a94d497 Fix score file name 2016-03-02 17:51:28 +00:00
tb
c14c4b255d Add back undocumented -h switch defaulting to usage().
pjanzen@ correctly pointed out that a majority of games do
this, so no need to deviate here.
2016-02-28 06:24:06 +00:00
tb
c313931887 Untangle a mess of nested ternary operators.
ok mestre@
2016-02-27 12:48:14 +00:00
mestre
8a3966029b - Remove -h and -? from getopt(3), they weren't documented on manpage anyway
- Replace hardcoded string "hangman" by getprogname(3)

OK tb@
2016-02-26 21:27:07 +00:00
mestre
dd8b6bb44a - Convert atoi(3) to strtonum(3)
- 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-26 12:10:49 +00:00
mestre
565945af99 - Remove parameter fd from snscore() since it's never used
- 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
2016-02-09 13:41:59 +00:00
mestre
e42da8bde8 - Swap atoi(3) for strtonum(3)
- Swap fputs(3) for fprintf(3)
- Use getprogname(3) instead of hardcoded string

OK and help from tb@
2016-02-02 19:18:57 +00:00
gsoares
b1512104e5 - optarg and optind are declared by unistd.h, so remove them...
- use strtonum rather than atoi
- zap case '?' in getopt(3) switch
- use _exit(2) in signal handler
- use __progname in usage() instead of hardcoded name

OK tb@ mestre@
2016-01-27 13:42:08 +00:00
mestre
ab0a4ae52b Remove unused header 2016-01-25 21:17:45 +00:00
sthen
fa195fe752 Teach morse(6) the <AC> prosign as '@', as added on May 24, 2004 (the
160th anniversary of the first public Morse telegraph transmission).

Support decoding (only; not encoding) of other prosigns, including <SK>
as we were previously using for '@'.  From pjanzen.
2016-01-19 23:21:26 +00:00
sthen
0de85c04ad There are now distinct codes for left and right parentheses.
Part of a diff that was ok tb@ abieber@ deraadt@
2016-01-18 11:27:19 +00:00
sthen
626e1189e8 Add a reference to the current ITU Morse code document.
Part of a diff that was ok abieber tb -.. . .-. .- .- -.. -;
other part being revised with pjanzen.
2016-01-18 11:24:44 +00:00
gsoares
21d5e03efd there's a resource leak here. missing a fclose(3) to kill the stream.
OK deraadt@ mestre@
2016-01-13 13:10:26 +00:00
mestre
8ae737b14e #ifdef QUEST then a few functions won't work, because of that include
<stdlib.h> if we are on a QUEST

OK tb@
2016-01-10 15:12:20 +00:00
mestre
7dd160a593 Remove needless casts to (char *) NULL. Some were kept, namely for execl(3)
last arguments since "The list of arguments must be terminated by a null
null pointer" of type char *

Suggested by and OK tb@
2016-01-10 14:10:38 +00:00
mestre
7e027cb7af As per style(9), remove remaining lint-style comments from games/
OK tb@
2016-01-10 13:35:09 +00:00
mestre
80cf6802c4 Remove unnecessary headers
OK tb@
2016-01-10 13:18:07 +00:00
mestre
6acf840eb1 Remove several casts to (char *) 0 and replace them by NULL
Prompted and OK by tb@
2016-01-09 21:54:11 +00:00
mestre
a685fffcd5 ANSIfy grammar.y on atc(6), all other files already are
OK tb@
2016-01-09 19:27:56 +00:00
mestre
aed906e4b2 This diff is rather large, but it's just simply removing unnecessary headers
, remove some lint-style comments, add missing void to functions without args,
also some function prototypes (extern) were missing their args, so I added them
as they were defined in hack.h

OK tb@ on separate diffs
2016-01-09 18:33:15 +00:00
mestre
5c1af24d78 ANSIfy gomoku(6) and change a char* to u_char*
OK tb@
2016-01-08 21:38:33 +00:00
mestre
747bd22203 ANSIfy sail(6) plus some cleanup
OK tb@
2016-01-08 20:26:33 +00:00
mestre
96822cf7b9 Headers clean up 2016-01-08 20:23:54 +00:00
mestre
44d3f3fb69 Remove unnecessary headers an sort 2016-01-08 20:19:06 +00:00
mestre
ab8b84f49d Straightforward headers cleanup 2016-01-08 20:15:15 +00:00
mestre
211c418389 ANSIfy monop(6)
OK tb@
2016-01-08 18:20:33 +00:00
mestre
91d732828b Headers cleanup and removal where suitable
OK tb@
2016-01-08 18:19:47 +00:00
mestre
56f9a7dc4a ANSIfy mille(6)
OK tb@
2016-01-08 18:09:59 +00:00
mestre
182ed36cc5 Headers cleanup and also the following:
mille.h:
#define CTRL locally, which is used by move.c and misc.c, to avoid including
termios.h or sys/ttydefaults.h where it's actually defined

varpush.c:
Change _PATH_DEVNULL to "/dev/null" since other systems may not have it defined
but also avoids including <paths.h>

Included a few sugestions from tb@ who also gave his OK
2016-01-08 18:05:58 +00:00
tb
95d0ce2685 add missing 'void'
ok mestre@
2016-01-08 13:40:05 +00:00
tb
8a9ce47a2b Structural integrity hasn't improved in over twenty years.
ok mestre@
2016-01-08 13:33:42 +00:00
mestre
0f16a76c9f ANSIfy hunt(6)
Note: casted 2 args to struct sockaddr * on list.c to shut off compiler
warnings, and also changed an int len to socklen_t since recvfrom(2) receives
the last argument as the latter.

I'm running out of credits, but this was once again with great help and OK from
tb@
2016-01-07 21:37:53 +00:00
mestre
9ef4854330 Headers cleanup and sorting
OK tb@
2016-01-07 21:29:31 +00:00
millert
7146b7ce3e hack expects to be able to read ^Z as a normal character so disable
SUSP in the termios settings.  Presumably this is how things worked
before the conversion to termios.  Fixes suspend/resume in hack.
2016-01-07 18:25:52 +00:00
tb
17641e3181 Some basic code maintenance in games/
- in main() replace exit with return
- drop some /* NOTREACHED */ lint comments along the way.
- make more use of standard CFLAGS, esp. -Wimplicit-function-declaration
- add and sort some headers when needed
- add straightforward pledges to some programs used at compile time

discussed with and ok mestre@
2016-01-07 16:00:31 +00:00
mestre
11da2480c6 ANSIfy trek(6)
Note: Binary change is introduced due to function schedule() where its args are
(int,double,char,char,char), but on trek.h are (int,double,int,int,int). Changed
to the latter since the 3 last args are coordinates.

OK tb@
2016-01-07 14:37:51 +00:00
mestre
48b4d137c7 Remove unnecessary headers and sort the remaining alphabetically
OK tb@
2016-01-07 14:30:32 +00:00
mestre
d39a14bb10 Forgot to remove this file on my previous commit 2016-01-06 14:32:14 +00:00
mestre
010ae45bb5 Remove unnecessary header files from phantasia(6)
Lesson learnt: don't include an header sorted alphabetically just because. The
external definition of variables was done on phantglobs.h but their declaration
was on phantstruct.h and therefore the latter must be included before the
former. It's easier to just include phantstruct.h inside phantglobs.h since it
always need it.

With help and OK from tb@
2016-01-06 14:28:09 +00:00
tb
85d02bc06c ansify
ok mestre@
2016-01-06 10:28:38 +00:00
tb
6b45e2a858 Last step of ansification of phantasia:
Convert function() to function(void).

ok mestre@
2016-01-06 09:43:26 +00:00
tb
f0d3161e56 Ansify the bulk of phantasia. No binary change on amd64. Based
on an older diff by mestre.

ok mestre@
2016-01-06 09:39:51 +00:00
tb
d973fa72ce Ansify map.c.
ok mestre@
2016-01-06 09:29:34 +00:00
tb
65e3e2c50a Use return instead of exit from main.
ok mestre@
2016-01-06 09:24:38 +00:00
mestre
2010f3c835 More cleanup and sorting on header section
OK tb@ and he also pointed out that for consistency with rest of the tree we
should include termios.h instead of sys/ttydefaults.h, where applicable
2016-01-04 17:33:24 +00:00
mestre
bdf3894f0c More headers removal and sorted the remaining alphabetically.
Most noticeable that were removed are sys/types.h which will be included from
stdlib.h and in turn also brings along sys/cdefs.h. The other one is limits.h
that was used with the old idiom (denom * random() / LONG_MAX), although it was
only removed were applicable (some files still need that header).

OK tb@
2016-01-04 11:58:35 +00:00
mestre
9ea8ec706f About 13 years ago when the idiom srandom(time()), and sometimes
srandom(time()+getpid()), was changed by srandomdev(), but #include <time.h>
lived up until this day so remove it.

Additionally, earlier than that, 18 years ago, random(6) was one of the first
consumers of arc4random(3) family, and was pulling it from dev/rndvar.h but
these days we pull it from stdlib.h, which is already done, so while here
remove dev/rndvar.h also.

"seems comprehensive to me" deraadt@ and OK tb@
2016-01-03 14:38:16 +00:00
tedu
43a866b79e don't declar main. from Michal Mazurek 2016-01-01 15:56:03 +00:00
mestre
f741f25ef3 Include only needed header files per each source file
This one was also OK'ed by tb@
2015-12-31 18:10:19 +00:00
mestre
ea24c44aa7 Include only needed header files per each source file
OK tb@
2015-12-31 17:51:19 +00:00
mestre
0e3a25f04f Remove unused file
Alerted by tb@
2015-12-31 16:54:42 +00:00
mestre
2317ec67b0 Include only needed header files per each source file
OK tb@
2015-12-31 16:50:29 +00:00
mestre
39ac0be569 Include only needed header files per each source file
OK tb@
2015-12-31 16:44:21 +00:00
mestre
5122c2800b Include only needed header files per each source file
With help and OK from tb@
2015-12-31 15:20:36 +00:00
tb
d9138424f2 Michal Mazurek pointed out on tech@ that the factor.6 manual needs a bit
of clarification.  Thus, express the description both more concisely and
more precisely.  Drop details about spaces in the output formatting.
While there, update the corresponding comment in the source code.

With input from jmc@ and mestre@; detailed discussion with sobrado@.

ok sobrado@
2015-12-30 14:07:53 +00:00
tb
3c9e3b93e0 Build most of games/ with -Werror-implicit-function-declaration.
Prompted by benno's addition of the flag to most of usr.sbin/.

ok benno@
2015-12-28 20:55:55 +00:00
jmc
a5227f0bfd update the us army democracy excerpt to more closely
match the format of the original;

from andre smagin
2015-12-28 12:32:12 +00:00
jmc
424c5ce6b8 andy finkel confimed himself as the originator of the rigged demo quote;
from netbsd pr 49451
2015-12-28 08:36:10 +00:00
chl
3fc7680a4e remove unused variables
ok mmcc@
2015-12-27 01:28:02 +00:00
chl
df06dc93d0 remove unused variable
ok tb@
2015-12-27 01:24:27 +00:00
mestre
7ad55f5581 Set as __dead a few more functions, that don't return, on games/
With precious tip, help and also OK from tb@
2015-12-26 00:26:39 +00:00
gsoares
d73a3bc6bc - use strtonum(3) instead of atoi(3)
- while here switch main() to return instead of exit(3), makes stack protector happy.

OK tb@
2015-12-25 23:41:43 +00:00
mestre
f0628b46ae Declare usage() functions as __dead void, if they don't return, on games section.
Found another one in arithmetic(6) which also didn't return, and removed a function from number(6) which is not used anymore.

OK tb@
2015-12-25 20:59:09 +00:00
mestre
cd84dbda79 Apply some more KNF to the declaration of functions, but keep style to the rest of code for now.
OK tb@
2015-12-25 03:20:57 +00:00
tb
15d5404dbf Function prototypes and a little bit of KNF.
Committing on behalf of mestre@ who has more to come.
2015-12-24 16:55:13 +00:00
tb
da03d969c4 KNF: add a missing space after an 'if'. 2015-12-18 18:47:56 +00:00
tb
466e81dfe1 Use __progname instead of hand-rolled parsing of argv[0].
Inspired by similar diffs by tobias@ and millert@.

"I like the concept" pjanzen@
ok tedu@
2015-12-16 14:21:50 +00:00
tb
48aa608063 Use __progname instead of hand-rolled parsing of argv[0].
Inspired by similar diffs by tobias@ and millert@.

"I like the concept" pjanzen@
ok tedu@
2015-12-16 14:16:27 +00:00
tb
6dd9349555 Cleanup: pwd.h is no longer needed. 2015-12-15 18:40:54 +00:00