mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-01-10 01:48:00 +00:00
Roman Pompejus's patch to allow you to automatically select
overwrite or append in logging mode. [originally from svn r1049]
This commit is contained in:
parent
e259c7df5c
commit
639ab4c068
4
putty.h
4
putty.h
@ -83,6 +83,9 @@ GLOBAL int seen_disp_event;
|
|||||||
|
|
||||||
GLOBAL int session_closed;
|
GLOBAL int session_closed;
|
||||||
|
|
||||||
|
#define LGXF_OVR 1 /* existing logfile overwrite */
|
||||||
|
#define LGXF_APN 0 /* existing logfile append */
|
||||||
|
#define LGXF_ASK -1 /* existing logfile ask */
|
||||||
#define LGTYP_NONE 0 /* logmode: no logging */
|
#define LGTYP_NONE 0 /* logmode: no logging */
|
||||||
#define LGTYP_ASCII 1 /* logmode: pure ascii */
|
#define LGTYP_ASCII 1 /* logmode: pure ascii */
|
||||||
#define LGTYP_DEBUG 2 /* logmode: all chars of taffic */
|
#define LGTYP_DEBUG 2 /* logmode: all chars of taffic */
|
||||||
@ -237,6 +240,7 @@ typedef struct {
|
|||||||
int fontcharset;
|
int fontcharset;
|
||||||
char logfilename[FILENAME_MAX];
|
char logfilename[FILENAME_MAX];
|
||||||
int logtype;
|
int logtype;
|
||||||
|
int logxfovr;
|
||||||
int hide_mouseptr;
|
int hide_mouseptr;
|
||||||
char answerback[256];
|
char answerback[256];
|
||||||
/* Colour options */
|
/* Colour options */
|
||||||
|
@ -34,6 +34,7 @@ void save_settings (char *section, int do_host, Config *cfg) {
|
|||||||
write_setting_i (sesskey, "PortNumber", cfg->port);
|
write_setting_i (sesskey, "PortNumber", cfg->port);
|
||||||
write_setting_s (sesskey, "LogFileName", cfg->logfilename);
|
write_setting_s (sesskey, "LogFileName", cfg->logfilename);
|
||||||
write_setting_i (sesskey, "LogType", cfg->logtype);
|
write_setting_i (sesskey, "LogType", cfg->logtype);
|
||||||
|
write_setting_i (sesskey, "LogFileClash", cfg->logxfovr);
|
||||||
p = "raw";
|
p = "raw";
|
||||||
for (i = 0; backends[i].name != NULL; i++)
|
for (i = 0; backends[i].name != NULL; i++)
|
||||||
if (backends[i].protocol == cfg->protocol) {
|
if (backends[i].protocol == cfg->protocol) {
|
||||||
@ -175,6 +176,7 @@ void load_settings (char *section, int do_host, Config *cfg) {
|
|||||||
gpps (sesskey, "LogFileName", "putty.log",
|
gpps (sesskey, "LogFileName", "putty.log",
|
||||||
cfg->logfilename, sizeof(cfg->logfilename));
|
cfg->logfilename, sizeof(cfg->logfilename));
|
||||||
gppi (sesskey, "LogType", 0, &cfg->logtype);
|
gppi (sesskey, "LogType", 0, &cfg->logtype);
|
||||||
|
gppi (sesskey, "LogFileClash", LGXF_ASK, &cfg->logxfovr);
|
||||||
|
|
||||||
gpps (sesskey, "Protocol", "default", prot, 10);
|
gpps (sesskey, "Protocol", "default", prot, 10);
|
||||||
cfg->protocol = default_protocol;
|
cfg->protocol = default_protocol;
|
||||||
|
34
windlg.c
34
windlg.c
@ -232,6 +232,10 @@ enum { IDCX_ABOUT = IDC_ABOUT, IDCX_TVSTATIC, IDCX_TREEVIEW, controlstartvalue,
|
|||||||
IDC_LGFSTATIC,
|
IDC_LGFSTATIC,
|
||||||
IDC_LGFEDIT,
|
IDC_LGFEDIT,
|
||||||
IDC_LGFBUTTON,
|
IDC_LGFBUTTON,
|
||||||
|
IDC_LSTATXIST,
|
||||||
|
IDC_LSTATXOVR,
|
||||||
|
IDC_LSTATXAPN,
|
||||||
|
IDC_LSTATXASK,
|
||||||
loggingpanelend,
|
loggingpanelend,
|
||||||
|
|
||||||
keyboardpanelstart,
|
keyboardpanelstart,
|
||||||
@ -607,6 +611,10 @@ static void init_dlg_ctrls(HWND hwnd) {
|
|||||||
cfg.logtype == 0 ? IDC_LSTATOFF :
|
cfg.logtype == 0 ? IDC_LSTATOFF :
|
||||||
cfg.logtype == 1 ? IDC_LSTATASCII :
|
cfg.logtype == 1 ? IDC_LSTATASCII :
|
||||||
IDC_LSTATRAW);
|
IDC_LSTATRAW);
|
||||||
|
CheckRadioButton(hwnd, IDC_LSTATXOVR, IDC_LSTATXASK,
|
||||||
|
cfg.logxfovr == LGXF_OVR ? IDC_LSTATXOVR :
|
||||||
|
cfg.logxfovr == LGXF_ASK ? IDC_LSTATXASK :
|
||||||
|
IDC_LSTATXAPN);
|
||||||
{
|
{
|
||||||
char *p = cfg.environmt;
|
char *p = cfg.environmt;
|
||||||
while (*p) {
|
while (*p) {
|
||||||
@ -766,7 +774,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (panel == loggingpanelstart) {
|
if (panel == loggingpanelstart) {
|
||||||
/* The Logging panel. Accelerators used: [acgo] tplfw */
|
/* The Logging panel. Accelerators used: [acgo] tplfwes */
|
||||||
struct ctlpos cp;
|
struct ctlpos cp;
|
||||||
ctlposinit(&cp, hwnd, 80, 3, 13);
|
ctlposinit(&cp, hwnd, 80, 3, 13);
|
||||||
bartitle(&cp, "Options controlling session logging",
|
bartitle(&cp, "Options controlling session logging",
|
||||||
@ -780,6 +788,11 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
|
|||||||
editbutton(&cp, "Log &file name:",
|
editbutton(&cp, "Log &file name:",
|
||||||
IDC_LGFSTATIC, IDC_LGFEDIT, "Bro&wse...",
|
IDC_LGFSTATIC, IDC_LGFEDIT, "Bro&wse...",
|
||||||
IDC_LGFBUTTON);
|
IDC_LGFBUTTON);
|
||||||
|
radiobig(&cp,
|
||||||
|
"What to do if the log file already &exists:", IDC_LSTATXIST,
|
||||||
|
"Always overwrite it", IDC_LSTATXOVR,
|
||||||
|
"Always append to the end of it", IDC_LSTATXAPN,
|
||||||
|
"Ask the user every time", IDC_LSTATXASK, NULL);
|
||||||
endbox(&cp);
|
endbox(&cp);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -815,7 +828,7 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (panel == bellpanelstart) {
|
if (panel == bellpanelstart) {
|
||||||
/* The Bell panel. Accelerators used: [acgo] bdsm w */
|
/* The Bell panel. Accelerators used: [acgo] bdsm wt */
|
||||||
struct ctlpos cp;
|
struct ctlpos cp;
|
||||||
ctlposinit(&cp, hwnd, 80, 3, 13);
|
ctlposinit(&cp, hwnd, 80, 3, 13);
|
||||||
bartitle(&cp, "Options controlling the terminal bell",
|
bartitle(&cp, "Options controlling the terminal bell",
|
||||||
@ -838,11 +851,11 @@ static void create_controls(HWND hwnd, int dlgtype, int panel) {
|
|||||||
IDC_BELLOVL);
|
IDC_BELLOVL);
|
||||||
staticedit(&cp, "Over-use means this &many bells...",
|
staticedit(&cp, "Over-use means this &many bells...",
|
||||||
IDC_BELLOVLNSTATIC, IDC_BELLOVLN, 20);
|
IDC_BELLOVLNSTATIC, IDC_BELLOVLN, 20);
|
||||||
staticedit(&cp, "... in this many &seconds",
|
staticedit(&cp, "... in &this many seconds",
|
||||||
IDC_BELLOVLTSTATIC, IDC_BELLOVLT, 20);
|
IDC_BELLOVLTSTATIC, IDC_BELLOVLT, 20);
|
||||||
statictext(&cp, "The bell is re-enabled after a few seconds of silence.",
|
statictext(&cp, "The bell is re-enabled after a few seconds of silence.",
|
||||||
IDC_BELLOVLEXPLAIN);
|
IDC_BELLOVLEXPLAIN);
|
||||||
staticedit(&cp, "Seconds of silence required",
|
staticedit(&cp, "Seconds of &silence required",
|
||||||
IDC_BELLOVLSSTATIC, IDC_BELLOVLS, 20);
|
IDC_BELLOVLSSTATIC, IDC_BELLOVLS, 20);
|
||||||
endbox(&cp);
|
endbox(&cp);
|
||||||
}
|
}
|
||||||
@ -1823,6 +1836,16 @@ static int GenericMainDlgProc (HWND hwnd, UINT msg,
|
|||||||
if (IsDlgButtonChecked (hwnd, IDC_LSTATRAW)) cfg.logtype = 2;
|
if (IsDlgButtonChecked (hwnd, IDC_LSTATRAW)) cfg.logtype = 2;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case IDC_LSTATXASK:
|
||||||
|
case IDC_LSTATXAPN:
|
||||||
|
case IDC_LSTATXOVR:
|
||||||
|
if (HIWORD(wParam) == BN_CLICKED ||
|
||||||
|
HIWORD(wParam) == BN_DOUBLECLICKED) {
|
||||||
|
if (IsDlgButtonChecked (hwnd, IDC_LSTATXASK)) cfg.logxfovr = LGXF_ASK;
|
||||||
|
if (IsDlgButtonChecked (hwnd, IDC_LSTATXAPN)) cfg.logxfovr = LGXF_APN;
|
||||||
|
if (IsDlgButtonChecked (hwnd, IDC_LSTATXOVR)) cfg.logxfovr = LGXF_OVR;
|
||||||
|
}
|
||||||
|
break;
|
||||||
case IDC_TSEDIT:
|
case IDC_TSEDIT:
|
||||||
case IDC_R_TSEDIT:
|
case IDC_R_TSEDIT:
|
||||||
if (HIWORD(wParam) == EN_CHANGE)
|
if (HIWORD(wParam) == EN_CHANGE)
|
||||||
@ -2325,6 +2348,9 @@ int askappend(char *filename) {
|
|||||||
"or Cancel to disable logging.";
|
"or Cancel to disable logging.";
|
||||||
char message[sizeof(msgtemplate) + FILENAME_MAX];
|
char message[sizeof(msgtemplate) + FILENAME_MAX];
|
||||||
int mbret;
|
int mbret;
|
||||||
|
if ( cfg.logxfovr != LGXF_ASK ) {
|
||||||
|
return ( (cfg.logxfovr==LGXF_OVR) ? 2 : 1);
|
||||||
|
}
|
||||||
sprintf(message, msgtemplate, FILENAME_MAX, filename);
|
sprintf(message, msgtemplate, FILENAME_MAX, filename);
|
||||||
|
|
||||||
mbret = MessageBox(NULL, message, mbtitle,
|
mbret = MessageBox(NULL, message, mbtitle,
|
||||||
|
3
window.c
3
window.c
@ -42,6 +42,9 @@
|
|||||||
#define IDM_SAVEDSESS 0x0150
|
#define IDM_SAVEDSESS 0x0150
|
||||||
#define IDM_COPYALL 0x0160
|
#define IDM_COPYALL 0x0160
|
||||||
|
|
||||||
|
#define IDM_SESSLGP 0x0250 /* log type printable */
|
||||||
|
#define IDM_SESSLGA 0x0260 /* log type all chars */
|
||||||
|
#define IDM_SESSLGE 0x0270 /* log end */
|
||||||
#define IDM_SAVED_MIN 0x1000
|
#define IDM_SAVED_MIN 0x1000
|
||||||
#define IDM_SAVED_MAX 0x2000
|
#define IDM_SAVED_MAX 0x2000
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user