Changeset 4800 for trunk/MagicSoft/Mars/showlog.cc
- Timestamp:
- 08/30/04 11:45:51 (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/MagicSoft/Mars/showlog.cc
r4756 r4800 1 1 #include <errno.h> 2 2 #include <fstream> 3 4 #include <TRegexp.h> 3 5 4 6 #include "MArgs.h" … … 16 18 gLog << " or" << endl; 17 19 gLog << " showlog [options] < filename" << endl << endl; 20 gLog.Usage(); 18 21 gLog << " -?, -h, --help This help" << endl << endl; 19 22 gLog << endl; … … 24 27 gLog << " colored output with less use the option -R, eg." << endl; 25 28 gLog << " less -R logfile.log" << endl << endl; 29 } 30 31 void RemoveAnsi(TString &s) 32 { 33 static const TRegexp regexp("[][[][0-9]+[m]"); 34 35 int i=0; 36 37 while (1) 38 { 39 Ssiz_t len = 0; 40 Ssiz_t idx = s.Index(regexp, &len); 41 if (idx<0) 42 break; 43 44 s.Remove(idx, len); 45 } 26 46 } 27 47 … … 37 57 return -1; 38 58 } 59 60 const Bool_t kNoColors = arg.HasOnly("--no-colors") || arg.HasOnly("-a"); 61 62 gLog.Setup(arg); 39 63 40 64 if (arg.GetNumOptions()>0) … … 69 93 break; 70 94 71 s.ReplaceAll("", "\033"); 95 if (kNoColors) 96 RemoveAnsi(s); 97 else 98 s.ReplaceAll("", "\033"); 72 99 gLog << s << endl; 73 100 }
Note:
See TracChangeset
for help on using the changeset viewer.