Exemplo n.º 1
0
void mac_savesession(void)
{
    Session *s = mac_windowsession(FrontWindow());
    void *sesshandle;

    assert(s->hasfile);
    sesshandle = open_settings_w_fsp(&s->savefile);
    if (sesshandle == NULL) return; /* XXX report error */
    save_open_settings(sesshandle, &s->cfg);
    close_settings_w(sesshandle);
}
Exemplo n.º 2
0
char *save_settings(char *section, Config * cfg)
{
    void *sesskey;
    char *errmsg;

    sesskey = open_settings_w(section, &errmsg);
    if (!sesskey)
	return errmsg;
    save_open_settings(sesskey, cfg);
    close_settings_w(sesskey);
    return NULL;
}
Exemplo n.º 3
0
char *backup_settings(const char *section,const char* path)
{
    void *sesskey;
    char *errmsg;
	FileStore fileStore(path);
	Config cfg;

    if (!strcmp(section, DEFAULT_SESSION_NAME)) return NULL;

    sesskey = fileStore.open_settings_w(section, &errmsg);
    if (!sesskey)
	return errmsg;
	load_settings(section, &cfg);
    save_open_settings(&fileStore, sesskey, &cfg);
    fileStore.close_settings_w(sesskey);
    return NULL;
}
Exemplo n.º 4
0
void mac_savesessionas(void)
{
#if !TARGET_API_MAC_CARBON /* XXX Navigation Services */
    Session *s = mac_windowsession(FrontWindow());
    StandardFileReply sfr;
    void *sesshandle;

    StandardPutFile("\pSave session as:",
		    s->hasfile ? s->savefile.name : "\puntitled", &sfr);
    if (!sfr.sfGood) return;

    if (!sfr.sfReplacing) {
	FSpCreateResFile(&sfr.sfFile, PUTTY_CREATOR, SESS_TYPE, sfr.sfScript);
	if (ResError() != noErr) return; /* XXX report error */
    }
    sesshandle = open_settings_w_fsp(&sfr.sfFile);
    if (sesshandle == NULL) return; /* XXX report error */
    save_open_settings(sesshandle, &s->cfg);
    close_settings_w(sesshandle);
    s->hasfile = TRUE;
    s->savefile = sfr.sfFile;
#endif
}
Exemplo n.º 5
0
char *save_settings(const char *section, Config * cfg)
{
    void *sesskey;
    char *errmsg;

    if (!section || !*section || !strcmp(section, DEFAULT_SESSION_NAME)) return NULL;
    //debug
    /*
    {
        Config tmpCfg;
        load_settings(section, &tmpCfg);
        if (*tmpCfg.host){
            assert (!strcmp(tmpCfg.host, cfg->host)
                && tmpCfg.port == cfg->port);
        }
    }
    */
    sesskey = gStorage->open_settings_w(section, &errmsg);
    if (!sesskey)
	return errmsg;
    save_open_settings(gStorage, sesskey, cfg);
    gStorage->close_settings_w(sesskey);
    return NULL;
}