Fix format string warning in robots/score.c
userspace: remove vestigial '?' cases from top-level getopt(3) loopsgetopt(3) returns '?' when it encounters a flag not present in the inthe optstring or if a flag is missing its option argument.
userspace: remove vestigial '?' cases from top-level getopt(3) loopsgetopt(3) returns '?' when it encounters a flag not present in the inthe optstring or if a flag is missing its option argument. We canhandle this case with the "default" failure case with no loss oflegibility. Hence, remove all the redundant "case '?':" lines.Prompted by dlg@. With help from dlg@ and millert@.Link: https://marc.info/?l=openbsd-tech&m=167011979726449&w=2ok naddy@ millert@ dlg@
show more ...
if both stdout and stderr are redirected to a non-tty, pledge(2) will killncurses applications, e.g.:/usr/games/worms 2>&1 | catsolve this by only calling pledge(2) after initscr(3) is set and d
if both stdout and stderr are redirected to a non-tty, pledge(2) will killncurses applications, e.g.:/usr/games/worms 2>&1 | catsolve this by only calling pledge(2) after initscr(3) is set and done, orwhatever function that calls it. since pledge(2) is called later now thepromises might be reduced, but this a diff for another day.found by naddy@ almost a year ago, discussed with him deraadt@ and tb@ok tb@
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
When system calls indicate an error they return -1, not some arbitraryvalue < 0. errno is only updated in this case. Change all (most?)callers of syscalls to follow this better, and let's see if
When system calls indicate an error they return -1, not some arbitraryvalue < 0. errno is only updated in this case. Change all (most?)callers of syscalls to follow this better, and let's see if this strictnesshelps us in the future.
g/c unused robots_roll file.From Randy Hartman
reduce pledge(2) to "stdio tty" after ncurses initialization. robots(6) uses ascorefile nevertheless an fd is opened way in advance and therefore we candisable any further access to the filesystem.
reduce pledge(2) to "stdio tty" after ncurses initialization. robots(6) uses ascorefile nevertheless an fd is opened way in advance and therefore we candisable any further access to the filesystem.OK tb@
remove some escapes that are unnecessary/harmful. ok jmc schwarze
remove unused macro
there are no bugs; i fixed them
if your dying scream would escape the death field, realign to stay within
high scores printed too far to the right, move it left a little
Pull in <sys/time.h> for struct timespec, gettimeofday(), clock_gettime(),and setitimer()ok deraadt@
- 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 -? an
- 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
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-decl
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 timediscussed with and ok mestre@
More cleanup and sorting on header sectionOK tb@ and he also pointed out that for consistency with rest of the tree weshould include termios.h instead of sys/ttydefaults.h, where applicable
Set as __dead a few more functions, that don't return, on games/With precious tip, help and also OK from tb@
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
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@
put FILES into a similar format as ENVIRONMENT;
Drop pledge("getpw") and pwd.h and use the now usualLOGNAME -> USER -> getlogin() -> ??? fallbackin the score file, as requested by tedu@Man page bits adapted from jmc@'s tweaks to snake.6
Move scorefile to $HOME. The nice implementation of the score filedepends on getpwuid(), so add "getpw" to the rest of the requiredpledges: "stdio rpath wpath cpath tty".
In 1995, all of the games were setuid games. At end of 1996, I took them allto setgid games, and we started wittling them down. Nearly 10 years later Iam removing all setgid from the games. If a
In 1995, all of the games were setuid games. At end of 1996, I took them allto setgid games, and we started wittling them down. Nearly 10 years later Iam removing all setgid from the games. If any of these have score files theyare now broken, and I hope various folk repair them. I have argued for years(and received pushback...) that the score file features must be removed, orrewritten to use private files, because setgid is the wrong tool.ok tedu
Improve robots(6) by using timespec*() functions, replacing gettimeofday()with clock_gettime(MONOTONIC) to avoid clock changes and replacing poll()with ppoll() to deal better with timespec.ok gue
Improve robots(6) by using timespec*() functions, replacing gettimeofday()with clock_gettime(MONOTONIC) to avoid clock changes and replacing poll()with ppoll() to deal better with timespec.ok guenther@.
Eliminate pointless use of <sys/param.h>, <sys/file.h>, <sys/sockio.h>, and <sys/ttydefaults.h>Replace MAXPATHLEN with PATH_MAX and MAXLOGNAME with LOGIN_NAME_MAXPull in <limits.h> where needed
Eliminate pointless use of <sys/param.h>, <sys/file.h>, <sys/sockio.h>, and <sys/ttydefaults.h>Replace MAXPATHLEN with PATH_MAX and MAXLOGNAME with LOGIN_NAME_MAXPull in <limits.h> where neededPrefer sizeof(var) over MAXFOO or FOO_MAXok deraadt@
select() to poll() conversionsok tedu (... other games maintainer absent)
123