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

Diff for /src/usr.bin/cvs/rcs.c between version 1.133 and 1.134

version 1.133, 2006/03/05 16:22:31 version 1.134, 2006/03/07 01:40:52
Line 232 
Line 232 
   
   
 int rcs_errno = RCS_ERR_NOERR;  int rcs_errno = RCS_ERR_NOERR;
   char *timezone_flag = NULL;
   
   
 static int      rcs_write(RCSFILE *);  static int      rcs_write(RCSFILE *);
 static int      rcs_parse_init(RCSFILE *);  static int      rcs_parse_init(RCSFILE *);
 static int      rcs_parse_admin(RCSFILE *);  static int      rcs_parse_admin(RCSFILE *);
Line 2531 
Line 2531 
 rcs_expand_keywords(char *rcsfile, struct rcs_delta *rdp, char *data,  rcs_expand_keywords(char *rcsfile, struct rcs_delta *rdp, char *data,
     size_t len, int mode)      size_t len, int mode)
 {  {
           int tzone;
         int kwtype, sizdiff;          int kwtype, sizdiff;
         u_int i, j, found, start_offset, c_offset;          u_int i, j, found, start_offset, c_offset;
         char *c, *kwstr, *start, *end, *tbuf;          char *c, *kwstr, *start, *end, *tbuf, *m, *h;
         char expbuf[256], buf[256];          char expbuf[256], buf[256];
           struct tm *tb, ltb;
           time_t now;
           char *fmt;
   
         kwtype = 0;          kwtype = 0;
         kwstr = NULL;          kwstr = NULL;
         i = 0;          i = 0;
   
         /*          /*
            * -z support for RCS
            */
           tb = &rdp->rd_date;
           if (timezone_flag != NULL) {
                   if (!strcmp(timezone_flag, "LT")) {
                           now = mktime(&rdp->rd_date);
                           tb = localtime(&now);
                           tb->tm_hour += ((int)tb->tm_gmtoff / 3600);
                   } else {
                           h = timezone_flag;
                           if ((m = strrchr(timezone_flag, ':')) != NULL)
                                   *(m++) = '\0';
   
                           ltb = rdp->rd_date;
                           tb = &ltb;
   
                           tzone = atoi(h);
   
                           if (tzone >= 24 && tzone <= -24)
                                   fatal("not a known time zone: %d", tzone);
   
                           tb->tm_hour += tzone;
                           if (tb->tm_hour >= 24 && tb->tm_hour <= -24)
                                   tb->tm_hour = 0;
   
                           tb->tm_gmtoff += (tzone * 3600);
   
                           if (m != NULL) {
                                   tzone = atoi(m);
                                   if (tzone >= 60)
                                           fatal("not a known time zone: %d", tzone);
   
                                   if ((tb->tm_min + tzone) >= 60) {
                                           tb->tm_hour++;
                                           tb->tm_min -= tzone;
                                   } else {
                                           tb->tm_min += tzone;
                                   }
   
                                   tb->tm_gmtoff += (tzone * 60);
                           }
                   }
           }
   
           /*
          * Keyword formats:           * Keyword formats:
          * $Keyword$           * $Keyword$
          * $Keyword: value$           * $Keyword: value$
Line 2636 
Line 2685 
                                 }                                  }
   
                                 if (kwtype & RCS_KW_DATE) {                                  if (kwtype & RCS_KW_DATE) {
                                         strftime(buf, sizeof(buf),                                          if (timezone_flag != NULL)
                                             "%Y/%m/%d %H:%M:%S ",                                                  fmt = "%Y/%m/%d %H:%M:%S%z ";
                                             &rdp->rd_date);                                          else
                                                   fmt = "%Y/%m/%d %H:%M:%S ";
   
                                           strftime(buf, sizeof(buf), fmt, tb);
                                         strlcat(expbuf, buf, sizeof(expbuf));                                          strlcat(expbuf, buf, sizeof(expbuf));
                                 }                                  }
   

Legend:
Removed from v.1.133  
changed lines
  Added in v.1.134