Commit Graph

26 Commits

Author SHA1 Message Date
Ed Schouten
3b9fe1e175 Add static keywords to variables and functions where possible in games/.
This allows us to detect unused functions and variables and allows the
compiler to do a better job at optimisation.
2011-11-05 07:18:53 +00:00
Ulrich Spörlein
ec2368eb92 grdc(6): de-obfuscate the timekeeping of now/delay
- 'now' only contains current time readings
- delay is only used as parameter to nanosleep
- prev_sec contains the time_t of the previous loop iteration

Submitted by:	bde
MFC after:	2 weeks
2010-08-03 20:56:23 +00:00
Ulrich Spörlein
1c9d5fc21b grdc(6): Partial backout of r210755
The previous revision was flawed in numerous ways:
- the if condition would depend on garbage stack values
- grdc(6) would loop n times, not n seconds. This only makes
  a difference if it takes more than 1 second to recalculate/redraw
  the display.
- style(9) violations

The following change adds argument checking and tracks the elapsed time
between loops explicitly and will exit after roughly n seconds.

While here sort headers and remove bogus #ifndef

Submitted by:	bde
MFC after:	2 weeks
2010-08-03 16:02:57 +00:00
Ulrich Spörlein
de1070d4d8 grdc(6): fix timekeeping for user-supplied value n
- Keep timespec 'now' and 'delay' separate to avoid confusion
- Increase user-supplied n to run _at least_ n seconds, not max n

PR:            bin/149130 (based on)
Submitted by:  Andy Farkas
MFC after:     2 weeks
2010-08-02 12:15:22 +00:00
Ulrich Spörlein
f6a71b56a1 games: make WARNS=6 the default, remove overrides
This also bumps factor, fortune, primes, and random to WARNS=6.

Approved by:	ed (Co-mentor)
2010-02-15 14:32:00 +00:00
Ulrich Spörlein
72cb6052bd grdc(6) make WARNS=6 clean and bump accordingly
Approved by:		ed (Co-mentor)
2010-02-15 14:30:37 +00:00
Xin LI
eb1930d3f2 Improve time precision for grdc(6):
Traditionally, grdc would obtain time through time(3) which in turn gets
only the second part of clock (CLOCK_SECOND), and sleep for 1 second after
each screen refresh.

This approach would have two problems.  First, we are not guaranteed to
be waken up at the beginning of a whole second, which will typically
exhibit as a "lag" on second number.  Second, because we sleep for whole
second, and the refresh process would take some time, the error would
accumulate from time to time, making the lag variable.

Make grdc(6) to use time(3) to get time only at the beginning, and sample
time in CLOCK_REALTIME_FAST granularity after refreshing, and use the
nanosecond part to caculate how much time we want to sleep.

PR:		bin/120813
MFC after:	1 month
2010-02-10 18:20:20 +00:00
Will Andrews
17527010e2 Handle 12-hour clocks properly: when the time is 00:00-00:59, adjust the
hour to 12 so the time reads "12:00-12:59 AM".
2003-06-23 16:01:11 +00:00
Ruslan Ermilov
c8d3a56cb8 mdoc(7) police: Make SYNOPSIS match usage().
Approved by:	re (blanket)
2003-05-16 21:27:23 +00:00
Maxime Henrion
37087753b2 Add an option to print the time in 12-hour format.
Submitted by:	Samy Al Bahra <samy@kerneled.com>
2003-03-28 16:37:45 +00:00
Ruslan Ermilov
051bb54bd3 mdoc(7) police: Added the missing .Os call; it's not strictly
necessary nowadays, but is documented as "required", and may
become so again in the future.

Approved by:	re
2002-12-11 15:55:29 +00:00
Ruslan Ermilov
fb2473d217 - Only use sig_atomic_t objects in signal handlers.
- Use getopt() to parse command line.
- Add usage().
- WARNSify.
- Convert manpage to mdoc(7).

PR:		bin/30641
Submitted by:	Andrey Simonenko <simon@simon.org.ua>, ru
MFC after:	1 week
2001-09-25 13:45:46 +00:00
Ruslan Ermilov
e5b5c66bca - Backout botched attempt to intoduce MANSECT feature.
- MAN[1-9] -> MAN.
2001-03-26 14:22:12 +00:00
Ruslan Ermilov
1c011f20f6 Set the default manual section for games/ to 6. 2001-03-20 18:08:43 +00:00
Andrey A. Chernov
ca6d811ee5 Remove unneded -ltermcap or -lmytinfo 2000-09-16 03:52:06 +00:00
Bill Fumerola
8828590563 -Wall fixes. 1999-12-12 03:04:17 +00:00
Brian Feldman
22f0eae8c8 Add curs_set(0) to get rid of that annoying cursor. I also have to evilly
add $FreeBSD$ so I can commit this.
1999-09-18 03:59:33 +00:00
Peter Wemm
9b7a44a60e $Id$ -> $FreeBSD$ 1999-08-27 23:37:10 +00:00
John Birrell
4af1e600d9 Change long variable to time_t where it is passed to time() by reference. 1998-05-09 11:31:20 +00:00
Andrey A. Chernov
fafd0d1b39 Remove so-called revoke, this game not installed sguid 1997-09-01 11:31:56 +00:00
Eivind Eklund
34a13bf4cb Change games from setuid games to setgid games.
Reviewed by:	maybe@yes.no
Obtained from:	OpenBSD (mostly deraadt@openbsd.org)
1997-09-01 00:34:51 +00:00
Peter Wemm
a794df83c5 Revert $FreeBSD$ to $Id$ 1997-02-22 14:46:58 +00:00
Jordan K. Hubbard
1130b656e5 Make the long-awaited change from $Id$ to $FreeBSD$
This will make a number of things easier in the future, as well as (finally!)
avoiding the Id-smashing problem which has plagued developers for so long.

Boy, I'm glad we're not using sup anymore.  This update would have been
insane otherwise.
1997-01-14 07:20:47 +00:00
Rodney W. Grimes
010f5413b5 Remove trailing whitespace. 1995-05-30 03:37:36 +00:00
Andrey A. Chernov
b32baf3440 gdc -> grdc 1994-12-05 19:30:00 +00:00
Andrey A. Chernov
20c778875d Re-import with new name, old name conflicts with gated 1994-12-04 21:51:19 +00:00