[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.23 and 1.27

version 1.23, 2010/04/28 18:20:15 version 1.27, 2013/11/26 13:18:53
Line 78 
Line 78 
 static struct fixs fnmonths[13];      /* full national months names */  static struct fixs fnmonths[13];      /* full national months names */
 static struct fixs nmonths[13];       /* short national month names */  static struct fixs nmonths[13];       /* short national month names */
   
   
 void  void
 setnnames(void)  setnnames(void)
 {  {
Line 89 
Line 88 
         for (i = 0; i < 7; i++) {          for (i = 0; i < 7; i++) {
                 tm.tm_wday = i;                  tm.tm_wday = i;
                 l = strftime(buf, sizeof(buf), "%a", &tm);                  l = strftime(buf, sizeof(buf), "%a", &tm);
                 for (; l > 0 && isspace((int)buf[l - 1]); l--)                  for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--)
                         ;                          ;
                 buf[l] = '\0';                  buf[l] = '\0';
                 if (ndays[i].name != NULL)                  if (ndays[i].name != NULL)
Line 99 
Line 98 
                 ndays[i].len = strlen(buf);                  ndays[i].len = strlen(buf);
   
                 l = strftime(buf, sizeof(buf), "%A", &tm);                  l = strftime(buf, sizeof(buf), "%A", &tm);
                 for (; l > 0 && isspace((int)buf[l - 1]); l--)                  for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--)
                         ;                          ;
                 buf[l] = '\0';                  buf[l] = '\0';
                 if (fndays[i].name != NULL)                  if (fndays[i].name != NULL)
Line 112 
Line 111 
         for (i = 0; i < 12; i++) {          for (i = 0; i < 12; i++) {
                 tm.tm_mon = i;                  tm.tm_mon = i;
                 l = strftime(buf, sizeof(buf), "%b", &tm);                  l = strftime(buf, sizeof(buf), "%b", &tm);
                 for (; l > 0 && isspace((int)buf[l - 1]); l--)                  for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--)
                         ;                          ;
                 buf[l] = '\0';                  buf[l] = '\0';
                 if (nmonths[i].name != NULL)                  if (nmonths[i].name != NULL)
Line 122 
Line 121 
                 nmonths[i].len = strlen(buf);                  nmonths[i].len = strlen(buf);
   
                 l = strftime(buf, sizeof(buf), "%B", &tm);                  l = strftime(buf, sizeof(buf), "%B", &tm);
                 for (; l > 0 && isspace((int)buf[l - 1]); l--)                  for (; l > 0 && isspace((unsigned char)buf[l - 1]); l--)
                         ;                          ;
                 buf[l] = '\0';                  buf[l] = '\0';
                 if (fnmonths[i].name != NULL)                  if (fnmonths[i].name != NULL)
Line 191 
Line 190 
         len = strlen(date);          len = strlen(date);
         if (len < 2)          if (len < 2)
                 return((time_t)-1);                  return((time_t)-1);
           bzero(&tm, sizeof tm);
         tm.tm_sec = 0;          tm.tm_sec = 0;
         tm.tm_min = 0;          tm.tm_min = 0;
         /* Avoid getting caught by a timezone shift; set time to noon */          /* Avoid getting caught by a timezone shift; set time to noon */
Line 225 
Line 225 
         }          }
   
 #if DEBUG  #if DEBUG
         printf("Mktime: %d %d %d %s\n", (int)mktime(&tm), (int)t, len,          printf("Mktime: %d %lld %d %s\n", (int)mktime(&tm), (long long)t, len,
             asctime(&tm));              asctime(&tm));
 #endif  #endif
         return(mktime(&tm));          return(mktime(&tm));
 }  }
   
 void  static void
 adjust_calendar(int *day, int *month)  adjust_calendar(int *day, int *month)
 {  {
         switch (calendar) {          switch (calendar) {

Legend:
Removed from v.1.23  
changed lines
  Added in v.1.27