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@.
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@
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@
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
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
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
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
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
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@
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@
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
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@
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@
- 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
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@
- Replace hardcoded program string by getprogname(3)
- Remove '?' from getopt(3)'s switch default case (but still keep 'h')
OK tb@ after his suggestions
- 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!
- 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
- 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@
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.
, 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
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
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@
- 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@
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@
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@
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@
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@
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@