From nobody@FreeBSD.org  Sat Oct 23 15:27:23 2010
Return-Path: <nobody@FreeBSD.org>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id F1B17106566B
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 23 Oct 2010 15:27:23 +0000 (UTC)
	(envelope-from nobody@FreeBSD.org)
Received: from www.freebsd.org (www.freebsd.org [IPv6:2001:4f8:fff6::21])
	by mx1.freebsd.org (Postfix) with ESMTP id C64CF8FC0A
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 23 Oct 2010 15:27:23 +0000 (UTC)
Received: from www.freebsd.org (localhost [127.0.0.1])
	by www.freebsd.org (8.14.3/8.14.3) with ESMTP id o9NFRN5P083391
	for <freebsd-gnats-submit@FreeBSD.org>; Sat, 23 Oct 2010 15:27:23 GMT
	(envelope-from nobody@www.freebsd.org)
Received: (from nobody@localhost)
	by www.freebsd.org (8.14.3/8.14.3/Submit) id o9NFRNjP083390;
	Sat, 23 Oct 2010 15:27:23 GMT
	(envelope-from nobody)
Message-Id: <201010231527.o9NFRNjP083390@www.freebsd.org>
Date: Sat, 23 Oct 2010 15:27:23 GMT
From: Anatoly Borodin <anatoly.borodin@gmail.com>
To: freebsd-gnats-submit@FreeBSD.org
Subject: games/grdc: -s does not scroll
X-Send-Pr-Version: www-3.1
X-GNATS-Notify:

>Number:         151663
>Category:       bin
>Synopsis:       grdc(1): games/grdc: -s does not scroll
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Sat Oct 23 15:30:12 UTC 2010
>Closed-Date:    
>Last-Modified:  Tue Mar  8 13:10:06 UTC 2011
>Originator:     Anatoly Borodin
>Release:        
>Organization:
>Environment:
>Description:
grdc -s should scroll the digits, the manual says. But "grdc" and "grdc -s" look just the same.
>How-To-Repeat:

>Fix:
The option '-s' is being detected, so the scrolling algorithm should be changed. Unfortunately the programs lacks comments and is full of "magic numbers".

>Release-Note:
>Audit-Trail:

From: Andy Farkas <chuzzwassa@gmail.com>
To: bug-followup@FreeBSD.org, anatoly.borodin@gmail.com
Cc: =?ISO-8859-1?Q?Ulrich_Sp=F6rlein?= <uqs@freebsd.org>, 
	Bruce Evans <brde@optusnet.com.au>
Subject: Re: bin/151663: games/grdc: -s does not scroll
Date: Tue, 8 Mar 2011 22:41:39 +1000

 On Sun, Oct 24, 2010 at 1:27 AM, Anatoly Borodin
 <anatoly.borodin@gmail.com> wrote:
 
 > grdc -s should scroll the digits, the manual says. But "grdc" and "grdc -s" look just the same.
 
 It *is* scrolling, just too fast for the eye to see.
 
 If you add delays, it scrolls just fine:
 
 %%%
 --- /usr/src/games/grdc/grdc.c	2010-08-28 13:04:04.000000000 +1000
 +++ ./scrolling-grdc.c	2011-03-08 18:47:50.000000000 +1000
 @@ -54,7 +54,7 @@
  int
  main(int argc, char *argv[])
  {
 -	struct timespec delay;
 +	struct timespec delay, scrold;
  	time_t prev_sec;
  	long t, a;
  	int i, j, s, k;
 @@ -69,6 +69,8 @@
  	switch (ch) {
  	case 's':
  		scrol = 1;
 +		scrold.tv_sec = 0;
 +		scrold.tv_nsec = 40000000;
  		break;
  	case 't':
  		t12 = 1;
 @@ -191,6 +193,7 @@
  				}
  				if(!s) {
  					refresh();
 +					nanosleep(&scrold, NULL);
  				}
  			}
  		}
 %%%
 
 If you increase scrold.tv_nsec though, it seems to break the timing loop
 and grdc doesn't seem to DTRT.
 
 I have submitted a new PR (bin/155374) that fixes the problem once and for all.
 
 -andyf
>Unformatted:
