OpenBSD CVS

CVS log for src/games/grdc/grdc.c


[BACK] Up to [local] / src / games / grdc

Request diff between arbitrary revisions


Default branch: MAIN


Revision 1.37 / (download) - annotate - [select for diffs], Tue Sep 27 03:01:42 2022 UTC (20 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_7_5_BASE, OPENBSD_7_5, OPENBSD_7_4_BASE, OPENBSD_7_4, OPENBSD_7_3_BASE, OPENBSD_7_3, HEAD
Changes since 1.36: +2 -2 lines
Diff to previous 1.36 (colored)

typing ^C and seeing "terminated by signal %d" is so ... I don't
have the words
ok florian

Revision 1.36 / (download) - annotate - [select for diffs], Sat Sep 24 16:07:26 2022 UTC (20 months, 1 week ago) by florian
Branch: MAIN
CVS Tags: OPENBSD_7_2_BASE, OPENBSD_7_2
Changes since 1.35: +24 -7 lines
Diff to previous 1.35 (colored)

There are time zones that have minute offsets, display those
correctly. Pointed out by pjanzen@.
To display the offset, use ISO 8601, as suggested by David Goerger.

While here check if tm->tm_gmtoff changed which probably means that we
moved in or out of daylight savings time.

Input & OK millert, deraadt

Revision 1.35 / (download) - annotate - [select for diffs], Sat Sep 17 10:32:05 2022 UTC (20 months, 2 weeks ago) by florian
Branch: MAIN
Changes since 1.34: +20 -11 lines
Diff to previous 1.34 (colored)

Show time zone name and offset in clock border if TZ environment
variable is set. This is useful when running multiple clocks in
different time zones.
From James Russell Stickney (jrs AT outband.net), tweaked by me.
Input & OK kn

Revision 1.34 / (download) - annotate - [select for diffs], Sat Oct 23 11:22:49 2021 UTC (2 years, 7 months ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_7_1_BASE, OPENBSD_7_1
Changes since 1.33: +1 -4 lines
Diff to previous 1.33 (colored)

if both stdout and stderr are redirected to a non-tty, pledge(2) will kill
ncurses applications, e.g.:

/usr/games/worms 2>&1 | cat

solve this by only calling pledge(2) after initscr(3) is set and done, or
whatever function that calls it. since pledge(2) is called later now the
promises 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@

Revision 1.33 / (download) - annotate - [select for diffs], Sat Jun 6 17:03:16 2020 UTC (3 years, 11 months ago) by cheloha
Branch: MAIN
CVS Tags: OPENBSD_7_0_BASE, OPENBSD_7_0, OPENBSD_6_9_BASE, OPENBSD_6_9, OPENBSD_6_8_BASE, OPENBSD_6_8
Changes since 1.32: +18 -11 lines
Diff to previous 1.32 (colored)

grdc(6): implement timeout with alarm(3)

grdc(6) has an optional argument indicating a timeout in seconds.
For example, one could do:

	$ grdc 60

to to tell grdc(6) to run for sixty seconds and then exit gracefully.

As implemented, however, the timeout may occur too early or too late
if the system clock is reset with settimeofday(2).

To avoid this problem we can instead use alarm(3) and a signal handler
to implement the timeout.  alarm(3) is unaffected by settimeofday(2).

Revision 1.32 / (download) - annotate - [select for diffs], Sat Jun 6 13:21:40 2020 UTC (3 years, 11 months ago) by cheloha
Branch: MAIN
Changes since 1.31: +48 -47 lines
Diff to previous 1.31 (colored)

grdc(6): miscellaneous style(9)

- Sort includes alphabetically
- Sort function prototypes alphabetically
- Add missing whitespace after commas
- Remove extra whitespace after commas
- Add missing whitespace between binary operators
- Add missing whitespace between reserved words and parens, i.e. fix "if("
- Add missing __dead to usage() definition

Revision 1.31 / (download) - annotate - [select for diffs], Fri Jun 28 13:32:52 2019 UTC (4 years, 11 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_6_7_BASE, OPENBSD_6_7, OPENBSD_6_6_BASE, OPENBSD_6_6
Changes since 1.30: +2 -2 lines
Diff to previous 1.30 (colored)

When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.

Revision 1.30 / (download) - annotate - [select for diffs], Sun Jan 6 18:27:14 2019 UTC (5 years, 4 months ago) by tedu
Branch: MAIN
CVS Tags: OPENBSD_6_5_BASE, OPENBSD_6_5
Changes since 1.29: +17 -3 lines
Diff to previous 1.29 (colored)

allow q to exit the program.
ok cheloha deraadt schwarze

Revision 1.29 / (download) - annotate - [select for diffs], Thu Aug 23 06:25:01 2018 UTC (5 years, 9 months ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_6_4_BASE, OPENBSD_6_4
Changes since 1.28: +4 -1 lines
Diff to previous 1.28 (colored)

reduce pledge(2) to "stdio tty" after ncurses initialization.

OK tb@

Revision 1.28 / (download) - annotate - [select for diffs], Mon Dec 11 23:33:44 2017 UTC (6 years, 5 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_6_3_BASE, OPENBSD_6_3
Changes since 1.27: +8 -11 lines
Diff to previous 1.27 (colored)

The code can be simplified by using clock_gettime(2)'s CLOCK_REALTIME
instead of gettimeofday(2).

From Scott Cheloha, ok jca

Revision 1.27 / (download) - annotate - [select for diffs], Thu Jul 13 02:57:52 2017 UTC (6 years, 10 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_6_2_BASE, OPENBSD_6_2
Changes since 1.26: +3 -5 lines
Diff to previous 1.26 (colored)

Convert fprintf(stderr, ...) to errx/warnx (with slight change of output).

From Scott Cheloha

Revision 1.26 / (download) - annotate - [select for diffs], Mon Mar 7 12:07:56 2016 UTC (8 years, 2 months ago) by mestre
Branch: MAIN
CVS Tags: OPENBSD_6_1_BASE, OPENBSD_6_1, OPENBSD_6_0_BASE, OPENBSD_6_0
Changes since 1.25: +4 -4 lines
Diff to previous 1.25 (colored)

- 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

Revision 1.25 / (download) - annotate - [select for diffs], Thu Jan 7 16:00:32 2016 UTC (8 years, 4 months ago) by tb
Branch: MAIN
CVS Tags: OPENBSD_5_9_BASE, OPENBSD_5_9
Changes since 1.24: +3 -3 lines
Diff to previous 1.24 (colored)

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@

Revision 1.24 / (download) - annotate - [select for diffs], Mon Jan 4 17:33:24 2016 UTC (8 years, 4 months ago) by mestre
Branch: MAIN
Changes since 1.23: +2 -4 lines
Diff to previous 1.23 (colored)

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

Revision 1.23 / (download) - annotate - [select for diffs], Sun Jan 3 14:38:17 2016 UTC (8 years, 5 months ago) by mestre
Branch: MAIN
Changes since 1.22: +3 -3 lines
Diff to previous 1.22 (colored)

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@

Revision 1.22 / (download) - annotate - [select for diffs], Fri Dec 25 20:59:09 2015 UTC (8 years, 5 months ago) by mestre
Branch: MAIN
Changes since 1.21: +2 -2 lines
Diff to previous 1.21 (colored)

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@

Revision 1.21 / (download) - annotate - [select for diffs], Wed Dec 9 02:00:40 2015 UTC (8 years, 5 months ago) by jsg
Branch: MAIN
Changes since 1.20: +2 -1 lines
Diff to previous 1.20 (colored)

include err.h for err()

Revision 1.20 / (download) - annotate - [select for diffs], Mon Nov 30 08:46:07 2015 UTC (8 years, 6 months ago) by tb
Branch: MAIN
Changes since 1.19: +4 -1 lines
Diff to previous 1.19 (colored)

unspectacular pledge "stdio rpath tty" for grdc

Revision 1.19 / (download) - annotate - [select for diffs], Wed Nov 19 03:27:45 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
CVS Tags: OPENBSD_5_8_BASE, OPENBSD_5_8, OPENBSD_5_7_BASE, OPENBSD_5_7
Changes since 1.18: +5 -3 lines
Diff to previous 1.18 (colored)

Bugfix: run for the specified number of seconds as described in the manual,
not for a fixed number of iterations.  This makes a difference on terminals
not fast enough to update every second, in particular in -s mode.
Inspired by FreeBSD, but implemented differently with less bugs.
Patch from pjanzen@, slightly tweaked by me.

Revision 1.18 / (download) - annotate - [select for diffs], Tue Nov 18 20:09:45 2014 UTC (9 years, 6 months ago) by tedu
Branch: MAIN
Changes since 1.17: +69 -35 lines
Diff to previous 1.17 (colored)

sigwinch support for resizing. from pjanzen

Revision 1.17 / (download) - annotate - [select for diffs], Tue Nov 18 05:09:38 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.16: +14 -11 lines
Diff to previous 1.16 (colored)

Center the clock.  Based on an idea and an original diff from tedu@,
arithmetics and validity constraints fixed by me.  OK pjanzen@ tedu@

Revision 1.16 / (download) - annotate - [select for diffs], Mon Nov 17 22:14:25 2014 UTC (9 years, 6 months ago) by schwarze
Branch: MAIN
Changes since 1.15: +24 -9 lines
Diff to previous 1.15 (colored)

Multiple improvements from pjanzen@:
* properly delay scrolling with nanosleep(2), relevant on fast terminals
* change timing to end scrolling on the second instead of starting it
* error out if the terminal is too small instead of garbling the output
* use strtonum(3) rather than strtol(3) and terminate error message with \n

Revision 1.15 / (download) - annotate - [select for diffs], Mon Mar 17 09:17:56 2008 UTC (16 years, 2 months ago) by sobrado
Branch: MAIN
CVS Tags: OPENBSD_5_6_BASE, OPENBSD_5_6, OPENBSD_5_5_BASE, OPENBSD_5_5, OPENBSD_5_4_BASE, OPENBSD_5_4, OPENBSD_5_3_BASE, OPENBSD_5_3, OPENBSD_5_2_BASE, OPENBSD_5_2, OPENBSD_5_1_BASE, OPENBSD_5_1, OPENBSD_5_0_BASE, OPENBSD_5_0, OPENBSD_4_9_BASE, OPENBSD_4_9, OPENBSD_4_8_BASE, OPENBSD_4_8, OPENBSD_4_7_BASE, OPENBSD_4_7, OPENBSD_4_6_BASE, OPENBSD_4_6, OPENBSD_4_5_BASE, OPENBSD_4_5, OPENBSD_4_4_BASE, OPENBSD_4_4
Changes since 1.14: +2 -2 lines
Diff to previous 1.14 (colored)

synchronization between usage and synopsis; add some missing "usage:"'s

ok jmc@

Revision 1.14 / (download) - annotate - [select for diffs], Mon Nov 29 09:32:47 2004 UTC (19 years, 6 months ago) by jsg
Branch: MAIN
CVS Tags: OPENBSD_4_3_BASE, OPENBSD_4_3, OPENBSD_4_2_BASE, OPENBSD_4_2, OPENBSD_4_1_BASE, OPENBSD_4_1, OPENBSD_4_0_BASE, OPENBSD_4_0, OPENBSD_3_9_BASE, OPENBSD_3_9, OPENBSD_3_8_BASE, OPENBSD_3_8, OPENBSD_3_7_BASE, OPENBSD_3_7
Changes since 1.13: +2 -2 lines
Diff to previous 1.13 (colored)

Use volatile sig_atomic_t rather than int for sigtermed, from pjanzen@
ok miod@, otto@

Revision 1.13 / (download) - annotate - [select for diffs], Mon Nov 29 08:52:28 2004 UTC (19 years, 6 months ago) by jsg
Branch: MAIN
Changes since 1.12: +4 -7 lines
Diff to previous 1.12 (colored)

ansi. ok deraadt@

Revision 1.12 / (download) - annotate - [select for diffs], Fri Jul 26 20:32:38 2002 UTC (21 years, 10 months ago) by pjanzen
Branch: MAIN
CVS Tags: OPENBSD_3_6_BASE, OPENBSD_3_6, OPENBSD_3_5_BASE, OPENBSD_3_5, OPENBSD_3_4_BASE, OPENBSD_3_4, OPENBSD_3_3_BASE, OPENBSD_3_3, OPENBSD_3_2_BASE, OPENBSD_3_2
Changes since 1.11: +4 -1 lines
Diff to previous 1.11 (colored)

The elusive original author of this program and man page surfaced long enough
to state the following, when asked about licensing issues:
    "It's ok to put any copyright as long as it stays in the public domain.
...
    Since I did not write it to make any profit or fame in the first place,
    I guess its use is not limited by any license.  Of course I would not
    object to my name being mentioned."
Then he disappeared again.

So I've put on a current copyright to him, and labelled the code explicitly
as public domain.

Revision 1.11 / (download) - annotate - [select for diffs], Fri May 31 03:40:00 2002 UTC (22 years ago) by pjanzen
Branch: MAIN
Changes since 1.10: +1 -5 lines
Diff to previous 1.10 (colored)

No dm -> no need to revoke setegid.

Revision 1.10 / (download) - annotate - [select for diffs], Sat Feb 16 21:27:10 2002 UTC (22 years, 3 months ago) by millert
Branch: MAIN
CVS Tags: OPENBSD_3_1_BASE, OPENBSD_3_1
Changes since 1.9: +5 -5 lines
Diff to previous 1.9 (colored)

Part one of userland __P removal.  Done with a simple regexp with some minor hand editing to make comments line up correctly.  Another pass is forthcoming that handles the cases that could not be done automatically.

Revision 1.9 / (download) - annotate - [select for diffs], Wed Jul 5 08:26:36 2000 UTC (23 years, 11 months ago) by pjanzen
Branch: MAIN
CVS Tags: OPENBSD_3_0_BASE, OPENBSD_3_0, OPENBSD_2_9_BASE, OPENBSD_2_9, OPENBSD_2_8_BASE, OPENBSD_2_8
Changes since 1.8: +2 -12 lines
Diff to previous 1.8 (colored)

nanosleep() no longer returns early

Revision 1.8 / (download) - annotate - [select for diffs], Mon Jan 24 07:53:57 2000 UTC (24 years, 4 months ago) by pjanzen
Branch: MAIN
CVS Tags: OPENBSD_2_7_BASE, OPENBSD_2_7
Changes since 1.7: +58 -27 lines
Diff to previous 1.7 (colored)

parse command line more carefully; watch out for nanosleep() ending a
little too early; and do some general tidying

Revision 1.7 / (download) - annotate - [select for diffs], Fri Jan 21 07:10:39 2000 UTC (24 years, 4 months ago) by pjanzen
Branch: MAIN
Changes since 1.6: +9 -2 lines
Diff to previous 1.6 (colored)

Hide cursor if possible

Revision 1.6 / (download) - annotate - [select for diffs], Thu Jan 20 12:31:33 2000 UTC (24 years, 4 months ago) by d
Branch: MAIN
Changes since 1.5: +15 -5 lines
Diff to previous 1.5 (colored)

track seconds more accurately. ok pjanzen@

Revision 1.5 / (download) - annotate - [select for diffs], Thu Mar 19 11:41:51 1998 UTC (26 years, 2 months ago) by pjanzen
Branch: MAIN
CVS Tags: OPENBSD_2_6_BASE, OPENBSD_2_6, OPENBSD_2_5_BASE, OPENBSD_2_5, OPENBSD_2_4_BASE, OPENBSD_2_4, OPENBSD_2_3_BASE, OPENBSD_2_3
Changes since 1.4: +3 -3 lines
Diff to previous 1.4 (colored)

Minor tweaks, mainly setgid-related

Revision 1.4 / (download) - annotate - [select for diffs], Thu Jul 31 19:09:34 1997 UTC (26 years, 10 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_2_BASE, OPENBSD_2_2
Changes since 1.3: +11 -10 lines
Diff to previous 1.3 (colored)

time_t is not long

Revision 1.3 / (download) - annotate - [select for diffs], Sun Dec 22 20:01:17 1996 UTC (27 years, 5 months ago) by deraadt
Branch: MAIN
CVS Tags: OPENBSD_2_1_BASE, OPENBSD_2_1
Changes since 1.2: +3 -1 lines
Diff to previous 1.2 (colored)

proper gid revoke

Revision 1.2 / (download) - annotate - [select for diffs], Thu Dec 19 22:21:30 1996 UTC (27 years, 5 months ago) by deraadt
Branch: MAIN
Changes since 1.1: +3 -1 lines
Diff to previous 1.1 (colored)

setgid games, not setuid games. closes a neat set of holes

Revision 1.1 / (download) - annotate - [select for diffs], Wed Aug 21 07:58:08 1996 UTC (27 years, 9 months ago) by downsj
Branch: MAIN
CVS Tags: OPENBSD_2_0_BASE, OPENBSD_2_0

From FreeBSD.

This form allows you to request diff's between any two revisions of a file. You may select a symbolic revision name using the selection box or you may type in a numeric name using the type-in text box.