To: vim-dev@vim.org Subject: Patch 6.2.016 Fcc: outbox From: Bram Moolenaar Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit ------------ Patch 6.2.016 Problem: Using ":scscope find" with 'cscopequickfix' does not always split the window. (Gary Johnson) Win32: ":cscope add" could make the script that contains it read-only until the corresponding ":cscope kill". Errors during ":cscope add" may not be handled properly. Solution: When using the quickfix window may need to split the window. Avoid file handle inheritance for the script. Check for a failed connection and/or process. (Sergey Khorev) Files: src/ex_cmds2.c, src/if_cscope.c *** ../vim-6.2.015/src/ex_cmds2.c Thu May 29 11:26:29 2003 --- src/ex_cmds2.c Thu Jun 19 23:42:05 2003 *************** *** 11,17 **** --- 11,26 ---- * ex_cmds2.c: some more functions for command line commands */ + #if defined(WIN32) && defined(FEAT_CSCOPE) + # include + #endif + #include "vim.h" + + #if defined(WIN32) && defined(FEAT_CSCOPE) + # include + #endif + #include "version.h" static void cmd_source __ARGS((char_u *fname, exarg_T *eap)); *************** *** 2016,2021 **** --- 2025,2049 ---- #define SCRIPT_INO(id) (((struct scriptstuff *)script_names.ga_data)[(id) - 1].ino) #endif + #if defined(WIN32) && defined(FEAT_CSCOPE) + static FILE *fopen_noinh_readbin __ARGS((char *filename)); + + /* + * Special function to open a file without handle inheritance. + */ + static FILE * + fopen_noinh_readbin(filename) + char *filename; + { + int fd_tmp = open(filename, O_RDONLY | O_BINARY | O_NOINHERIT); + + if (fd_tmp == -1) + return NULL; + return fdopen(fd_tmp, READBIN); + } + #endif + + /* * do_source: Read the file "fname" and execute its lines as EX commands. * *************** *** 2070,2076 **** --- 2098,2108 ---- goto theend; } + #if defined(WIN32) && defined(FEAT_CSCOPE) + cookie.fp = fopen_noinh_readbin((char *)fname_exp); + #else cookie.fp = mch_fopen((char *)fname_exp, READBIN); + #endif if (cookie.fp == NULL && check_other) { /* *************** *** 2087,2093 **** --- 2119,2129 ---- *p = '.'; else *p = '_'; + #if defined(WIN32) && defined(FEAT_CSCOPE) + cookie.fp = fopen_noinh_readbin((char *)fname_exp); + #else cookie.fp = mch_fopen((char *)fname_exp, READBIN); + #endif } } *** ../vim-6.2.015/src/if_cscope.c Tue Jun 3 20:40:22 2003 --- src/if_cscope.c Sun Jun 22 17:10:23 2003 *************** *** 517,523 **** --- 517,526 ---- { if (cs_create_connection(i) == CSCOPE_FAILURE || cs_read_prompt(i) == CSCOPE_FAILURE) + { + cs_release_csp(i, TRUE); goto add_err; + } if (p_csverbose) { *************** *** 1095,1101 **** --- 1098,1116 ---- fclose(f); /* '-' starts a new error list */ if (qf_init(tmp, (char_u *)"%f%*\\t%l%*\\t%m", *qfpos == '-') > 0) + { + # ifdef FEAT_WINDOWS + if (postponed_split != 0) + { + win_split(postponed_split > 0 ? postponed_split : 0, 0); + # ifdef FEAT_SCROLLBIND + curwin->w_p_scb = FALSE; + # endif + postponed_split = 0; + } + # endif qf_jump(0, 0, forceit); + } mch_remove(tmp); vim_free(tmp); return TRUE; *************** *** 1794,1802 **** #endif ) ; ! if (s > path && *s == '/' #ifdef WIN32 ! || s > path && *s == '\\' #endif ) ++s; --- 1809,1817 ---- #endif ) ; ! if ((s > path && *s == '/') #ifdef WIN32 ! || (s > path && *s == '\\') #endif ) ++s; *************** *** 2081,2090 **** /* * Trying to exit normally (not sure whether it is fit to UNIX cscope */ ! (void)fputs("q\n", csinfo[i].to_fp); ! (void)fflush(csinfo[i].to_fp); /* give cscope chance to exit normally */ ! if (WaitForSingleObject(csinfo[i].hProc, 1000) == WAIT_TIMEOUT) TerminateProcess(csinfo[i].hProc, 0); #endif --- 2096,2109 ---- /* * Trying to exit normally (not sure whether it is fit to UNIX cscope */ ! if (csinfo[i].to_fp != NULL) ! { ! (void)fputs("q\n", csinfo[i].to_fp); ! (void)fflush(csinfo[i].to_fp); ! } /* give cscope chance to exit normally */ ! if (csinfo[i].hProc > 0 ! && WaitForSingleObject(csinfo[i].hProc, 1000) == WAIT_TIMEOUT) TerminateProcess(csinfo[i].hProc, 0); #endif *** ../vim-6.2.015/src/version.c Mon Jun 30 22:18:22 2003 --- src/version.c Mon Jun 30 22:25:27 2003 *************** *** 632,633 **** --- 632,635 ---- { /* Add new patch number below this line */ + /**/ + 16, /**/ -- hundred-and-one symptoms of being an internet addict: 264. You turn to the teletext page "surfing report" and are surprised that it is about sizes of waves and a weather forecast for seaside resorts. /// Bram Moolenaar -- Bram@Moolenaar.net -- http://www.Moolenaar.net \\\ /// Creator of Vim - Vi IMproved -- http://www.Vim.org \\\ \\\ Project leader for A-A-P -- http://www.A-A-P.org /// \\\ Help AIDS victims, buy at Amazon -- http://ICCF.nl/click1.html ///