static int new_folder (CalcHandle* handle, VarRequest* vr) { char *utf8; char *path; int ret; ret = nsp_session_open(handle, NSP_SID_FILE_MGMT); if (ret) { return ret; } path = g_strconcat("/", vr->folder, NULL); utf8 = ticonv_varname_to_utf8(handle->model, path, -1); ticalcs_slprintf(update_->text, sizeof(update_->text), _("Creating %s..."), utf8); ticonv_utf8_free(utf8); update_label(); ret = nsp_cmd_s_new_folder(handle, path); g_free(path); if (!ret) { ret = nsp_cmd_r_new_folder(handle); } DO_CLOSE_SESSION(handle); return ret; }
static int new_folder (CalcHandle* handle, VarRequest* vr) { char *utf8; char *path; int err; TRYF(nsp_session_open(handle, SID_FILE_MGMT)); path = g_strconcat("/", vr->folder, NULL); utf8 = ticonv_varname_to_utf8(handle->model, path, -1); g_snprintf(update_->text, sizeof(update_->text), _("Creating %s..."), utf8); g_free(utf8); update_label(); err = nsp_cmd_s_new_folder(handle, path); g_free(path); if (err) { return err; } TRYF(nsp_cmd_r_new_folder(handle)); TRYF(nsp_session_close(handle)); return 0; }