Aazure.627 net.unix-wizards utcsrgv!utzoo!decvax!ucbvax!ihnss!houxi!houxm!houxg!lime!vax135!harpo!cbosg!teklabs!tekmdp!azure!stevenm Fri Mar 12 14:15:13 1982 UUCP dialing times Here is some code I hacked to improve the flexibility of the 'time' field in the L.sys file for UUCP. Something like this should be done in the next distribution, as the current implementation is far too restrictive on times to call. We found the restriction of times neccesary due to skyrocketing phone bills. S. McGeady ---------------- Forwarded Message ----------------------- (Message inbox:52) From: stevenm Date: Friday, 12 March 1982 at 1405-PST To: tekmdp!teklabs!sterling Cc: tekmdp!teklabs!system Cc: sysprog Fcc: uucp Subject: Date routine in uucp This routine allows you to specify a range of dates, in particular the range that we want for uucp: Any0-0600,Any2300-2359,Sa0-2359,Su0-1800 this optimizes calling when the rates are low. This routine should be installed replacing 'ifdate', which is the last routine in 'conn.c' (conn.c.hayes for the teklabs system). ~~~~~~~~~~~~~ /********* * * ifdate(s) * * this routine breaks up a comma-seperated list * of date strings and calls _ifdate (the old * ifdate) with them. This is a bit of a kludge, * but in practice it works well. * * S. McGeady, Tektronix, 3/12/82 */ ifdate(s) char *s; { register char *p, *p1; register int rval; rval = 0; p = s; for (;;) { p1 = p; while (*p != '\0' && *p != ',') p++; if (*p == ',') { *p = '\0'; rval += _ifdate(p1); *p++ = ','; } else { rval += _ifdate(p1); break; } } return(rval >= 1 ? 1 : 0); } /******* * _ifdate(s) * char *s; * * _ifdate - this routine will check a string (s) * like "MoTu0800-1730" to see if the present * time is within the given limits. * * String alternatives: * Wk - Mo thru Fr * zero or one time means all day * Any - any day * * return codes: * 0 - not within limits * 1 - within limits */ _ifdate(s) char *s; { static char *days[]={ "Su", "Mo", "Tu", "We", "Th", "Fr", "Sa", 0 }; long clock; int i, tl, th, tn, dayok=0; struct tm *localtime(); struct tm *tp; time(&clock); tp = localtime(&clock); while (isalpha(*s)) { for (i = 0; days[i]; i++) { if (prefix(days[i], s)) if (tp->tm_wday == i) dayok = 1; } if (prefix("Wk", s)) if (tp->tm_wday >= 1 && tp->tm_wday <= S)) (DAYOK="=" TN="tp-" S++; , IF &TL, (PREFIX("ANY", &TH); I="sscanf(s," 0) %D-%D DAYOK="1;" RETURN(0); } 5)>tm_hour * 100 + tp->tm_min; if (i = tl && tn <=
This Usenet Oldnews Archive article may be copied and distributed freely, provided:

1. There is no money collected for the text(s) of the articles.
2. The following notice remains appended to each copy:

The Usenet Oldnews Archive: Compilation Copyright© 1981, 1996
Bruce Jones, Henry Spencer, David Wiseman.


Goto NEXT article in NET.unix-wizards Newsgroup
Return to NET.unix-wizards index
Return to the Usenet Oldnews Archive index ----------------------------------------------------------------- gopher://quux.org/ conversion by John Goerzen of http://communication.ucsd.edu/A-News/ This Usenet Oldnews Archive article may be copied and distributed freely, provided: 1. There is no money collected for the text(s) of the articles. 2. The following notice remains appended to each copy: The Usenet Oldnews Archive: Compilation Copyright (C) 1981, 1996 Bruce Jones, Henry Spencer, David Wiseman.