int inv_botlin, lb_botlin, lb_linenum, o_cpos;
int newlines, lpos, temp, n0, num, prompt_lines_estimate;
char *prompt_this_line;
+ int mb_cur_max = MB_CUR_MAX;
#if defined (HANDLE_MULTIBYTE)
wchar_t wc;
size_t wc_bytes;
int wc_width;
mbstate_t ps;
int _rl_wrapped_multicolumn = 0;
- int mb_cur_max = MB_CUR_MAX;
#endif
if (_rl_echoing_p == 0)
not the first. */
if (out >= _rl_screenchars)
{
+#if defined (HANDLE_MULTIBYTE)
if (mb_cur_max > 1 && rl_byte_oriented == 0)
out = _rl_find_prev_mbchar (line, _rl_screenchars, MB_FIND_ANY);
else
+#endif
out = _rl_screenchars - 1;
}
mode = overwrite ? O_WRONLY|O_CREAT|O_TRUNC|O_BINARY : O_WRONLY|O_APPEND|O_BINARY;
#endif
histname = history_filename (filename);
- tempname = (overwrite && histname) ? history_tempfile (histname) : 0;
- output = tempname ? tempname : histname;
exists = histname ? (stat (histname, &finfo) == 0) : 0;
+ tempname = (overwrite && exists && S_ISREG (finfo.st_mode)) ? history_tempfile (histname) : 0;
+ output = tempname ? tempname : histname;
+
file = output ? open (output, mode, 0600) : -1;
rv = 0;