1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-01-09 17:38:00 +00:00

Turn #ifdef LOG into a command-line option for debugging use

[originally from svn r330]
This commit is contained in:
Simon Tatham 1999-11-30 11:22:30 +00:00
parent 97b5df1691
commit 396d6cd422
3 changed files with 13 additions and 4 deletions

View File

@ -71,6 +71,8 @@ typedef enum {
GLOBAL Unscroll_Trigger unscroll_event;
GLOBAL char *logfile;
#define WM_NETEVENT (WM_USER + 1)
typedef enum {

View File

@ -578,13 +578,15 @@ void term_out(void) {
int c;
while ( (c = inbuf_getc()) != -1) {
#ifdef LOG
{
/*
* Optionally log the session traffic to a file. Useful for
* debugging and possibly also useful for actual logging.
*/
if (logfile) {
static FILE *fp = NULL;
if (!fp) fp = fopen("putty.log", "wb");
if (!fp) fp = fopen(logfile, "wb");
if (fp) fputc (c, fp);
}
#endif
if( termstate < DO_CTRLS && (c&0x60) == 0 ) {
switch (c) {
case '\005': /* terminal type query */

View File

@ -129,6 +129,11 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show) {
tolower(p[2]) == 'h') {
default_protocol = cfg.protocol = PROT_SSH;
default_port = cfg.port = 22;
} else if (q == p + 3 &&
tolower(p[0]) == 'l' &&
tolower(p[1]) == 'o' &&
tolower(p[2]) == 'g') {
logfile = "putty.log";
}
p = q + strspn(q, " \t");
}