[BACK]Return to day.c CVS log [TXT][DIR] Up to [local] / src / usr.bin / calendar

Diff for /src/usr.bin/calendar/day.c between version 1.11 and 1.12

version 1.11, 2001/06/05 21:27:16 version 1.12, 2001/09/26 20:38:55
Line 253 
Line 253 
  * with \t, is shown along with the matched line.   * with \t, is shown along with the matched line.
  */   */
 struct match *  struct match *
 isnow(endp)  isnow(endp, bodun)
         char    *endp;          char    *endp;
           int     bodun;
 {  {
         int day = 0, flags = 0, month = 0, v1, v2, i;          int day = 0, flags = 0, month = 0, v1, v2, i;
         int monthp, dayp, varp = 0;          int monthp, dayp, varp = 0;
Line 279 
Line 280 
         if (!(v1 = getfield(endp, &endp, &flags)))          if (!(v1 = getfield(endp, &endp, &flags)))
                 return (NULL);                  return (NULL);
   
           /* adjust bodun rate */
           if (bodun && !bodun_always)
                   bodun = !(arc4random() % 3);
   
         /* Easter or Easter depending days */          /* Easter or Easter depending days */
         if (flags & F_SPECIAL)          if (flags & F_SPECIAL)
                 vwd = v1;                  vwd = v1;
Line 423 
Line 428 
                                 if ((v2 += isleap(tp->tm_year + TM_YEAR_BASE) ? 366 : 365)                                  if ((v2 += isleap(tp->tm_year + TM_YEAR_BASE) ? 366 : 365)
                                     <= v1)                                      <= v1)
                                         tmtmp.tm_year++;                                          tmtmp.tm_year++;
                                 else                                  else if(!bodun || (day - tp->tm_yday) != -1)
                                         return(NULL);                                          return(NULL);
                         }                          }
                         if ((tmp = malloc(sizeof(struct match))) == NULL)                          if ((tmp = malloc(sizeof(struct match))) == NULL)
Line 435 
Line 440 
                         /*    "%a %b %d", &tm);  Skip weekdays */                          /*    "%a %b %d", &tm);  Skip weekdays */
                             "%b %d", &tmtmp) == 0)                              "%b %d", &tmtmp) == 0)
                                 tmp->print_date[sizeof(tmp->print_date) - 1] = '\0';                                  tmp->print_date[sizeof(tmp->print_date) - 1] = '\0';
                           if (bodun && (day - tp->tm_yday) == -1)
                                   strcpy(tmp->prefix, "Бодун на утро от: ");
                           else
                                   tmp->prefix[0] = '\0';
   
                         tmp->var   = varp;                          tmp->var   = varp;
                         tmp->next  = NULL;                          tmp->next  = NULL;
                         return(tmp);                          return(tmp);
Line 517 
Line 527 
                                 warnx("time out of range: %s", endp);                                  warnx("time out of range: %s", endp);
                         else {                          else {
                                 tdiff = difftime(ttmp, f_time)/ SECSPERDAY;                                  tdiff = difftime(ttmp, f_time)/ SECSPERDAY;
                                 if (tdiff <= offset + f_dayAfter) {                                  if (tdiff <= offset + f_dayAfter ||
                                         if (tdiff >=  0) {                                      (bodun && tdiff == -1)) {
                                           if (tdiff >=  0 ||
                                               (bodun && tdiff == -1)) {
                                         if ((tmp = malloc(sizeof(struct match))) == NULL)                                          if ((tmp = malloc(sizeof(struct match))) == NULL)
                                                 err(1, NULL);                                                  err(1, NULL);
                                         tmp->when = ttmp;                                          tmp->when = ttmp;
Line 527 
Line 539 
                                         /*    "%a %b %d", &tm);  Skip weekdays */                                          /*    "%a %b %d", &tm);  Skip weekdays */
                                             "%b %d", &tmtmp) == 0)                                              "%b %d", &tmtmp) == 0)
                                                 tmp->print_date[sizeof(tmp->print_date) - 1] = '\0';                                                  tmp->print_date[sizeof(tmp->print_date) - 1] = '\0';
                                           if (bodun && tdiff == -1)
                                                   strcpy(tmp->prefix,
                                                       "Bodun na ytpo ot: ");
                                           else
                                                   tmp->prefix[0] = '\0';
                                         tmp->var   = varp;                                          tmp->var   = varp;
                                         tmp->next  = NULL;                                          tmp->next  = NULL;
                                         if (tmp2)                                          if (tmp2)

Legend:
Removed from v.1.11  
changed lines
  Added in v.1.12