[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.8 and 1.11

version 1.8, 1999/03/04 03:34:35 version 1.11, 2001/06/05 21:27:16
Line 108 
Line 108 
                 if (ndays[i].name != NULL)                  if (ndays[i].name != NULL)
                         free(ndays[i].name);                          free(ndays[i].name);
                 if ((ndays[i].name = strdup(buf)) == NULL)                  if ((ndays[i].name = strdup(buf)) == NULL)
                         errx(1, "cannot allocate memory");                          err(1, NULL);
                 ndays[i].len = strlen(buf);                  ndays[i].len = strlen(buf);
   
                 l = strftime(buf, sizeof(buf), "%A", &tm);                  l = strftime(buf, sizeof(buf), "%A", &tm);
Line 118 
Line 118 
                 if (fndays[i].name != NULL)                  if (fndays[i].name != NULL)
                         free(fndays[i].name);                          free(fndays[i].name);
                 if ((fndays[i].name = strdup(buf)) == NULL)                  if ((fndays[i].name = strdup(buf)) == NULL)
                         errx(1, "cannot allocate memory");                          err(1, NULL);
                 fndays[i].len = strlen(buf);                  fndays[i].len = strlen(buf);
         }          }
   
Line 131 
Line 131 
                 if (nmonths[i].name != NULL)                  if (nmonths[i].name != NULL)
                         free(nmonths[i].name);                          free(nmonths[i].name);
                 if ((nmonths[i].name = strdup(buf)) == NULL)                  if ((nmonths[i].name = strdup(buf)) == NULL)
                         errx(1, "cannot allocate memory");                          err(1, NULL);
                 nmonths[i].len = strlen(buf);                  nmonths[i].len = strlen(buf);
   
                 l = strftime(buf, sizeof(buf), "%B", &tm);                  l = strftime(buf, sizeof(buf), "%B", &tm);
Line 141 
Line 141 
                 if (fnmonths[i].name != NULL)                  if (fnmonths[i].name != NULL)
                         free(fnmonths[i].name);                          free(fnmonths[i].name);
                 if ((fnmonths[i].name = strdup(buf)) == NULL)                  if ((fnmonths[i].name = strdup(buf)) == NULL)
                         errx(1, "cannot allocate memory");                          err(1, NULL);
                 fnmonths[i].len = strlen(buf);                  fnmonths[i].len = strlen(buf);
         }          }
         /* Hardwired special events */          /* Hardwired special events */
Line 153 
Line 153 
         spev[1].getev = paskha;          spev[1].getev = paskha;
         for (i = 0; i < NUMEV; i++) {          for (i = 0; i < NUMEV; i++) {
                 if (spev[i].name == NULL)                  if (spev[i].name == NULL)
                         errx(1, "cannot allocate memory");                          err(1, NULL);
                 spev[i].uname = NULL;                  spev[i].uname = NULL;
         }          }
 }  }
Line 248 
Line 248 
  *      3-charweekday                   (Friday, Monday, mon.)   *      3-charweekday                   (Friday, Monday, mon.)
  *      numeric month or day            (1, 2, 04)   *      numeric month or day            (1, 2, 04)
  *   *
  * Any character may separate them, or they may not be separated.  Any line,   * Any character except \t or '*' may separate them, or they may not be
  * following a line that is matched, that starts with "whitespace", is shown   * separated.  Any line following a line that is matched, that starts
  * along with the matched line.   * with \t, is shown along with the matched line.
  */   */
 struct match *  struct match *
 isnow(endp)  isnow(endp)
Line 427 
Line 427 
                                         return(NULL);                                          return(NULL);
                         }                          }
                         if ((tmp = malloc(sizeof(struct match))) == NULL)                          if ((tmp = malloc(sizeof(struct match))) == NULL)
                                 errx(1, "cannot allocate memory");                                  err(1, NULL);
                         tmp->when = f_time + v2 * SECSPERDAY;                          tmp->when = f_time + v2 * SECSPERDAY;
                         (void)mktime(&tmtmp);                          (void)mktime(&tmtmp);
                         if (strftime(tmp->print_date,                          if (strftime(tmp->print_date,
Line 498 
Line 498 
                                 if (flags & F_SPECIAL) {                                  if (flags & F_SPECIAL) {
                                         tmtmp.tm_mon = 0;       /* Gee, mktime() is nice */                                          tmtmp.tm_mon = 0;       /* Gee, mktime() is nice */
                                         tmtmp.tm_mday = spev[v1].getev(tmtmp.tm_year +                                          tmtmp.tm_mday = spev[v1].getev(tmtmp.tm_year +
                                             vwd + TM_YEAR_BASE);                                              TM_YEAR_BASE) + vwd;
                                 } else if (vwd) {                                  } else if (vwd) {
                                         v1 = vwd;                                          v1 = vwd;
                                         variable_weekday(&v1, tmtmp.tm_mon + 1,                                          variable_weekday(&v1, tmtmp.tm_mon + 1,
Line 520 
Line 520 
                                 if (tdiff <= offset + f_dayAfter) {                                  if (tdiff <= offset + f_dayAfter) {
                                         if (tdiff >=  0) {                                          if (tdiff >=  0) {
                                         if ((tmp = malloc(sizeof(struct match))) == NULL)                                          if ((tmp = malloc(sizeof(struct match))) == NULL)
                                                 errx(1, "cannot allocate memory");                                                  err(1, NULL);
                                         tmp->when = ttmp;                                          tmp->when = ttmp;
                                         if (strftime(tmp->print_date,                                          if (strftime(tmp->print_date,
                                             sizeof(tmp->print_date),                                              sizeof(tmp->print_date),

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