summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2004-12-19 22:46:22 +0000
committerBram Moolenaar <Bram@vim.org>2004-12-19 22:46:22 +0000
commit1cd871b5341bf43ee99e136844e3131014880f92 (patch)
tree6bd9573dbc14de3c4ec85e424cbec9c8d1ee0ed8 /src/main.c
parent46c9c73de8def79baf8f0a34a12549f6c14944f3 (diff)
downloadvim-git-1cd871b5341bf43ee99e136844e3131014880f92.tar.gz
updated for version 7.0023v7.0023
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c45
1 files changed, 41 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 5791bb640..133597015 100644
--- a/src/main.c
+++ b/src/main.c
@@ -2228,11 +2228,12 @@ main_loop(cmdwin)
getout_preserve_modified(exitval)
int exitval;
{
-#if defined(UNIX)
- /* Ignore SIGHUP, because a dropped connection may make Vim exit and then
- * get a SIGHUP while exiting, which causes various reentrent problems. */
+# if defined(SIGHUP) && defined(SIG_IGN)
+ /* Ignore SIGHUP, because a dropped connection causes a read error, which
+ * makes Vim exit and then handling SIGHUP causes various reentrance
+ * problems. */
signal(SIGHUP, SIG_IGN);
-#endif
+# endif
ml_close_notmod(); /* close all not-modified buffers */
ml_sync_all(FALSE, FALSE); /* preserve all swap files */
@@ -3220,6 +3221,42 @@ eval_client_expr_to_string(expr)
return res;
}
+/*
+ * If conversion is needed, convert "data" from "client_enc" to 'encoding' and
+ * return an allocated string. Otherwise return "data".
+ * "*tofree" is set to the result when it needs to be freed later.
+ */
+/*ARGSUSED*/
+ char_u *
+serverConvert(client_enc, data, tofree)
+ char_u *client_enc;
+ char_u *data;
+ char_u **tofree;
+{
+ char_u *res = data;
+
+ *tofree = NULL;
+# ifdef FEAT_MBYTE
+ if (client_enc != NULL && p_enc != NULL)
+ {
+ vimconv_T vimconv;
+
+ vimconv.vc_type = CONV_NONE;
+ if (convert_setup(&vimconv, client_enc, p_enc) != FAIL
+ && vimconv.vc_type != CONV_NONE)
+ {
+ res = string_convert(&vimconv, data, NULL);
+ if (res == NULL)
+ res = data;
+ else
+ *tofree = res;
+ }
+ convert_setup(&vimconv, NULL, NULL);
+ }
+# endif
+ return res;
+}
+
/*
* Make our basic server name: use the specified "arg" if given, otherwise use