[net.bugs.uucp] uucico won't accept 1700-0800 as time to call

scw@cepu.UUCP (Stephen C. Woods) (03/14/85)

Applicablity:  V7 and 2.8 BSD, probably 2.9 BSD. Other systems : not sure.

Discription:  uucico will not accept a time to call range where the stop
    time is less than the begin time.  It would be usefull to only allow
    calls at non prime time hours, but that are not in a expressable as
    some_time-some_time_with_higher_value. Currently the only way to
    express times of this form is to pick either 1700-2400, or 0000-0800
    either way you loose 7 or 8 hours that could be used for calling.

Repeat-by:    Add a new, or modify an exsisting, L.sys entry to have a
    time to call field where the ending time is less than the start time

     e.g: Foo Any1700-0800 ACU 1200 765-4321 in: me word: fubar

    Then force call to the target machine, Note that you get the 'WRONG TIME
    TO CALL' message in your log.

Fix:    Apply the following diff to conn.c, in routine ifdate().
    Your line numbers may vary, depending on System and hack level, these
    are from a somewhat hacked V7 uucico.

*** conn.c.B	Fri May  4 10:24:20 1984
--- conn.c	Thu Mar 14 09:47:22 1985
***************
*** 817,824
  	i = sscanf(s, "%d-%d", &tl, &th);
  	tn = tp->tm_hour * 100 + tp->tm_min;
  	if (i < 2)
  		return(1);
  	if (tn >= tl && tn <= th)
  		return(1);
  	return(0);
  }

--- 817,841 -----
  	i = sscanf(s, "%d-%d", &tl, &th);
  	tn = tp->tm_hour * 100 + tp->tm_min;
  	if (i < 2)
  		return(1);
+ 	if( tl > th ){
+ /* fold time around 2400 to handle
+  * cases like 1700-0800
+  * (call at off peak hours)
+  */
+ 	DEBUG(16,"%s times  low high  now\n","old");
+ 	DEBUG(16,"          %04d ",tl);
+ 	DEBUG(16,"%04d ",th);
+ 	DEBUG(16,"%04d\n",tn);
+ 	    th += 2400-tl;
+ 	    tn += 2400-tl;
+ 	    tl = 0;
+ 	DEBUG(16,"%s times  low high  now\n","new");
+ 	DEBUG(16,"          %04d ",tl);
+ 	DEBUG(16,"%04d ",th);
+ 	DEBUG(16,"%04d\n",tn);
+ 	}
  	if (tn >= tl && tn <= th)
  		return(1);
  	return(0);
  }
-- 
Stephen C. Woods (VA Wadsworth Med Ctr./UCLA Dept. of Neurology)
uucp:	{ {ihnp4, uiucdcs}!bradley, hao, trwrb}!cepu!scw
ARPA: cepu!scw@ucla-cs location: N 34 3' 9.1" W 118 27' 4.3"