Changeset 13 for trunk/txlib/txlogfil.c
- Timestamp:
- 05/13/06 20:33:09 (3 years ago)
- Files:
-
- 1 modified
-
trunk/txlib/txlogfil.c (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/txlib/txlogfil.c
r11 r13 39 39 #include <txlib.h> 40 40 41 static FILE *log_handle= 0;42 static TXLN log_fname;43 static BOOL log_7bit= TRUE;44 static BOOL log_reopen = FALSE;// reopen on each line41 static FILE *log_handle = 0; 42 static TXLN log_fname = "logfile"; 43 static BOOL log_7bit = TRUE; 44 static BOOL log_reopen = FALSE; // reopen on each line 45 45 46 46 /*****************************************************************************/ … … 49 49 BOOL TxAppendToLogFile // RET logfile opened 50 50 ( 51 char *fname // IN name of (new) logfile 51 char *fname, // IN name of (new) logfile 52 BOOL verbose // IN Show the action 52 53 ) 53 54 { 54 55 if (log_handle != 0) // close old one 55 56 { 56 TxPrint("Closing logfile : '%s'\n", log_fname); 57 if (verbose) 58 { 59 TxPrint("Closing logfile : '%s'\n", log_fname); 60 } 57 61 fclose(log_handle); 58 62 log_handle = 0; … … 65 69 TxFnameExtension( log_fname, "log"); 66 70 } 67 if (( log_handle = fopen(log_fname, "a" TXFMODE)) == 0)71 if (((log_handle = fopen(log_fname, "a" TXFMODE)) == 0) && (verbose)) 68 72 { 69 73 TxPrint("Error opening log : '%s'\n", log_fname); … … 72 76 { 73 77 TxLogfileState( DEVICE_ON); // always ON for new file 74 if (TxaOptUnSet('7')) // NO strip to 7-bit ASCII 75 { 76 log_7bit = FALSE; 77 } 78 if (TxaExeArgc() != 0) // Switches already parsed ? 79 { // (-q = quiet switch to come) 80 TxPrint("Appending to log : '%s' (%s-bit ASCII)\n", 81 log_fname, (log_7bit) ? "7" : "8"); 78 if (verbose) // avoid any TxPrint when 79 { // working in quiet mode 80 if (TxaOptUnSet('7')) // NO strip to 7-bit ASCII 81 { 82 log_7bit = FALSE; 83 } 84 if (TxaExeArgc() != 0) // Switches already parsed ? 85 { // (-q = quiet switch to come) 86 TxPrint("Appending to log : '%s' (%s-bit ASCII)\n", 87 log_fname, (log_7bit) ? "7" : "8"); 88 } 82 89 } 83 90 } … … 148 155 /*---------------------------------------------------------------------------*/ 149 156 157 150 158 /*****************************************************************************/ 151 159 // Get name for current logfile, if any … … 166 174 /*---------------------------------------------------------------------------*/ 167 175 176 177 /*****************************************************************************/ 178 // Construct name for new logfile based upon a sequence number 0..n 179 /*****************************************************************************/ 180 char *TxBuildLogName // RET filename or NULL 181 ( 182 ULONG seq, // IN sequence number 183 TXLN buf // IN filename buffer 184 ) 185 { 186 char *rc = buf; 187 TXTS ext; 188 189 if (seq == 0) // first will be .log 190 { 191 strcpy( ext, "log"); 192 } 193 else 194 { 195 sprintf( ext, "l%02lu", seq); 196 } 197 strcpy( rc, log_fname); 198 199 TxStripExtension( rc); // remove current extension 200 TxFnameExtension( rc, ext); // and add new one 201 202 return (rc); 203 } // end 'TxBuildLogName' 204 /*---------------------------------------------------------------------------*/ 205