summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2005-07-18 21:40:44 +0000
committerBram Moolenaar <Bram@vim.org>2005-07-18 21:40:44 +0000
commitb635633989f0ff5a5dbb564d65d332741f0e3e8d (patch)
treec7c744c865d0004b0ed58a2f573d8cbbce7ab7b8
parente759a7aa9a514626cd0373d1bd4e92777b1730c5 (diff)
downloadvim-git-b635633989f0ff5a5dbb564d65d332741f0e3e8d.tar.gz
updated for version 7.0109
-rw-r--r--runtime/indent/perl.vim8
-rw-r--r--src/Make_mvc.mak80
-rw-r--r--src/buffer.c9
-rw-r--r--src/ex_docmd.c2
-rw-r--r--src/getchar.c6
-rw-r--r--src/netbeans.c3
-rw-r--r--src/os_mac.c17
-rw-r--r--src/os_riscos.c2
-rw-r--r--src/spell.c29
-rw-r--r--src/vim.h2
-rw-r--r--src/window.c3
11 files changed, 91 insertions, 70 deletions
diff --git a/runtime/indent/perl.vim b/runtime/indent/perl.vim
index 1af058043..56cb2ab1f 100644
--- a/runtime/indent/perl.vim
+++ b/runtime/indent/perl.vim
@@ -2,7 +2,7 @@
" Language: Perl
" Author: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
" URL: http://rgarciasuarez.free.fr/vim/indent/perl.vim
-" Last Change: 2003 Apr 25
+" Last Change: 2005 Jul 15
" Suggestions and improvements by :
" Aaron J. Sherman (use syntax for hints)
@@ -28,9 +28,6 @@ let b:did_indent = 1
" Is syntax highlighting active ?
let b:indent_use_syntax = has("syntax") && &syntax == "perl"
-let s:cpo_save = &cpo
-set cpo-=C
-
setlocal indentexpr=GetPerlIndent()
setlocal indentkeys+=0=,0),0=or,0=and
if !b:indent_use_syntax
@@ -42,6 +39,9 @@ if exists("*GetPerlIndent")
finish
endif
+let s:cpo_save = &cpo
+set cpo-=C
+
function GetPerlIndent()
" Get the line to be indented
diff --git a/src/Make_mvc.mak b/src/Make_mvc.mak
index 144f956cd..7b54f469a 100644
--- a/src/Make_mvc.mak
+++ b/src/Make_mvc.mak
@@ -216,7 +216,7 @@ CTAGS = ctags
# SNIFF - Include support for SNiFF+.
SNIFF_INCL = if_sniff.h
SNIFF_OBJ = $(OBJDIR)/if_sniff.obj
-SNIFF_LIB = shell32.lib
+SNIFF_LIB = shell32.lib
SNIFF_DEFS = -DFEAT_SNIFF
# The SNiFF integration needs multithreaded libraries!
MULTITHREADED = yes
@@ -250,7 +250,7 @@ NBDEBUG_DEFS = -DNBDEBUG
NBDEBUG_INCL = nbdebug.h
NBDEBUG_SRC = nbdebug.c
!endif
-NETBEANS_LIB = WSock32.lib
+NETBEANS_LIB = WSock32.lib
!endif
!ifdef XPM
@@ -294,7 +294,8 @@ WINVER = 0x0400
CFLAGS = -c /W3 /nologo $(CVARS) -I. -Iproto -DHAVE_PATHDEF -DWIN32 \
$(SNIFF_DEFS) $(CSCOPE_DEFS) $(NETBEANS_DEFS) \
$(NBDEBUG_DEFS) $(XPM_DEFS) \
- $(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER)
+ $(DEFINES) -DWINVER=$(WINVER) -D_WIN32_WINNT=$(WINVER) \
+ /Fo$(OUTDIR)/
#>>>>> end of choices
###########################################################################
@@ -500,7 +501,8 @@ TCL_VER_LONG = 8.3
!if "$(DYNAMIC_TCL)" == "yes"
!message Tcl DLL will be loaded dynamically
TCL_DLL = tcl$(TCL_VER).dll
-CFLAGS = $(CFLAGS) -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
+CFLAGS = $(CFLAGS) -DFEAT_TCL -DDYNAMIC_TCL -DDYNAMIC_TCL_DLL=\"$(TCL_DLL)\" \
+ -DDYNAMIC_TCL_VER=\"$(TCL_VER_LONG)\"
TCL_OBJ = $(OUTDIR)\if_tcl.obj
TCL_INC = /I "$(TCL)\Include" /I "$(TCL)"
TCL_LIB = $(TCL)\lib\tclstub$(TCL_VER).lib
@@ -525,7 +527,8 @@ CFLAGS = $(CFLAGS) -DFEAT_PYTHON
PYTHON_OBJ = $(OUTDIR)\if_python.obj
PYTHON_INC = /I "$(PYTHON)\Include" /I "$(PYTHON)\PC"
!if "$(DYNAMIC_PYTHON)" == "yes"
-CFLAGS = $(CFLAGS) -DDYNAMIC_PYTHON -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
+CFLAGS = $(CFLAGS) -DDYNAMIC_PYTHON \
+ -DDYNAMIC_PYTHON_DLL=\"python$(PYTHON_VER).dll\"
PYTHON_LIB = /nodefaultlib:python$(PYTHON_VER).lib
!else
PYTHON_LIB = $(PYTHON)\libs\python$(PYTHON_VER).lib
@@ -541,9 +544,12 @@ MZSCHEME_VER = 205_000
CFLAGS = $(CFLAGS) -DFEAT_MZSCHEME -I $(MZSCHEME)\include
!if "$(DYNAMIC_MZSCHEME)" == "yes"
!message MzScheme DLLs will be loaded dynamically
-CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
+CFLAGS = $(CFLAGS) -DDYNAMIC_MZSCHEME \
+ -DDYNAMIC_MZSCH_DLL=\"libmzsch$(MZSCHEME_VER).dll\" \
+ -DDYNAMIC_MZGC_DLL=\"libmzgc$(MZSCHEME_VER).dll\"
!else
-MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib $(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
+MZSCHEME_LIB = $(MZSCHEME)\lib\msvc\libmzgc$(MZSCHEME_VER).lib \
+ $(MZSCHEME)\lib\msvc\libmzsch$(MZSCHEME_VER).lib
!endif
MZSCHEME_OBJ = $(OUTDIR)\if_mzsch.obj
!endif
@@ -631,7 +637,8 @@ RUBY_LIB = $(RUBY)\lib\$(RUBY_INSTALL_NAME).lib
# Do we want to load Ruby dynamically?
!if "$(DYNAMIC_RUBY)" == "yes"
!message Ruby DLL will be loaded dynamically
-CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\" -DDYNAMIC_RUBY_VER=$(RUBY_VER)
+CFLAGS = $(CFLAGS) -DDYNAMIC_RUBY -DDYNAMIC_RUBY_VER=$(RUBY_VER) \
+ -DDYNAMIC_RUBY_DLL=\"$(RUBY_INSTALL_NAME).dll\"
!undef RUBY_LIB
!endif
!endif # RUBY
@@ -655,8 +662,7 @@ CFLAGS = $(CFLAGS) -DFEAT_$(FEATURES)
# Always generate the .pdb file, so that we get debug symbols that can be used
# on a crash (doesn't add overhead to the executable).
#
-CFLAGS = $(CFLAGS) /Zi
-PDB = /Fd$(OUTDIR)/
+CFLAGS = $(CFLAGS) /Zi /Fd$(OUTDIR)/
LINK_PDB = /PDB:$(OUTDIR)/$(VIM).pdb -debug:full -debugtype:cv,fixup
#
@@ -676,17 +682,20 @@ conflags = $(conflags) /map /mapinfo:lines
LINKARGS1 = $(linkdebug) $(conflags) /nodefaultlib:libc
LINKARGS2 = $(CON_LIB) $(GUI_LIB) $(LIBC) $(OLE_LIB) user32.lib $(SNIFF_LIB) \
- $(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(RUBY_LIB) $(TCL_LIB) \
- $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)
+ $(MZSCHEME_LIB) $(PERL_LIB) $(PYTHON_LIB) $(RUBY_LIB) \
+ $(TCL_LIB) $(NETBEANS_LIB) $(XPM_LIB) $(LINK_PDB)
-all: $(VIM).exe vimrun.exe install.exe uninstal.exe xxd/xxd.exe GvimExt/gvimext.dll
+all: $(VIM).exe vimrun.exe install.exe uninstal.exe xxd/xxd.exe \
+ GvimExt/gvimext.dll
-$(VIM).exe: $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) $(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) version.c version.h
- $(CC) $(CFLAGS) version.c /Fo$(OUTDIR)/version.obj $(PDB)
+$(VIM).exe: $(OUTDIR) $(OBJ) $(GUI_OBJ) $(OLE_OBJ) $(OLE_IDL) $(MZSCHEME_OBJ) \
+ $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \
+ $(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) version.c version.h
+ $(CC) $(CFLAGS) version.c
$(link) $(LINKARGS1) -out:$(VIM).exe $(OBJ) $(GUI_OBJ) $(OLE_OBJ) \
- $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) $(TCL_OBJ) $(SNIFF_OBJ) \
- $(CSCOPE_OBJ) $(NETBEANS_OBJ) $(XPM_OBJ) \
- $(OUTDIR)\version.obj $(LINKARGS2)
+ $(MZSCHEME_OBJ) $(PERL_OBJ) $(PYTHON_OBJ) $(RUBY_OBJ) \
+ $(TCL_OBJ) $(SNIFF_OBJ) $(CSCOPE_OBJ) $(NETBEANS_OBJ) \
+ $(XPM_OBJ) $(OUTDIR)\version.obj $(LINKARGS2)
$(VIM): $(VIM).exe
@@ -694,7 +703,8 @@ $(OUTDIR):
if not exist $(OUTDIR)/nul mkdir $(OUTDIR)
install.exe: dosinst.c
- $(CC) /nologo -DNDEBUG -DWIN32 dosinst.c kernel32.lib shell32.lib ole32.lib advapi32.lib uuid.lib
+ $(CC) /nologo -DNDEBUG -DWIN32 dosinst.c kernel32.lib shell32.lib \
+ ole32.lib advapi32.lib uuid.lib
- if exist install.exe del install.exe
ren dosinst.exe install.exe
@@ -767,7 +777,7 @@ testclean:
!ELSE
.c{$(OUTDIR)/}.obj::
!ENDIF
- $(CC) $(CFLAGS) /Fo$(OUTDIR)/ $(PDB) $<
+ $(CC) $(CFLAGS) $<
# Create a default rule for transforming .cpp files to .obj files in $(OUTDIR)
# Batch compilation is supported by nmake 1.62 (part of VS 5.0) and later)
@@ -776,7 +786,7 @@ testclean:
!ELSE
.cpp{$(OUTDIR)/}.obj::
!ENDIF
- $(CC) $(CFLAGS) /Fo$(OUTDIR)/ $(PDB) $<
+ $(CC) $(CFLAGS) $<
$(OUTDIR)/buffer.obj: $(OUTDIR) buffer.c $(INCL)
@@ -817,30 +827,32 @@ $(OUTDIR)/gui_w32.obj: $(OUTDIR) gui_w32.c gui_w48.c $(INCL) $(GUI_INCL)
$(OUTDIR)/if_cscope.obj: $(OUTDIR) if_cscope.c $(INCL)
if_perl.c : if_perl.xs typemap
- $(PERL_EXE) $(XSUBPP) -prototypes -typemap $(XSUBPP_TYPEMAP) -typemap typemap if_perl.xs > if_perl.c
+ $(PERL_EXE) $(XSUBPP) -prototypes -typemap $(XSUBPP_TYPEMAP) \
+ -typemap typemap if_perl.xs > if_perl.c
$(OUTDIR)/if_perl.obj: $(OUTDIR) if_perl.c $(INCL)
- $(CC) $(CFLAGS) $(PERL_INC) if_perl.c /Fo$(OUTDIR)/if_perl.obj $(PDB)
+ $(CC) $(CFLAGS) $(PERL_INC) if_perl.c
$(OUTDIR)/if_perlsfio.obj: $(OUTDIR) if_perlsfio.c $(INCL)
- $(CC) $(CFLAGS) $(PERL_INC) if_perlsfio.c /Fo$(OUTDIR)/if_perlsfio.obj $(PDB)
+ $(CC) $(CFLAGS) $(PERL_INC) if_perlsfio.c
$(OUTDIR)/if_mzsch.obj: $(OUTDIR) if_mzsch.c $(INCL)
- $(CC) $(CFLAGS) $(PERL_INC) if_mzsch.c /Fo$(OUTDIR)/if_mzsch.obj $(PDB) -DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\"
+ $(CC) $(CFLAGS) $(PERL_INC) if_mzsch.c
+ -DMZSCHEME_COLLECTS=\"$(MZSCHEME:\=\\)\\collects\"
$(OUTDIR)/if_python.obj: $(OUTDIR) if_python.c $(INCL)
- $(CC) $(CFLAGS) $(PYTHON_INC) if_python.c /Fo$(OUTDIR)/if_python.obj $(PDB)
+ $(CC) $(CFLAGS) $(PYTHON_INC) if_python.c
$(OUTDIR)/if_ole.obj: $(OUTDIR) if_ole.cpp $(INCL) if_ole.h
$(OUTDIR)/if_ruby.obj: $(OUTDIR) if_ruby.c $(INCL)
- $(CC) $(CFLAGS) $(RUBY_INC) if_ruby.c /Fo$(OUTDIR)/if_ruby.obj $(PDB)
+ $(CC) $(CFLAGS) $(RUBY_INC) if_ruby.c
$(OUTDIR)/if_sniff.obj: $(OUTDIR) if_sniff.c $(INCL)
- $(CC) $(CFLAGS) if_sniff.c /Fo$(OUTDIR)/if_sniff.obj $(PDB)
+ $(CC) $(CFLAGS) if_sniff.c
$(OUTDIR)/if_tcl.obj: $(OUTDIR) if_tcl.c $(INCL)
- $(CC) $(CFLAGS) $(TCL_INC) if_tcl.c /Fo$(OUTDIR)/if_tcl.obj $(PDB)
+ $(CC) $(CFLAGS) $(TCL_INC) if_tcl.c
$(OUTDIR)/main.obj: $(OUTDIR) main.c $(INCL)
@@ -877,7 +889,7 @@ $(OUTDIR)/os_win32.obj: $(OUTDIR) os_win32.c $(INCL) os_win32.h
$(OUTDIR)/os_w32exe.obj: $(OUTDIR) os_w32exe.c $(INCL)
$(OUTDIR)/pathdef.obj: $(OUTDIR) auto/pathdef.c $(INCL)
- $(CC) $(CFLAGS) auto/pathdef.c /Fo$(OUTDIR)/pathdef.obj $(PDB)
+ $(CC) $(CFLAGS) auto/pathdef.c
$(OUTDIR)/quickfix.obj: $(OUTDIR) quickfix.c $(INCL)
@@ -902,13 +914,15 @@ $(OUTDIR)/undo.obj: $(OUTDIR) undo.c $(INCL)
$(OUTDIR)/window.obj: $(OUTDIR) window.c $(INCL)
$(OUTDIR)/xpm_w32.obj: $(OUTDIR) xpm_w32.c
- $(CC) $(CFLAGS) $(XPM_INC) xpm_w32.c /Fo$(OUTDIR)/xpm_w32.obj $(PDB)
+ $(CC) $(CFLAGS) $(XPM_INC) xpm_w32.c
-$(OUTDIR)/vim.res: $(OUTDIR) vim.rc version.h tools.bmp tearoff.bmp vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico
+$(OUTDIR)/vim.res: $(OUTDIR) vim.rc version.h tools.bmp tearoff.bmp \
+ vim.ico vim_error.ico vim_alert.ico vim_info.ico vim_quest.ico
$(RC) /l 0x409 /Fo$(OUTDIR)/vim.res $(RCFLAGS) vim.rc
iid_ole.c if_ole.h vim.tlb: if_ole.idl
- midl /nologo /error none /proxy nul /iid iid_ole.c /tlb vim.tlb /header if_ole.h if_ole.idl
+ midl /nologo /error none /proxy nul /iid iid_ole.c /tlb vim.tlb \
+ /header if_ole.h if_ole.idl
dimm.h dimm_i.c: dimm.idl
midl /nologo /error none /proxy nul dimm.idl
diff --git a/src/buffer.c b/src/buffer.c
index ce984ed02..07e9723a0 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3036,9 +3036,8 @@ maketitle()
else
{
p = transstr(gettail(curbuf->b_fname));
- STRNCPY(buf, p, IOSIZE - 100);
+ vim_strncpy(buf, p, IOSIZE - 100);
vim_free(p);
- buf[IOSIZE - 100] = NUL; /* in case it was too long */
}
switch (bufIsChanged(curbuf)
@@ -3071,15 +3070,15 @@ maketitle()
p = gettail_sep(buf + off);
if (p == buf + off)
/* must be a help buffer */
- STRCPY(buf + off, _("help"));
+ vim_strncpy(buf + off, (char_u *)_("help"),
+ IOSIZE - off - 1);
else
*p = NUL;
/* translate unprintable chars */
p = transstr(buf + off);
- STRNCPY(buf + off, p, IOSIZE - off);
+ vim_strncpy(buf + off, p, IOSIZE - off - 1);
vim_free(p);
- buf[IOSIZE - 1] = NUL; /* in case it was too long */
STRCAT(buf, ")");
}
diff --git a/src/ex_docmd.c b/src/ex_docmd.c
index 4a83ca013..b5c636c76 100644
--- a/src/ex_docmd.c
+++ b/src/ex_docmd.c
@@ -7286,7 +7286,7 @@ ex_cd(eap)
if (p == NULL || *p == NUL) /* empty is the same as not set */
NameBuff[0] = NUL;
else
- STRNCPY(NameBuff, p, MAXPATHL);
+ vim_strncpy(NameBuff, p, MAXPATHL - 1);
# else
expand_env((char_u *)"$HOME", NameBuff, MAXPATHL);
# endif
diff --git a/src/getchar.c b/src/getchar.c
index 311fe584d..bc30d6c99 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -257,8 +257,7 @@ add_buff(buf, s, slen)
if (buf->bh_space >= (int)slen)
{
len = (long_u)STRLEN(buf->bh_curr->b_str);
- STRNCPY(buf->bh_curr->b_str + len, s, slen);
- buf->bh_curr->b_str[len + slen] = NUL;
+ vim_strncpy(buf->bh_curr->b_str + len, s, (size_t)slen);
buf->bh_space -= slen;
}
else
@@ -272,8 +271,7 @@ add_buff(buf, s, slen)
if (p == NULL)
return; /* no space, just forget it */
buf->bh_space = len - slen;
- STRNCPY(p->b_str, s, slen);
- p->b_str[slen] = NUL;
+ vim_strncpy(p->b_str, s, (size_t)slen);
p->b_next = buf->bh_curr->b_next;
buf->bh_curr->b_next = p;
diff --git a/src/netbeans.c b/src/netbeans.c
index bebfa5e44..9150e1451 100644
--- a/src/netbeans.c
+++ b/src/netbeans.c
@@ -2769,8 +2769,7 @@ netbeans_inserted(
/* send the "insert" EVT */
newtxt = alloc(newlen + 1);
- STRNCPY(newtxt, txt, newlen);
- newtxt[newlen] = '\0';
+ vim_strncpy(newtxt, txt, newlen);
p = nb_quote(newtxt);
if (p != NULL)
{
diff --git a/src/os_mac.c b/src/os_mac.c
index baab5a5a3..4a3014ba5 100644
--- a/src/os_mac.c
+++ b/src/os_mac.c
@@ -211,8 +211,7 @@ mac_expandpath(
if (gErr == noErr)
{
- STRNCPY (cfilename, &dirname[1], dirname[0]);
- cfilename[dirname[0]] = 0;
+ vim_strncpy(cfilename, &dirname[1], dirname[0]);
if (vim_regexec(&regmatch, cfilename, (colnr_T)0))
{
if (s[-1] != ':')
@@ -261,8 +260,7 @@ mac_expandpath(
gErr = PBHGetVInfo (&gMyHPBlock,false);
if (gErr == noErr)
{
- STRNCPY (cfilename, &dirname[1], dirname[0]);
- cfilename[dirname[0]] = 0;
+ vim_strncpy(cfilename, &dirname[1], dirname[0]);
if (vim_regexec(&regmatch, cfilename, (colnr_T)0))
{
STRCPY(s, cfilename);
@@ -681,8 +679,7 @@ mch_get_user_name(s, len)
if ((pw = getpwuid(uid)) != NULL
&& pw->pw_name != NULL && *(pw->pw_name) != NUL)
{
- STRNCPY(s, pw->pw_name, len);
- s[len - 1] = NUL;
+ vim_strncpy(s, pw->pw_name, len - 1);
return OK;
}
#endif
@@ -700,16 +697,15 @@ mch_get_host_name(s, len)
int len;
{
#if defined(__MRC__) || defined(__SC__) || defined(__APPLE_CC__)
- STRNCPY(s, "Mac", len); /* TODO: use Gestalt information */
+ vim_strncpy(s, "Mac", len - 1); /* TODO: use Gestalt information */
#else
struct utsname vutsname;
if (uname(&vutsname) < 0)
*s = NUL;
else
- STRNCPY(s, vutsname.nodename, len);
+ vim_strncpy(s, vutsname.nodename, len - 1);
#endif
- s[len - 1] = NUL; /* make sure it's terminated */
}
/*
@@ -950,8 +946,7 @@ mch_FullName(fname, buf, len, force)
}
else
{
- STRNCPY(buf, fname, len);
- buf[len - 1] = NUL;
+ vim_strncpy(buf, fname, len - 1);
slash_n_colon_adjust(buf);
}
diff --git a/src/os_riscos.c b/src/os_riscos.c
index 289495008..39a03cc36 100644
--- a/src/os_riscos.c
+++ b/src/os_riscos.c
@@ -523,7 +523,7 @@ mch_get_host_name(s, len)
if (xswi(OS_ReadVarVal, "Machine$Name", s, len, 0, 3) & v_flag)
{
/* Variable does not exist (normal operation) */
- STRNCPY(s, "(unknown)", len);
+ vim_strncpy(s, "(unknown)", len - 1);
}
}
diff --git a/src/spell.c b/src/spell.c
index f93027d03..52b7b4aa6 100644
--- a/src/spell.c
+++ b/src/spell.c
@@ -2545,6 +2545,7 @@ did_set_spelllang(buf)
garray_T ga;
char_u *splp;
char_u *region;
+ char_u region_cp[3];
int filename;
int region_mask;
slang_T *lp;
@@ -2577,6 +2578,19 @@ did_set_spelllang(buf)
{
filename = TRUE;
+ /* Locate a region and remove it from the file name. */
+ p = vim_strchr(gettail(lang), '_');
+ if (p != NULL && ASCII_ISALPHA(p[1]) && ASCII_ISALPHA(p[2])
+ && !ASCII_ISALPHA(p[3]))
+ {
+ vim_strncpy(region_cp, p + 1, 2);
+ mch_memmove(p, p + 3, len - (p - lang) - 2);
+ len -= 3;
+ region = region_cp;
+ }
+ else
+ dont_use_region = TRUE;
+
/* Check if we loaded this language before. */
for (lp = first_lang; lp != NULL; lp = lp->sl_next)
if (fullpathcmp(lang, lp->sl_fname, FALSE) == FPC_SAME)
@@ -2590,12 +2604,6 @@ did_set_spelllang(buf)
region = lang + len - 2;
len -= 3;
lang[len] = NUL;
-
- /* If the region differs from what was used before then don't
- * use it for 'spellfile'. */
- if (use_region != NULL && STRCMP(region, use_region) != 0)
- dont_use_region = TRUE;
- use_region = region;
}
else
dont_use_region = TRUE;
@@ -2606,6 +2614,15 @@ did_set_spelllang(buf)
break;
}
+ if (region != NULL)
+ {
+ /* If the region differs from what was used before then don't
+ * use it for 'spellfile'. */
+ if (use_region != NULL && STRCMP(region, use_region) != 0)
+ dont_use_region = TRUE;
+ use_region = region;
+ }
+
/* If not found try loading the language now. */
if (lp == NULL)
{
diff --git a/src/vim.h b/src/vim.h
index cdffd4a50..d8cd69973 100644
--- a/src/vim.h
+++ b/src/vim.h
@@ -1897,7 +1897,7 @@ typedef int proftime_T; /* dummy for function prototypes */
/* values for vim_handle_signal() that are not a signal */
#define SIGNAL_BLOCK -1
#define SIGNAL_UNBLOCK -2
-#ifndef UNIX
+#if !defined(UNIX) && !defined(VMS)
# define vim_handle_signal(x) 0
#endif
diff --git a/src/window.c b/src/window.c
index 81fc4c364..92164c174 100644
--- a/src/window.c
+++ b/src/window.c
@@ -4788,8 +4788,7 @@ vim_FullName(fname, buf, len, force)
if (url || retval == FAIL)
{
/* something failed; use the file name (truncate when too long) */
- STRNCPY(buf, fname, len);
- buf[len - 1] = NUL;
+ vim_strncpy(buf, fname, len - 1);
}
#if defined(MACOS_CLASSIC) || defined(OS2) || defined(MSDOS) || defined(MSWIN)
slash_adjust(buf);