To: vim-dev@vim.org Subject: Patch 6.0.042 Fcc: outbox From: Bram Moolenaar MIME-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.0.042 Problem: ":mksession" can't handle file names with a space. Solution: Escape special characters in file names with a backslash. Files: src/ex_docmd.c *** ../vim60.41/src/ex_docmd.c Sun Oct 28 21:23:45 2001 --- src/ex_docmd.c Tue Oct 30 21:16:12 2001 *************** *** 8417,8423 **** /* * Write a file name to the session file. ! * Takes care of the "slash" option in 'sessionoptions'. * Returns FAIL if writing fails. */ static int --- 8417,8424 ---- /* * Write a file name to the session file. ! * Takes care of the "slash" option in 'sessionoptions' and escapes special ! * characters. * Returns FAIL if writing fails. */ static int *************** *** 8433,8451 **** sname = home_replace_save(NULL, name); if (sname != NULL) name = sname; ! if (*flagp & SSOP_SLASH) { ! while (*name) { ! c = *name++; ! if (c == '\\') ! c = '/'; ! if (putc(c, fd) != c) retval = FAIL; } } - else if (fputs((char *)name, fd) < 0) - retval = FAIL; vim_free(sname); return retval; } --- 8434,8475 ---- sname = home_replace_save(NULL, name); if (sname != NULL) name = sname; ! while (*name != NUL) { ! #ifdef FEAT_MBYTE { ! int l; ! ! if (has_mbyte && (l = (*mb_ptr2len_check)(name)) > 1) ! { ! /* copy a multibyte char */ ! while (--l >= 0) ! { ! if (putc(*name, fd) != *name) ! retval = FAIL; ! ++name; ! } ! continue; ! } ! } ! #endif ! c = *name++; ! if (c == '\\' && (*flagp & SSOP_SLASH)) ! /* change a backslash to a forward slash */ ! c = '/'; ! else if (vim_strchr(escape_chars, c) != NULL ! #ifdef BACKSLASH_IN_FILENAME ! && c != '\\' ! #endif ! ) ! { ! /* escape a special character with a backslash */ ! if (putc('\\', fd) != '\\') retval = FAIL; } + if (putc(c, fd) != c) + retval = FAIL; } vim_free(sname); return retval; } *** ../vim60.41/src/version.c Tue Oct 30 20:43:43 2001 --- src/version.c Tue Oct 30 20:59:56 2001 *************** *** 608,609 **** --- 608,611 ---- { /* Add new patch number below this line */ + /**/ + 42, /**/ -- ARTHUR: No, hang on! Just answer the five questions ... GALAHAD: Three questions ... ARTHUR: Three questions ... And we shall watch ... and pray. "Monty Python and the Holy Grail" PYTHON (MONTY) PICTURES LTD /// Bram Moolenaar -- Bram@moolenaar.net -- http://www.moolenaar.net \\\ ((( Creator of Vim -- http://vim.sf.net -- ftp://ftp.vim.org/pub/vim ))) \\\ Help me helping AIDS orphans in Uganda - http://iccf-holland.org ///