Develop and Download Open Source Software

Browse CVS Repository

Diff of /ttssh2/teraterm/source/teraterm/filesys.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.11 by maya, Mon May 14 14:07:14 2007 UTC revision 1.12 by yutakapon, Fri May 25 09:56:05 2007 UTC
# Line 64  PProtoCancel ProtoCancel; Line 64  PProtoCancel ProtoCancel;
64  #define IdProtoTimeOutProc 9  #define IdProtoTimeOutProc 9
65  #define IdProtoCancel    10  #define IdProtoCancel    10
66    
67    /*
68       Line Head flag for timestamping
69       2007.05.24 Gentaro
70    */
71    enum enumLineEnd {
72            Line_Other = 0,
73            Line_LineHead = 1,
74            Line_FileHead = 2,
75    };
76    
77    enum enumLineEnd eLineEnd = Line_LineHead;
78    
79  BOOL LoadTTFILE()  BOOL LoadTTFILE()
80  {  {
81    BOOL Err;    BOOL Err;
# Line 379  void LogStart() Line 391  void LogStart()
391          cv.LCount = 0;          cv.LCount = 0;
392    
393          HelpId = HlpFileLog;          HelpId = HlpFileLog;
394            /* 2007.05.24 Gentaro */
395            eLineEnd = Line_LineHead;
396    
397          if (ts.Append > 0)          if (ts.Append > 0)
398          {          {
399                  LogVar->FileHandle = _lopen(LogVar->FullName,OF_WRITE);                  LogVar->FileHandle = _lopen(LogVar->FullName,OF_WRITE);
400                  if (LogVar->FileHandle>0)                  if (LogVar->FileHandle>0){
401                          _llseek(LogVar->FileHandle,0,2);                          _llseek(LogVar->FileHandle,0,2);
402                            /* 2007.05.24 Gentaro
403                                    If log file already exists,
404                                    a newline is inserted before the first timestamp.
405                            */
406                            eLineEnd = Line_FileHead;
407                    }
408                  else                  else
409                          LogVar->FileHandle = _lcreat(LogVar->FullName,0);                          LogVar->FileHandle = _lcreat(LogVar->FullName,0);
410          }          }
# Line 506  void CommentLogToFile(char *buf, int siz Line 527  void CommentLogToFile(char *buf, int siz
527          logfile_lock();          logfile_lock();
528          WriteFile((HANDLE)LogVar->FileHandle, buf, size, &wrote, NULL);          WriteFile((HANDLE)LogVar->FileHandle, buf, size, &wrote, NULL);
529          WriteFile((HANDLE)LogVar->FileHandle, "\r\n", 2, &wrote, NULL); // 改行          WriteFile((HANDLE)LogVar->FileHandle, "\r\n", 2, &wrote, NULL); // 改行
530            /* Set Line End Flag
531                    2007.05.24 Gentaro
532            */
533            eLineEnd = Line_LineHead;
534          logfile_unlock();          logfile_unlock();
535  }  }
536    
# Line 543  void LogToFile() Line 568  void LogToFile()
568                  {                  {
569                          // 時刻を書き出す(2006.7.23 maya)                          // 時刻を書き出す(2006.7.23 maya)
570                          // 日付フォーマットを日本ではなく世界標準に変更した (2006.7.23 yutaka)                          // 日付フォーマットを日本ではなく世界標準に変更した (2006.7.23 yutaka)
571                          if (ts.LogTimestamp &&                          /* 2007.05.24 Gentaro */
572                                  (Start == 1 || Buf[Start-2] == 0x0a)) {                          if ( ts.LogTimestamp && eLineEnd ) {
573  #if 0  #if 0
574                                  SYSTEMTIME      LocalTime;                                  SYSTEMTIME      LocalTime;
575                                  GetLocalTime(&LocalTime);                                  GetLocalTime(&LocalTime);
# Line 559  void LogToFile() Line 584  void LogToFile()
584                                          time_t tick = time(NULL);                                          time_t tick = time(NULL);
585                                          char *strtime = ctime(&tick);                                          char *strtime = ctime(&tick);
586  #endif  #endif
587                                    /* 2007.05.24 Gentaro */
588                                  // write to file                                  if( eLineEnd == Line_FileHead ){
589                                  if (Start == 1 && ts.Append) {                                          _lwrite(LogVar->FileHandle,"\r\n",2);
                                         _lwrite(LogVar->FileHandle,"\r\n",strlen("\r\n"));  
590                                  }                                  }
591                                  _lwrite(LogVar->FileHandle,"[",1);                                  _lwrite(LogVar->FileHandle,"[",1);
592                                  // 変換した文字列の終端に \n が含まれているので取り除く。                                  // 変換した文字列の終端に \n が含まれているので取り除く。
593                                  _lwrite(LogVar->FileHandle, strtime, strlen(strtime) - 1);                                  _lwrite(LogVar->FileHandle, strtime, strlen(strtime) - 1);
594                                  _lwrite(LogVar->FileHandle,"] ",2);                                  _lwrite(LogVar->FileHandle,"] ",2);
595                          }                          }
596                            
597                            /* 2007.05.24 Gentaro */
598                            if( b == 0x0a ){
599                                    eLineEnd = Line_LineHead; /* set endmark*/
600                            }
601                            else {
602                                    eLineEnd = Line_Other; /* clear endmark*/
603                            }
604    
605                          _lwrite(LogVar->FileHandle,(PCHAR)&b,1);                          _lwrite(LogVar->FileHandle,(PCHAR)&b,1);
606                          (LogVar->ByteCount)++;                          (LogVar->ByteCount)++;
# Line 1244  void QVStart(int mode) Line 1276  void QVStart(int mode)
1276    
1277  /*  /*
1278   * $Log$   * $Log$
1279     * Revision 1.12  2007/05/25 09:56:05  yutakapon
1280     * タイムスタンプ付きログで1KBごとに不要な改行が入るバグを修正。
1281     *
1282   * Revision 1.11  2007/05/14 14:07:14  maya   * Revision 1.11  2007/05/14 14:07:14  maya
1283   * バッファをクリアしていないので落ちる問題を修正した。   * バッファをクリアしていないので落ちる問題を修正した。
1284   *   *

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

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26