/* Copyright (c) 1979 Regents of the University of California */
#define CTRL(x) ('x' & 037)
gtty(1, &raw
); /* No structure assignment */
movebrk
= 80, ctime
= 0, cmoves
= 0;
fprintf(stderr
, "Usage: chessclock [ -m moves ] [ -t tlim ] [ -M xmoves ] [ -T xtime ]\n");
movebrk
= 2 * getn(argv
[1]) + 1;
btime
= wtime
= gettime(argv
[1]);
cmoves
= 2 * getn(argv
[1]);
ctime
= gettime(argv
[1]);
printf("Hit space to begin, ? for information\r\n");
printf("\b\b\b\b%s\b", pt(tbuf
, state
== BLACK
? btime
: wtime
));
printf("\r\n\r\nSpace move\r\n");
printf("c continue\r\n");
printf("! shell escape\r\n");
if (move
== movebrk
&& cmoves
!= 0) {
state
= state
== WHITE
? BLACK
: WHITE
;
printf("Hit c to continue\r\n");
printf("\r%3d %s %s", (move
+ 1) / 2,
pt(wbuf
, wtime
), pt(bbuf
, btime
));
printf("\r\n\07\07\07\07\07White loses on time\r\n");
printf("\r\n\07\07\07\07\07Black loses on time\r\n");
while (read(0, &c
, 1) != 1)
sprintf(buf
, "%2d:%1d%1d", tim
/ 60, (tim
% 60) / 10, tim
% 10);
if (*cp
!= ':' && !isdigit(*cp
))
t
= t
* 10 + *cp
++ - '0';
s
= s
* 10 + *cp
++ - '0';
i
= i
* 10 + *cp
++ - '0';