Tagging the 0.76.1.8 release of the KiTTY project.
This commit is contained in:
+131
-120
@@ -26,6 +26,8 @@ int GetPuttyFlag(void) ;
|
||||
int GetHyperlinkFlag(void) ;
|
||||
int GetCursorType() ;
|
||||
void SetCursorType( const int ct ) ;
|
||||
extern HWND MainHwnd ;
|
||||
int ManageLocalCmd( HWND hwnd, const char * cmd ) ;
|
||||
#endif
|
||||
#ifdef MOD_HYPERLINK
|
||||
/*
|
||||
@@ -1150,33 +1152,34 @@ static termline *lineptr(Terminal *term, int y, int lineno, int screen)
|
||||
int treeindex;
|
||||
|
||||
if (y >= 0) {
|
||||
whichtree = term->screen;
|
||||
treeindex = y;
|
||||
whichtree = term->screen;
|
||||
treeindex = y;
|
||||
} else {
|
||||
int altlines = 0;
|
||||
int altlines = 0;
|
||||
|
||||
#ifndef MOD_PERSO
|
||||
assert(!screen);
|
||||
#endif
|
||||
if (term->erase_to_scrollback &&
|
||||
term->alt_which && term->alt_screen) {
|
||||
altlines = term->alt_sblines;
|
||||
}
|
||||
if (y < -altlines) {
|
||||
whichtree = term->scrollback;
|
||||
treeindex = y + altlines + count234(term->scrollback);
|
||||
} else {
|
||||
whichtree = term->alt_screen;
|
||||
treeindex = y + term->alt_sblines;
|
||||
/* treeindex = y + count234(term->alt_screen); */
|
||||
}
|
||||
if (term->erase_to_scrollback &&
|
||||
term->alt_which && term->alt_screen) {
|
||||
altlines = term->alt_sblines;
|
||||
}
|
||||
if (y < -altlines) {
|
||||
whichtree = term->scrollback;
|
||||
treeindex = y + altlines + count234(term->scrollback);
|
||||
} else {
|
||||
whichtree = term->alt_screen;
|
||||
treeindex = y + term->alt_sblines;
|
||||
/* treeindex = y + count234(term->alt_screen); */
|
||||
}
|
||||
}
|
||||
if (whichtree == term->scrollback) {
|
||||
compressed_scrollback_line *cline = index234(whichtree, treeindex);
|
||||
compressed_scrollback_line *cline = index234(whichtree, treeindex);
|
||||
if (!cline)
|
||||
null_line_error(term, y, lineno, whichtree, treeindex, "cline");
|
||||
line = decompressline(cline);
|
||||
line = decompressline(cline);
|
||||
} else {
|
||||
line = index234(whichtree, treeindex);
|
||||
line = index234(whichtree, treeindex);
|
||||
}
|
||||
|
||||
/* We assume that we don't screw up and retrieve something out of range. */
|
||||
@@ -1235,21 +1238,21 @@ static void term_timer(void *ctx, unsigned long now)
|
||||
Terminal *term = (Terminal *)ctx;
|
||||
|
||||
if (term->tblink_pending && now == term->next_tblink) {
|
||||
term->tblinker = !term->tblinker;
|
||||
term->tblink_pending = false;
|
||||
term_schedule_tblink(term);
|
||||
term->tblinker = !term->tblinker;
|
||||
term->tblink_pending = false;
|
||||
term_schedule_tblink(term);
|
||||
term->window_update_pending = true;
|
||||
}
|
||||
|
||||
if (term->cblink_pending && now == term->next_cblink) {
|
||||
term->cblinker = !term->cblinker;
|
||||
term->cblink_pending = false;
|
||||
term_schedule_cblink(term);
|
||||
term->cblinker = !term->cblinker;
|
||||
term->cblink_pending = false;
|
||||
term_schedule_cblink(term);
|
||||
term->window_update_pending = true;
|
||||
}
|
||||
|
||||
if (term->in_vbell && now == term->vbell_end) {
|
||||
term->in_vbell = false;
|
||||
term->in_vbell = false;
|
||||
term->window_update_pending = true;
|
||||
}
|
||||
|
||||
@@ -1268,7 +1271,7 @@ static void term_update_callback(void *ctx)
|
||||
if (!term->window_update_pending)
|
||||
return;
|
||||
if (!term->window_update_cooldown) {
|
||||
term_update(term);
|
||||
term_update(term);
|
||||
term->window_update_cooldown = true;
|
||||
term->window_update_cooldown_end = schedule_timer(
|
||||
UPDATE_DELAY, term_timer, term);
|
||||
@@ -1278,7 +1281,7 @@ static void term_update_callback(void *ctx)
|
||||
static void term_schedule_update(Terminal *term)
|
||||
{
|
||||
if (!term->window_update_pending) {
|
||||
term->window_update_pending = true;
|
||||
term->window_update_pending = true;
|
||||
queue_toplevel_callback(term_update_callback, term);
|
||||
}
|
||||
}
|
||||
@@ -3815,32 +3818,43 @@ static void do_osc(Terminal *term)
|
||||
} else
|
||||
#endif
|
||||
if (term->osc_w) {
|
||||
while (term->osc_strlen--)
|
||||
term->wordness[(unsigned char)
|
||||
term->osc_string[term->osc_strlen]] = term->esc_args[0];
|
||||
while (term->osc_strlen--)
|
||||
term->wordness[(unsigned char)
|
||||
term->osc_string[term->osc_strlen]] = term->esc_args[0];
|
||||
} else {
|
||||
term->osc_string[term->osc_strlen] = '\0';
|
||||
switch (term->esc_args[0]) {
|
||||
case 0:
|
||||
case 1:
|
||||
term->osc_string[term->osc_strlen] = '\0';
|
||||
switch (term->esc_args[0]) {
|
||||
case 0:
|
||||
case 1:
|
||||
if (!term->no_remote_wintitle) {
|
||||
sfree(term->icon_title);
|
||||
term->icon_title = dupstr(term->osc_string);
|
||||
term->win_icon_title_pending = true;
|
||||
term_schedule_update(term);
|
||||
}
|
||||
if (term->esc_args[0] == 1)
|
||||
break;
|
||||
/* fall through: parameter 0 means set both */
|
||||
case 2:
|
||||
case 21:
|
||||
if (term->esc_args[0] == 1)
|
||||
break;
|
||||
/* fall through: parameter 0 means set both */
|
||||
case 2:
|
||||
case 21:
|
||||
if (!term->no_remote_wintitle) {
|
||||
#ifdef MOD_PERSO
|
||||
if( (strlen(term->osc_string)>2) && (term->osc_string[0]=='_') && (term->osc_string[1]=='_') ) {
|
||||
ManageLocalCmd( MainHwnd, term->osc_string+2 ) ;
|
||||
} else {
|
||||
sfree(term->window_title);
|
||||
term->window_title = dupstr(term->osc_string);
|
||||
term->win_title_pending = true;
|
||||
term_schedule_update(term);
|
||||
}
|
||||
#else
|
||||
sfree(term->window_title);
|
||||
term->window_title = dupstr(term->osc_string);
|
||||
term->win_title_pending = true;
|
||||
term_schedule_update(term);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
break;
|
||||
case 4:
|
||||
if (term->ldisc && !strcmp(term->osc_string, "?")) {
|
||||
unsigned index = term->esc_args[1];
|
||||
@@ -3857,63 +3871,60 @@ static void do_osc(Terminal *term)
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef MOD_PRINTCLIP
|
||||
/*
|
||||
* Windows clipboard support
|
||||
* Diomidis Spinellis, June 2003
|
||||
*/
|
||||
static char *clip_b, *clip_bp; /* Buffer, pointer to buffer insertion point */
|
||||
static size_t clip_bsiz, clip_remsiz; /* Buffer, size, remaining size */
|
||||
static size_t clip_total; /* Total read */
|
||||
|
||||
#define CLIP_CHUNK 16384
|
||||
|
||||
static void clipboard_init(void)
|
||||
{
|
||||
if (clip_b)
|
||||
sfree(clip_b);
|
||||
clip_bp = clip_b = smalloc(clip_remsiz = clip_bsiz = CLIP_CHUNK);
|
||||
clip_total = 0;
|
||||
}
|
||||
|
||||
static void clipboard_data(const void *buff, int len)
|
||||
{
|
||||
memcpy(clip_bp, buff, len);
|
||||
clip_remsiz -= len;
|
||||
clip_total += len;
|
||||
clip_bp += len;
|
||||
if (clip_remsiz < CLIP_CHUNK) {
|
||||
clip_b = srealloc(clip_b, clip_bsiz *= 2);
|
||||
clip_remsiz = clip_bsiz - clip_total;
|
||||
clip_bp = clip_b + clip_total;
|
||||
}
|
||||
}
|
||||
|
||||
static void clipboard_copy(void)
|
||||
{
|
||||
HANDLE hglb;
|
||||
|
||||
if (!OpenClipboard(NULL))
|
||||
return; // error("Unable to open the clipboard");
|
||||
if (!EmptyClipboard()) {
|
||||
CloseClipboard();
|
||||
return; // error("Unable to empty the clipboard");
|
||||
}
|
||||
|
||||
hglb = GlobalAlloc(GMEM_DDESHARE, clip_total + 1);
|
||||
if (hglb == NULL) {
|
||||
CloseClipboard();
|
||||
return; // error("Unable to allocate clipboard memory");
|
||||
}
|
||||
memcpy(hglb, clip_b, clip_total);
|
||||
((char *)hglb)[clip_total] = '\0';
|
||||
SetClipboardData(CF_TEXT, hglb);
|
||||
CloseClipboard();
|
||||
}
|
||||
/*
|
||||
* Windows clipboard support
|
||||
* Diomidis Spinellis, June 2003
|
||||
*/
|
||||
static char *clip_b, *clip_bp; /* Buffer, pointer to buffer insertion point */
|
||||
static size_t clip_bsiz, clip_remsiz; /* Buffer, size, remaining size */
|
||||
static size_t clip_total; /* Total read */
|
||||
|
||||
#define CLIP_CHUNK 16384
|
||||
|
||||
static void clipboard_init(void) {
|
||||
if (clip_b)
|
||||
sfree(clip_b);
|
||||
clip_bp = clip_b = smalloc(clip_remsiz = clip_bsiz = CLIP_CHUNK);
|
||||
clip_total = 0;
|
||||
}
|
||||
|
||||
static void clipboard_data(const void *buff, int len) {
|
||||
memcpy(clip_bp, buff, len);
|
||||
clip_remsiz -= len;
|
||||
clip_total += len;
|
||||
clip_bp += len;
|
||||
if (clip_remsiz < CLIP_CHUNK) {
|
||||
clip_b = srealloc(clip_b, clip_bsiz *= 2);
|
||||
clip_remsiz = clip_bsiz - clip_total;
|
||||
clip_bp = clip_b + clip_total;
|
||||
}
|
||||
}
|
||||
|
||||
static void clipboard_copy(void) {
|
||||
HANDLE hglb;
|
||||
|
||||
if (!OpenClipboard(NULL))
|
||||
return; // error("Unable to open the clipboard");
|
||||
if (!EmptyClipboard()) {
|
||||
CloseClipboard();
|
||||
return; // error("Unable to empty the clipboard");
|
||||
}
|
||||
|
||||
hglb = GlobalAlloc(GMEM_DDESHARE, clip_total + 1);
|
||||
if (hglb == NULL) {
|
||||
CloseClipboard();
|
||||
return; // error("Unable to allocate clipboard memory");
|
||||
}
|
||||
memcpy(hglb, clip_b, clip_total);
|
||||
((char *)hglb)[clip_total] = '\0';
|
||||
SetClipboardData(CF_TEXT, hglb);
|
||||
CloseClipboard();
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
@@ -3923,9 +3934,9 @@ static void term_print_setup(Terminal *term, char *printer)
|
||||
{
|
||||
bufchain_clear(&term->printer_buf);
|
||||
#ifdef MOD_PRINTCLIP
|
||||
if ( conf_get_int(term->conf,CONF_printclip) )
|
||||
clipboard_init();
|
||||
else
|
||||
if ( conf_get_int(term->conf,CONF_printclip) )
|
||||
clipboard_init();
|
||||
else
|
||||
#endif
|
||||
term->print_job = printer_start_job(printer);
|
||||
}
|
||||
@@ -3933,16 +3944,16 @@ static void term_print_flush(Terminal *term)
|
||||
{
|
||||
size_t size;
|
||||
while ((size = bufchain_size(&term->printer_buf)) > 5) {
|
||||
ptrlen data = bufchain_prefix(&term->printer_buf);
|
||||
if (data.len > size-5)
|
||||
data.len = size-5;
|
||||
ptrlen data = bufchain_prefix(&term->printer_buf);
|
||||
if (data.len > size-5)
|
||||
data.len = size-5;
|
||||
#ifdef MOD_PRINTCLIP
|
||||
if ( conf_get_int(term->conf,CONF_printclip) )
|
||||
clipboard_data(data.ptr, data.len);
|
||||
else
|
||||
if ( conf_get_int(term->conf,CONF_printclip) )
|
||||
clipboard_data(data.ptr, data.len);
|
||||
else
|
||||
#endif
|
||||
printer_job_data(term->print_job, data.ptr, data.len);
|
||||
bufchain_consume(&term->printer_buf, data.len);
|
||||
printer_job_data(term->print_job, data.ptr, data.len);
|
||||
bufchain_consume(&term->printer_buf, data.len);
|
||||
}
|
||||
}
|
||||
static void term_print_finish(Terminal *term)
|
||||
@@ -3951,29 +3962,29 @@ static void term_print_finish(Terminal *term)
|
||||
char c;
|
||||
|
||||
if (!term->printing && !term->only_printing)
|
||||
return; /* we need do nothing */
|
||||
return; /* we need do nothing */
|
||||
|
||||
term_print_flush(term);
|
||||
while ((size = bufchain_size(&term->printer_buf)) > 0) {
|
||||
ptrlen data = bufchain_prefix(&term->printer_buf);
|
||||
c = *(char *)data.ptr;
|
||||
if (c == '\033' || c == '\233') {
|
||||
bufchain_consume(&term->printer_buf, size);
|
||||
break;
|
||||
} else {
|
||||
ptrlen data = bufchain_prefix(&term->printer_buf);
|
||||
c = *(char *)data.ptr;
|
||||
if (c == '\033' || c == '\233') {
|
||||
bufchain_consume(&term->printer_buf, size);
|
||||
break;
|
||||
} else {
|
||||
#ifdef MOD_PRINTCLIP
|
||||
if ( conf_get_int(term->conf,CONF_printclip) )
|
||||
clipboard_data(&c, 1);
|
||||
else
|
||||
if ( conf_get_int(term->conf,CONF_printclip) )
|
||||
clipboard_data(&c, 1);
|
||||
else
|
||||
#endif
|
||||
printer_job_data(term->print_job, &c, 1);
|
||||
bufchain_consume(&term->printer_buf, 1);
|
||||
}
|
||||
printer_job_data(term->print_job, &c, 1);
|
||||
bufchain_consume(&term->printer_buf, 1);
|
||||
}
|
||||
}
|
||||
#ifdef MOD_PRINTCLIP
|
||||
if ( conf_get_int(term->conf,CONF_printclip) )
|
||||
clipboard_copy();
|
||||
else
|
||||
if ( conf_get_int(term->conf,CONF_printclip) )
|
||||
clipboard_copy();
|
||||
else
|
||||
#endif
|
||||
printer_finish_job(term->print_job);
|
||||
term->print_job = NULL;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#define RELEASE 0.76
|
||||
#define TEXTVER "Release 0.76"
|
||||
#define SSHVER "-Release-0.76"
|
||||
#define BINARY_VERSION 0,76,1,7
|
||||
#define BINARY_VERSION 0,76,1,8
|
||||
#define SOURCE_COMMIT "unavailable"
|
||||
|
||||
@@ -1 +1 @@
|
||||
7
|
||||
8
|
||||
|
||||
@@ -7814,9 +7814,9 @@ static void wintw_set_title(TermWin *tw, const char *title_in) {
|
||||
|
||||
title = (char*)malloc( strlen(title_in)+1 ) ; strcpy( title, title_in ) ;
|
||||
|
||||
if( (title[0]=='_')&&(title[1]=='_') ) { // Remote command
|
||||
if( ManageLocalCmd( MainHwnd, title+2 ) ) { free( title ) ; return ; }
|
||||
}
|
||||
//if( (title[0]=='_')&&(title[1]=='_') ) { // Remote command ==> moved in terminal.c
|
||||
// if( ManageLocalCmd( MainHwnd, title+2 ) ) { free( title ) ; return ; }
|
||||
//}
|
||||
|
||||
if( !GetTitleBarFlag() ) { set_title_internal( tw, title ) ; free( title ) ; return ; }
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
0.76.1.7
|
||||
0.76.1.8
|
||||
@@ -2571,129 +2571,129 @@ dt() { printf "\033]0;__dt:"$(hostname)":"${USER}":"`pwd`"\007" ; }
|
||||
*/
|
||||
static int LocalCmdFlag = 1 ;
|
||||
int ManageLocalCmd( HWND hwnd, const char * cmd ) {
|
||||
//if( !LocalCmdFlag ) { return 0; }
|
||||
char buffer[1024] = "", title[1024] = "" ;
|
||||
if( debug_flag ) { debug_logevent( "Local command: %s", cmd ) ; }
|
||||
if( cmd == NULL ) return 0 ;
|
||||
if( (cmd[2] != ':')&&(cmd[2] != '\0') ) return 0 ;
|
||||
if( (cmd[2] == ':')&&( strlen( cmd ) <= 3 ) ) return 0 ;
|
||||
if( (cmd[0]=='p')&&(cmd[1]=='w')&&(cmd[2]==':') ) { // __pw: nouveau remote directory
|
||||
if( RemotePath!= NULL ) free( RemotePath ) ;
|
||||
RemotePath = (char*) malloc( strlen( cmd ) - 2 ) ;
|
||||
strcpy( RemotePath, cmd+3 ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='r')&&(cmd[1]=='v')&&(cmd[2]==':') ) { // __rv: Reception d'un fichiers
|
||||
GetOneFile( hwnd, RemotePath, cmd+3 ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='p')&&(cmd[1]=='l')&&(cmd[2]==':') ) { // __pl: Lance une commande plink
|
||||
RunExternPlink( hwnd, cmd+3 ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='t')&&(cmd[1]=='i')&&(cmd[2]=='\0') ) { // __ti: Recuperation du titre de la fenetre
|
||||
GetWindowText( hwnd, buffer, 1024 ) ;
|
||||
sprintf( title, "printf \"\\033]0;%s\\007\"\n", buffer ) ;
|
||||
SendStrToTerminal( title, strlen(title) ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='i')&&(cmd[1]=='n')&&(cmd[2]==':') ) { // __in: Affiche d'information dans le log
|
||||
debug_logevent(cmd+3) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='w')&&(cmd[1]=='s')&&(cmd[2]==':') ) { // __ws: Lance WinSCP dans un repertoire donne
|
||||
if( RemotePath!= NULL ) free( RemotePath ) ;
|
||||
RemotePath = (char*) malloc( strlen( cmd ) - 2 ) ;
|
||||
strcpy( RemotePath, cmd+3 ) ;
|
||||
StartWinSCP( hwnd, RemotePath, NULL, NULL ) ;
|
||||
// free( RemotePath ) ; RemotePath = NULL ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='w')&&(cmd[1]=='t')&&(cmd[2]==':') ) { // __wt: Lance WinSCP dans sur un host et un user donné et dans un repertoire donné
|
||||
char host[1024]="";char user[256]="";
|
||||
int i;
|
||||
if( RemotePath!= NULL ) free( RemotePath ) ;
|
||||
RemotePath = (char*) malloc( strlen( cmd ) - 2 ) ;
|
||||
strcpy(host,cmd+3);i=poss(":",host);
|
||||
strcpy(user,host+i);
|
||||
host[i-1]='\0';
|
||||
i=poss(":",user);
|
||||
strcpy( RemotePath, user+i ) ;
|
||||
user[i-1]='\0';
|
||||
StartWinSCP( hwnd, RemotePath, host, user ) ;
|
||||
// free( RemotePath ) ; RemotePath = NULL ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='i')&&(cmd[1]=='e')&&(cmd[2]==':') ) { // __ie: Lance un navigateur sur le lien
|
||||
if( strlen(cmd+3)>0 ) {
|
||||
urlhack_launch_url(!conf_get_int(conf,CONF_url_defbrowser)?conf_get_filename(conf,CONF_url_browser)->path:NULL, (const char *)(cmd+3));
|
||||
return 1;
|
||||
}
|
||||
} else if( (cmd[0]=='d')&&(cmd[1]=='s')&&(cmd[2]==':') ) { // __ds: Lance une session dupliquee dans le meme repertoire ds() { printf "\033]0;__ds:`pwd`\007" ; }
|
||||
if( RemotePath!= NULL ) free( RemotePath ) ;
|
||||
RemotePath = (char*) malloc( strlen( cmd ) - 2 ) ;
|
||||
strcpy( RemotePath, cmd+3 ) ;
|
||||
RunSessionWithCurrentSettings( hwnd, conf, NULL, NULL, NULL, 0, RemotePath ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='d')&&(cmd[1]=='t')&&(cmd[2]==':') ) { // __dt: Lance une session dupliquee dans le meme repertoire, meme host, meme user dt() { printf "\033]0;__dt:"$(hostname)":"${USER}":"`pwd`"\007" ; }
|
||||
char host[1024]="";char user[256]="";
|
||||
int i;
|
||||
if( RemotePath!= NULL ) free( RemotePath ) ;
|
||||
RemotePath = (char*) malloc( strlen( cmd ) - 2 ) ;
|
||||
strcpy(host,cmd+3);i=poss(":",host);
|
||||
strcpy(user,host+i);
|
||||
host[i-1]='\0';
|
||||
i=poss(":",user);
|
||||
strcpy( RemotePath, user+i ) ;
|
||||
user[i-1]='\0';
|
||||
RunSessionWithCurrentSettings( hwnd, conf, host, user, NULL, 0, RemotePath ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='l')&&(cmd[1]=='s')&&(cmd[2]==':') ) { // __ls: envoie un script sauvegardé localement (comme fait le CTRL+F2)
|
||||
RunScriptFile( hwnd, cmd+3 ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='c')&&(cmd[1]=='m')&&(cmd[2]==':') ) { // __cm: Execute une commande externe
|
||||
RunCommand( hwnd, cmd+3 ) ;
|
||||
return 1 ;
|
||||
}
|
||||
return 0 ;
|
||||
//if( !LocalCmdFlag ) { return 0; }
|
||||
char buffer[1024] = "", title[1024] = "" ;
|
||||
if( debug_flag ) { debug_logevent( "Local command: %s", cmd ) ; }
|
||||
if( cmd == NULL ) return 0 ;
|
||||
if( (cmd[2] != ':')&&(cmd[2] != '\0') ) return 0 ;
|
||||
if( (cmd[2] == ':')&&( strlen( cmd ) <= 3 ) ) return 0 ;
|
||||
if( (cmd[0]=='p')&&(cmd[1]=='w')&&(cmd[2]==':') ) { // __pw: nouveau remote directory
|
||||
if( RemotePath!= NULL ) free( RemotePath ) ;
|
||||
RemotePath = (char*) malloc( strlen( cmd ) - 2 ) ;
|
||||
strcpy( RemotePath, cmd+3 ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='r')&&(cmd[1]=='v')&&(cmd[2]==':') ) { // __rv: Reception d'un fichiers
|
||||
GetOneFile( hwnd, RemotePath, cmd+3 ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='p')&&(cmd[1]=='l')&&(cmd[2]==':') ) { // __pl: Lance une commande plink
|
||||
RunExternPlink( hwnd, cmd+3 ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='t')&&(cmd[1]=='i')&&(cmd[2]=='\0') ) { // __ti: Recuperation du titre de la fenetre
|
||||
GetWindowText( hwnd, buffer, 1024 ) ;
|
||||
sprintf( title, "printf \"\\033]0;%s\\007\"\n", buffer ) ;
|
||||
SendStrToTerminal( title, strlen(title) ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='i')&&(cmd[1]=='n')&&(cmd[2]==':') ) { // __in: Affiche d'information dans le log
|
||||
debug_logevent(cmd+3) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='w')&&(cmd[1]=='s')&&(cmd[2]==':') ) { // __ws: Lance WinSCP dans un repertoire donne
|
||||
if( RemotePath!= NULL ) free( RemotePath ) ;
|
||||
RemotePath = (char*) malloc( strlen( cmd ) - 2 ) ;
|
||||
strcpy( RemotePath, cmd+3 ) ;
|
||||
StartWinSCP( hwnd, RemotePath, NULL, NULL ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='w')&&(cmd[1]=='t')&&(cmd[2]==':') ) { // __wt: Lance WinSCP dans sur un host et un user donné et dans un repertoire donné
|
||||
char host[1024]="";char user[256]="";
|
||||
int i;
|
||||
if( RemotePath!= NULL ) free( RemotePath ) ;
|
||||
RemotePath = (char*) malloc( strlen( cmd ) - 2 ) ;
|
||||
strcpy(host,cmd+3);i=poss(":",host);
|
||||
strcpy(user,host+i);
|
||||
host[i-1]='\0';
|
||||
i=poss(":",user);
|
||||
strcpy( RemotePath, user+i ) ;
|
||||
user[i-1]='\0';
|
||||
StartWinSCP( hwnd, RemotePath, host, user ) ;
|
||||
// free( RemotePath ) ; RemotePath = NULL ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='i')&&(cmd[1]=='e')&&(cmd[2]==':') ) { // __ie: Lance un navigateur sur le lien
|
||||
if( strlen(cmd+3)>0 ) {
|
||||
urlhack_launch_url(!conf_get_int(conf,CONF_url_defbrowser)?conf_get_filename(conf,CONF_url_browser)->path:NULL, (const char *)(cmd+3));
|
||||
return 1;
|
||||
}
|
||||
} else if( (cmd[0]=='d')&&(cmd[1]=='s')&&(cmd[2]==':') ) { // __ds: Lance une session dupliquee dans le meme repertoire ds() { printf "\033]0;__ds:`pwd`\007" ; }
|
||||
if( RemotePath!= NULL ) free( RemotePath ) ;
|
||||
RemotePath = (char*) malloc( strlen( cmd ) - 2 ) ;
|
||||
strcpy( RemotePath, cmd+3 ) ;
|
||||
if( debug_flag ) { debug_logevent( "Start the same session in remote path: %s", RemotePath ) ; }
|
||||
RunSessionWithCurrentSettings( hwnd, conf, NULL, NULL, NULL, 0, RemotePath ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='d')&&(cmd[1]=='t')&&(cmd[2]==':') ) { // __dt: Lance une session dupliquee dans le meme repertoire, meme host, meme user dt() { printf "\033]0;__dt:"$(hostname)":"${USER}":"`pwd`"\007" ; }
|
||||
char host[1024]="";char user[256]="";
|
||||
int i;
|
||||
if( RemotePath!= NULL ) free( RemotePath ) ;
|
||||
RemotePath = (char*) malloc( strlen( cmd ) - 2 ) ;
|
||||
strcpy(host,cmd+3);i=poss(":",host);
|
||||
strcpy(user,host+i);
|
||||
host[i-1]='\0';
|
||||
i=poss(":",user);
|
||||
strcpy( RemotePath, user+i ) ;
|
||||
user[i-1]='\0';
|
||||
RunSessionWithCurrentSettings( hwnd, conf, host, user, NULL, 0, RemotePath ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='l')&&(cmd[1]=='s')&&(cmd[2]==':') ) { // __ls: envoie un script sauvegardé localement (comme fait le CTRL+F2)
|
||||
RunScriptFile( hwnd, cmd+3 ) ;
|
||||
return 1 ;
|
||||
} else if( (cmd[0]=='c')&&(cmd[1]=='m')&&(cmd[2]==':') ) { // __cm: Execute une commande externe
|
||||
RunCommand( hwnd, cmd+3 ) ;
|
||||
return 1 ;
|
||||
}
|
||||
return 0 ;
|
||||
}
|
||||
|
||||
// Recupere les coordonnees de la fenetre
|
||||
void GetWindowCoord( HWND hwnd ) {
|
||||
RECT rc ;
|
||||
GetWindowRect( hwnd, &rc ) ;
|
||||
RECT rc ;
|
||||
GetWindowRect( hwnd, &rc ) ;
|
||||
|
||||
conf_set_int(conf,CONF_xpos,rc.left);
|
||||
conf_set_int(conf,CONF_ypos,rc.top);
|
||||
conf_set_int(conf,CONF_xpos,rc.left);
|
||||
conf_set_int(conf,CONF_ypos,rc.top);
|
||||
|
||||
conf_set_int(conf,CONF_windowstate,IsZoomed( hwnd ));
|
||||
conf_set_int(conf,CONF_windowstate,IsZoomed( hwnd ));
|
||||
}
|
||||
|
||||
// Sauve les coordonnees de la fenetre
|
||||
void SaveWindowCoord( Conf * conf ) {
|
||||
char key[1024], session[1024] ;
|
||||
if( conf_get_bool(conf,CONF_saveonexit) )
|
||||
if( conf_get_str(conf,CONF_sessionname)!= NULL )
|
||||
if( strlen( conf_get_str(conf,CONF_sessionname) ) > 0 ) {
|
||||
if( IniFileFlag == SAVEMODE_REG ) {
|
||||
mungestr( conf_get_str(conf,CONF_sessionname), session ) ;
|
||||
sprintf( key, "%s\\Sessions\\%s", TEXT(PUTTY_REG_POS), session ) ;
|
||||
RegTestOrCreateDWORD( HKEY_CURRENT_USER, key, "TermXPos", conf_get_int(conf,CONF_xpos) ) ;
|
||||
RegTestOrCreateDWORD( HKEY_CURRENT_USER, key, "TermYPos", conf_get_int(conf,CONF_ypos) ) ;
|
||||
RegTestOrCreateDWORD( HKEY_CURRENT_USER, key, "TermWidth", conf_get_int(conf,CONF_width) ) ;
|
||||
RegTestOrCreateDWORD( HKEY_CURRENT_USER, key, "TermHeight", conf_get_int(conf,CONF_height) ) ;
|
||||
RegTestOrCreateDWORD( HKEY_CURRENT_USER, key, "WindowState", conf_get_int(conf,CONF_windowstate) ) ;
|
||||
RegTestOrCreateDWORD( HKEY_CURRENT_USER, key, "TransparencyValue", conf_get_int(conf,CONF_transparencynumber) ) ;
|
||||
} else {
|
||||
int xpos=conf_get_int(conf,CONF_xpos)
|
||||
, ypos=conf_get_int(conf,CONF_ypos)
|
||||
, width=conf_get_int(conf,CONF_width)
|
||||
, height=conf_get_int(conf,CONF_height)
|
||||
, windowstate=conf_get_int(conf,CONF_windowstate)
|
||||
, transparency=conf_get_int(conf,CONF_transparencynumber);
|
||||
load_settings( conf_get_str(conf,CONF_sessionname), conf ) ;
|
||||
conf_set_int(conf,CONF_xpos,xpos) ;
|
||||
conf_set_int(conf,CONF_ypos,ypos) ;
|
||||
conf_set_int(conf,CONF_width,width) ;
|
||||
conf_set_int(conf,CONF_height,height) ;
|
||||
conf_set_int(conf,CONF_windowstate,windowstate) ;
|
||||
conf_set_int(conf,CONF_transparencynumber,transparency) ;
|
||||
save_settings( conf_get_str(conf,CONF_sessionname), conf ) ;
|
||||
}
|
||||
}
|
||||
char key[1024], session[1024] ;
|
||||
if( conf_get_bool(conf,CONF_saveonexit) )
|
||||
if( conf_get_str(conf,CONF_sessionname)!= NULL )
|
||||
if( strlen( conf_get_str(conf,CONF_sessionname) ) > 0 ) {
|
||||
if( IniFileFlag == SAVEMODE_REG ) {
|
||||
mungestr( conf_get_str(conf,CONF_sessionname), session ) ;
|
||||
sprintf( key, "%s\\Sessions\\%s", TEXT(PUTTY_REG_POS), session ) ;
|
||||
RegTestOrCreateDWORD( HKEY_CURRENT_USER, key, "TermXPos", conf_get_int(conf,CONF_xpos) ) ;
|
||||
RegTestOrCreateDWORD( HKEY_CURRENT_USER, key, "TermYPos", conf_get_int(conf,CONF_ypos) ) ;
|
||||
RegTestOrCreateDWORD( HKEY_CURRENT_USER, key, "TermWidth", conf_get_int(conf,CONF_width) ) ;
|
||||
RegTestOrCreateDWORD( HKEY_CURRENT_USER, key, "TermHeight", conf_get_int(conf,CONF_height) ) ;
|
||||
RegTestOrCreateDWORD( HKEY_CURRENT_USER, key, "WindowState", conf_get_int(conf,CONF_windowstate) ) ;
|
||||
RegTestOrCreateDWORD( HKEY_CURRENT_USER, key, "TransparencyValue", conf_get_int(conf,CONF_transparencynumber) ) ;
|
||||
} else {
|
||||
int xpos=conf_get_int(conf,CONF_xpos)
|
||||
, ypos=conf_get_int(conf,CONF_ypos)
|
||||
, width=conf_get_int(conf,CONF_width)
|
||||
, height=conf_get_int(conf,CONF_height)
|
||||
, windowstate=conf_get_int(conf,CONF_windowstate)
|
||||
, transparency=conf_get_int(conf,CONF_transparencynumber);
|
||||
load_settings( conf_get_str(conf,CONF_sessionname), conf ) ;
|
||||
conf_set_int(conf,CONF_xpos,xpos) ;
|
||||
conf_set_int(conf,CONF_ypos,ypos) ;
|
||||
conf_set_int(conf,CONF_width,width) ;
|
||||
conf_set_int(conf,CONF_height,height) ;
|
||||
conf_set_int(conf,CONF_windowstate,windowstate) ;
|
||||
conf_set_int(conf,CONF_transparencynumber,transparency) ;
|
||||
save_settings( conf_get_str(conf,CONF_sessionname), conf ) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Gestion de la fonction winroll
|
||||
|
||||
Reference in New Issue
Block a user