summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Makefile12
-rw-r--r--src/charset.c2
-rw-r--r--src/config.h.in4
-rw-r--r--src/configure.in26
-rw-r--r--src/ex_eval.c26
-rw-r--r--src/fileio.c4
-rw-r--r--src/gui.c2
-rw-r--r--src/gui_mac.c2
-rw-r--r--src/gui_riscos.c3
-rw-r--r--src/gui_xmdlg.c16
-rw-r--r--src/if_cscope.c2
-rw-r--r--src/mbyte.c12
-rw-r--r--src/misc2.c34
-rw-r--r--src/os_mswin.c5
-rw-r--r--src/os_unix.c8
-rw-r--r--src/os_vms_mms.c3
-rw-r--r--src/os_win32.h1
-rw-r--r--src/quickfix.c3
-rw-r--r--src/tag.c8
-rw-r--r--src/version.h4
-rw-r--r--src/workshop.c65
-rw-r--r--src/wsdebug.c5
22 files changed, 114 insertions, 133 deletions
diff --git a/src/Makefile b/src/Makefile
index 6ca8a6bf3b..d61ac9179e 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -1225,8 +1225,10 @@ CPP_DEPEND = $(CC) -I$(srcdir) -M$(CPP_MM) $(DEPEND_CFLAGS)
# flags for cproto
# This is for cproto 3 patchlevel 8 or below
# __inline, __attribute__ and __extension__ are not recognized by cproto
-NO_ATTR = -D__inline= -D"__attribute__\\(x\\)=" -D"__asm__\\(x\\)=" -D__extension__= \
--D__restrict="" -D__gnuc_va_list=char -D__builtin_va_list=char
+NO_ATTR = -D__inline= -D__inline__= -DG_IMPLEMENT_INLINES \
+ -D"__attribute__\\(x\\)=" -D"__asm__\\(x\\)=" \
+ -D__extension__= -D__restrict="" \
+ -D__gnuc_va_list=char -D__builtin_va_list=char
#
# This is for cproto 3 patchlevel 9 or above (currently 4.6)
@@ -1259,7 +1261,9 @@ POST_DEFS = $(X_CFLAGS) $(MZSCHEME_CFLAGS) $(PERL_CFLAGS) $(PYTHON_CFLAGS) $(TCL
ALL_CFLAGS = $(PRE_DEFS) $(CFLAGS) $(PROFILE_CFLAGS) $(POST_DEFS)
-LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) -Dinline= -D__extension__= -Dalloca=alloca -D"__attribute__(x)="
+LINT_CFLAGS = -DLINT -I. $(PRE_DEFS) $(POST_DEFS) -Dinline= -D__extension__= -Dalloca=alloca
+
+LINT_EXTRA = -DUSE_SNIFF -DHANGUL_INPUT -D"__attribute__(x)="
DEPEND_CFLAGS = -DPROTO -DDEPEND -DFEAT_GUI $(LINT_CFLAGS)
@@ -2172,7 +2176,7 @@ depend:
# Run lint. Clean up the *.ln files that are sometimes left behind.
lint:
- lint $(LINT_OPTIONS) $(LINT_CFLAGS) -DUSE_SNIFF -DHANGUL_INPUT $(LINT_SRC)
+ lint $(LINT_OPTIONS) $(LINT_CFLAGS) $(LINT_EXTRA) $(LINT_SRC)
-rm -f *.ln
# Check dosinst.c with lint.
diff --git a/src/charset.c b/src/charset.c
index c198284476..c05a83d26a 100644
--- a/src/charset.c
+++ b/src/charset.c
@@ -1005,6 +1005,7 @@ init_spell_chartab()
}
}
+#if defined(FEAT_MBYTE) || defined(PROTO)
static char *e_affform = N_("E761: Format error in affix file FOL, LOW or UPP");
static char *e_affrange = N_("E762: Character in FOL, LOW or UPP is out of range");
@@ -1083,6 +1084,7 @@ set_spell_chartab(fol, low, upp)
return set_spell_finish(&new_st);
}
+#endif
/*
* Set the spell character tables from strings in the .spl file.
diff --git a/src/config.h.in b/src/config.h.in
index 0ecc7b1ec5..5adbcb970a 100644
--- a/src/config.h.in
+++ b/src/config.h.in
@@ -164,7 +164,6 @@
#undef HAVE_SIGSETJMP
#undef HAVE_SIGSTACK
#undef HAVE_SIGVEC
-#undef HAVE_SNPRINTF
#undef HAVE_STRCASECMP
#undef HAVE_STRERROR
#undef HAVE_STRFTIME
@@ -368,6 +367,3 @@
/* Define if you want XSMP interaction as well as vanilla swapfile safety */
#undef USE_XSMP_INTERACT
-
-/* Define if vsnprintf() works */
-#undef HAVE_VSNPRINTF
diff --git a/src/configure.in b/src/configure.in
index 27828850a7..12d11900e4 100644
--- a/src/configure.in
+++ b/src/configure.in
@@ -2636,7 +2636,7 @@ AC_CHECK_FUNCS(bcmp fchdir fchown fseeko fsync ftello getcwd getpseudotty \
getpwnam getpwuid getrlimit gettimeofday getwd lstat memcmp \
memset nanosleep opendir putenv qsort readlink select setenv \
setpgid setsid sigaltstack sigstack sigset sigsetjmp sigaction \
- sigvec snprintf strcasecmp strerror strftime stricmp strncasecmp \
+ sigvec strcasecmp strerror strftime stricmp strncasecmp \
strnicmp strpbrk strtol tgetent towlower towupper iswupper \
usleep utime utimes)
@@ -2777,30 +2777,6 @@ else
AC_MSG_RESULT(yes)
fi
-AC_MSG_CHECKING(for vsnprintf())
-AC_TRY_RUN([
-#include <stdio.h>
-#include <stdarg.h>
- /* Check use of vsnprintf() */
- void warn(char *fmt, ...);
- void warn(char *fmt, ...)
- {
- va_list ap; char buf[20];
- va_start(ap, fmt);
- vsnprintf(buf, 20, fmt, ap);
- va_end(ap);
- }
- main()
- {
- warn("testing %s\n", "a very long string that won't fit");
- exit(0);
- }
- ],
- AC_DEFINE(HAVE_VSNPRINTF) AC_MSG_RESULT(yes),
- AC_MSG_RESULT(no),
- AC_MSG_ERROR(failed to compile test program))
-
-
dnl rename needs to be checked separately to work on Nextstep with cc
AC_MSG_CHECKING(for rename)
AC_TRY_LINK([#include <stdio.h>], [rename("this", "that")],
diff --git a/src/ex_eval.c b/src/ex_eval.c
index 6acf9de7df..d6c4ebee78 100644
--- a/src/ex_eval.c
+++ b/src/ex_eval.c
@@ -484,8 +484,8 @@ throw_exception(value, type, cmdname)
|| (VIM_ISDIGIT(p[3])
&& p[4] == ':'))))))
{
- if (*p == NUL || p == mesg) /* 'E123' missing or at beginning */
- STRCAT(val, mesg);
+ if (*p == NUL || p == mesg)
+ STRCAT(val, mesg); /* 'E123' missing or at beginning */
else
{
/* '"filename" E123: message text' */
@@ -525,7 +525,7 @@ throw_exception(value, type, cmdname)
msg_silent = FALSE; /* display messages */
++no_wait_return;
msg_scroll = TRUE; /* always scroll up, don't overwrite */
- msg_str((char_u *)_("Exception thrown: %s"), excp->value);
+ smsg((char_u *)_("Exception thrown: %s"), excp->value);
msg_puts((char_u *)"\n"); /* don't overwrite this either */
cmdline_row = msg_row;
--no_wait_return;
@@ -571,7 +571,7 @@ discard_exception(excp, was_finished)
msg_silent = FALSE; /* display messages */
++no_wait_return;
msg_scroll = TRUE; /* always scroll up, don't overwrite */
- msg_str(was_finished
+ smsg(was_finished
? (char_u *)_("Exception finished: %s")
: (char_u *)_("Exception discarded: %s"),
excp->value);
@@ -616,10 +616,10 @@ catch_exception(excp)
if (*excp->throw_name != NUL)
{
if (excp->throw_lnum != 0)
- sprintf((char *)IObuff, _("%s, line %ld"), excp->throw_name,
- (long)excp->throw_lnum);
+ vim_snprintf((char *)IObuff, IOSIZE, _("%s, line %ld"),
+ excp->throw_name, (long)excp->throw_lnum);
else
- STRCPY(IObuff, excp->throw_name);
+ vim_snprintf((char *)IObuff, IOSIZE, "%s", excp->throw_name);
set_vim_var_string(VV_THROWPOINT, IObuff, -1);
}
else
@@ -634,7 +634,7 @@ catch_exception(excp)
msg_silent = FALSE; /* display messages */
++no_wait_return;
msg_scroll = TRUE; /* always scroll up, don't overwrite */
- msg_str((char_u *)_("Exception caught: %s"), excp->value);
+ smsg((char_u *)_("Exception caught: %s"), excp->value);
msg_puts((char_u *)"\n"); /* don't overwrite this either */
cmdline_row = msg_row;
--no_wait_return;
@@ -659,11 +659,12 @@ finish_exception(excp)
if (*caught_stack->throw_name != NUL)
{
if (caught_stack->throw_lnum != 0)
- sprintf((char *)IObuff,
+ vim_snprintf((char *)IObuff, IOSIZE,
_("%s, line %ld"), caught_stack->throw_name,
(long)caught_stack->throw_lnum);
else
- STRCPY(IObuff, caught_stack->throw_name);
+ vim_snprintf((char *)IObuff, IOSIZE, "%s",
+ caught_stack->throw_name);
set_vim_var_string(VV_THROWPOINT, IObuff, -1);
}
else
@@ -742,7 +743,8 @@ report_pending(action, pending, value)
default:
if (pending & CSTP_THROW)
{
- sprintf((char *)IObuff, (char *)mesg, _("Exception"));
+ vim_snprintf((char *)IObuff, IOSIZE,
+ (char *)mesg, _("Exception"));
mesg = vim_strnsave(IObuff, (int)STRLEN(IObuff) + 4);
STRCAT(mesg, ": %s");
s = (char *)((except_T *)value)->value;
@@ -760,7 +762,7 @@ report_pending(action, pending, value)
msg_silent = FALSE; /* display messages */
++no_wait_return;
msg_scroll = TRUE; /* always scroll up, don't overwrite */
- msg_str(mesg, (char_u *)s);
+ smsg(mesg, (char_u *)s);
msg_puts((char_u *)"\n"); /* don't overwrite this either */
cmdline_row = msg_row;
--no_wait_return;
diff --git a/src/fileio.c b/src/fileio.c
index d88111a135..1f95d0e2e2 100644
--- a/src/fileio.c
+++ b/src/fileio.c
@@ -8342,7 +8342,7 @@ auto_next_pat(apc, stop_at_last)
sprintf((char *)sourcing_name, s,
(char *)name, (char *)ap->pat);
if (p_verbose >= 8)
- msg_str((char_u *)_("Executing %s"), sourcing_name);
+ smsg((char_u *)_("Executing %s"), sourcing_name);
}
apc->curpat = ap;
@@ -8410,7 +8410,7 @@ getnextac(c, cookie, indent)
if (p_verbose >= 9)
{
msg_scroll = TRUE; /* always scroll up, don't overwrite */
- msg_str((char_u *)_("autocommand %s"), ac->cmd);
+ smsg((char_u *)_("autocommand %s"), ac->cmd);
msg_puts((char_u *)"\n"); /* don't overwrite this either */
cmdline_row = msg_row;
}
diff --git a/src/gui.c b/src/gui.c
index 8cd43ac8f9..090160ad02 100644
--- a/src/gui.c
+++ b/src/gui.c
@@ -4359,7 +4359,7 @@ gui_find_bitmap(name, buffer, ext)
{
if (STRLEN(name) > MAXPATHL - 14)
return FAIL;
- sprintf((char *)buffer, "bitmaps/%s.%s", name, ext);
+ vim_snprintf((char *)buffer, MAXPATHL, "bitmaps/%s.%s", name, ext);
if (do_in_runtimepath(buffer, FALSE, gfp_setname, buffer) == FAIL
|| *buffer == NUL)
return FAIL;
diff --git a/src/gui_mac.c b/src/gui_mac.c
index e9a44b35d7..fbf9b30b7c 100644
--- a/src/gui_mac.c
+++ b/src/gui_mac.c
@@ -1644,7 +1644,7 @@ GetFontPanelSelection(char_u* outName)
/* Only encode font size, because style (bold, italic, etc) is
* already part of the font full name */
- snprintf(styleString, FONT_STYLE_BUFFER_SIZE, ":h%d",
+ vim_snprintf(styleString, FONT_STYLE_BUFFER_SIZE, ":h%d",
gFontPanelInfo.size/*,
((gFontPanelInfo.style & bold)!=0 ? ":b" : ""),
((gFontPanelInfo.style & italic)!=0 ? ":i" : ""),
diff --git a/src/gui_riscos.c b/src/gui_riscos.c
index 2c40514fd6..2f334191c2 100644
--- a/src/gui_riscos.c
+++ b/src/gui_riscos.c
@@ -3218,8 +3218,7 @@ gui_mch_call_shell(cmd, options)
length = out_redir - cmd;
out_file = fopen(out_redir + 3, "wb");
if (out_file == NULL)
- msg_str("WARNING : Can't open file %s for writing\n",
- out_redir + 3);
+ smsg("WARNING : Can't open file %s for writing\n", out_redir + 3);
}
if (length > 180)
diff --git a/src/gui_xmdlg.c b/src/gui_xmdlg.c
index 66cb85477c..dff867292a 100644
--- a/src/gui_xmdlg.c
+++ b/src/gui_xmdlg.c
@@ -169,9 +169,9 @@ name_part(char *font, char *buf)
get_part(font, 1, buf3);
if (strlen(buf3))
- sprintf(buf, "%s (%s)", buf2, buf3);
+ vim_snprintf(buf, TEMP_BUF_SIZE, "%s (%s)", buf2, buf3);
else
- sprintf(buf, "%s", buf2);
+ vim_snprintf(buf, TEMP_BUF_SIZE, "%s", buf2);
}
/*
@@ -188,23 +188,23 @@ style_part(char *font, char *buf)
if (!strcmp(buf2, "normal") && !strcmp(buf2, "Normal")
&& !strcmp(buf2, "NORMAL"))
- sprintf(buf, "%s %s", buf3, buf2);
+ vim_snprintf(buf, TEMP_BUF_SIZE, "%s %s", buf3, buf2);
else
strcpy(buf, buf3);
get_part(font, 6, buf2);
if (buf2[0] != '\0')
- sprintf(buf3, "%s %s", buf, buf2);
+ vim_snprintf(buf3, TEMP_BUF_SIZE, "%s %s", buf, buf2);
else
strcpy(buf3, buf);
get_part(font, 4, buf2);
if (!strcmp(buf2, "o") || !strcmp(buf2, "O"))
- sprintf(buf, "%s oblique", buf3);
+ vim_snprintf(buf, TEMP_BUF_SIZE, "%s oblique", buf3);
else if (!strcmp(buf2, "i") || !strcmp(buf2, "I"))
- sprintf(buf, "%s italic", buf3);
+ vim_snprintf(buf, TEMP_BUF_SIZE, "%s italic", buf3);
if (!strcmp(buf, " "))
strcpy(buf, "-");
@@ -262,7 +262,7 @@ encoding_part(char *font, char *buf)
get_part(font, 14, buf2);
if (strlen(buf1) > 0 && strlen(buf2))
- sprintf(buf, "%s-%s", buf1, buf2);
+ vim_snprintf(buf, TEMP_BUF_SIZE, "%s-%s", buf1, buf2);
if (!strcmp(buf, " "))
strcpy(buf, "-");
}
@@ -551,7 +551,7 @@ stoggle_callback(Widget w,
XmToggleButtonCallbackStruct *call_data)
{
int i, do_sel;
- char newSize[10];
+ char newSize[TEMP_BUF_SIZE];
XmString str;
if (call_data->reason != (int)XmCR_VALUE_CHANGED)
diff --git a/src/if_cscope.c b/src/if_cscope.c
index f4286e4120..1b0771337a 100644
--- a/src/if_cscope.c
+++ b/src/if_cscope.c
@@ -2125,7 +2125,7 @@ cs_reset(eap)
{
char **dblist = NULL, **pplist = NULL, **fllist = NULL;
int i;
- char buf[8]; /* for sprintf " (#%d)" */
+ char buf[20]; /* for sprintf " (#%d)" */
/* malloc our db and ppath list */
dblist = (char **)alloc(CSCOPE_MAX_CONNECTIONS * sizeof(char *));
diff --git a/src/mbyte.c b/src/mbyte.c
index c771788625..3a8b5584c0 100644
--- a/src/mbyte.c
+++ b/src/mbyte.c
@@ -2255,6 +2255,7 @@ mb_strnicmp(s1, s2, n)
show_utf8()
{
int len;
+ int rlen = 0;
char_u *line;
int clen;
int i;
@@ -2269,7 +2270,6 @@ show_utf8()
return;
}
- IObuff[0] = NUL;
clen = 0;
for (i = 0; i < len; ++i)
{
@@ -2277,11 +2277,17 @@ show_utf8()
{
/* start of (composing) character, get its length */
if (i > 0)
- STRCAT(IObuff, "+ ");
+ {
+ STRCPY(IObuff + rlen, "+ ");
+ rlen += 2;
+ }
clen = utf_ptr2len_check(line + i);
}
- sprintf((char *)IObuff + STRLEN(IObuff), "%02x ", line[i]);
+ sprintf((char *)IObuff + rlen, "%02x ", line[i]);
--clen;
+ rlen += STRLEN(IObuff + rlen);
+ if (rlen > IOSIZE - 20)
+ break;
}
msg(IObuff);
diff --git a/src/misc2.c b/src/misc2.c
index a00d3ae49f..879384a6d8 100644
--- a/src/misc2.c
+++ b/src/misc2.c
@@ -2606,7 +2606,7 @@ call_shell(cmd, opt)
if (p_verbose > 3)
{
- msg_str((char_u *)_("Calling shell to execute: \"%s\""),
+ smsg((char_u *)_("Calling shell to execute: \"%s\""),
cmd == NULL ? p_sh : cmd);
out_char('\n');
cursor_on();
@@ -4076,8 +4076,8 @@ vim_findfile(search_ctx)
{
/* always scroll up, don't overwrite */
msg_scroll = TRUE;
- smsg((char_u *)"Searching: %s (%s)", ctx->ffs_fix_path,
- ctx->ffs_wc_path);
+ smsg((char_u *)"Searching: %s (%s)",
+ ctx->ffs_fix_path, ctx->ffs_wc_path);
/* don't overwrite this either */
msg_puts((char_u *)"\n");
cmdline_row = msg_row;
@@ -4266,7 +4266,7 @@ vim_findfile(search_ctx)
{
/* always scroll up, don't overwrite */
msg_scroll = TRUE;
- msg_str((char_u *)"Already: %s",
+ smsg((char_u *)"Already: %s",
file_path);
/* don't overwrite this either */
msg_puts((char_u *)"\n");
@@ -4295,7 +4295,7 @@ vim_findfile(search_ctx)
{
/* always scroll up, don't overwrite */
msg_scroll = TRUE;
- msg_str((char_u *)"HIT: %s", file_path);
+ smsg((char_u *)"HIT: %s", file_path);
/* don't overwrite this either */
msg_puts((char_u *)"\n");
cmdline_row = msg_row;
@@ -4485,7 +4485,7 @@ ff_get_visited_list(filename, list_headp)
{
/* always scroll up, don't overwrite */
msg_scroll = TRUE;
- msg_str((char_u *)"ff_get_visited_list: FOUND list for %s",
+ smsg((char_u *)"ff_get_visited_list: FOUND list for %s",
filename);
/* don't overwrite this either */
msg_puts((char_u *)"\n");
@@ -4503,7 +4503,7 @@ ff_get_visited_list(filename, list_headp)
{
/* always scroll up, don't overwrite */
msg_scroll = TRUE;
- msg_str((char_u *)"ff_get_visited_list: new list for %s", filename);
+ smsg((char_u *)"ff_get_visited_list: new list for %s", filename);
/* don't overwrite this either */
msg_puts((char_u *)"\n");
cmdline_row = msg_row;
@@ -5596,23 +5596,3 @@ vimpty_getenv(string)
# endif
#endif /* !defined(HAVE_SETENV) && !defined(HAVE_PUTENV) */
-
-/*
- * Print a message with one string argument.
- * Make sure that the result fits in IObuff.
- * This is not in message.c, because the prototype for smsg() isn't used
- * there.
- */
- void
-msg_str(s, arg)
- char_u *s;
- char_u *arg;
-{
- int ls = STRLEN(s);
- int larg = STRLEN(arg);
-
- if (ls + larg >= IOSIZE)
- smsg(s, arg + (ls + larg - IOSIZE));
- else
- smsg(s, arg);
-}
diff --git a/src/os_mswin.c b/src/os_mswin.c
index c833113db5..8a47dd16f1 100644
--- a/src/os_mswin.c
+++ b/src/os_mswin.c
@@ -3377,7 +3377,8 @@ get_logfont(
}
if (cp->name == NULL && verbose)
{
- sprintf((char *)IObuff, _("E244: Illegal charset name \"%s\" in font name \"%s\""), p, name);
+ vim_snprintf((char *)IObuff, IOSIZE,
+ _("E244: Illegal charset name \"%s\" in font name \"%s\""), p, name);
EMSG(IObuff);
break;
}
@@ -3386,7 +3387,7 @@ get_logfont(
default:
if (verbose)
{
- sprintf((char *)IObuff,
+ vim_snprintf((char *)IObuff, IOSIZE,
_("E245: Illegal char '%c' in font name \"%s\""),
p[-1], name);
EMSG(IObuff);
diff --git a/src/os_unix.c b/src/os_unix.c
index 80735b69a0..f2aaf119ec 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -1307,7 +1307,7 @@ xopen_message(tvp)
gettimeofday(&end_tv, NULL);
smsg((char_u *)_("Opening the X display took %ld msec"),
(end_tv.tv_sec - tvp->tv_sec) * 1000L
- + (end_tv.tv_usec - tvp->tv_usec) / 1000L);
+ + (end_tv.tv_usec - tvp->tv_usec) / 1000L);
}
# endif
#endif
@@ -2092,6 +2092,7 @@ mch_get_uname(uid, s, len)
&& pw->pw_name != NULL && *(pw->pw_name) != NUL)
{
STRNCPY(s, pw->pw_name, len);
+ s[len - 1] = NUL;
return OK;
}
#endif
@@ -6453,8 +6454,9 @@ xsmp_init(void)
if (xsmp.smcconn == NULL)
{
char errorreport[132];
- sprintf(errorreport, _("XSMP SmcOpenConnection failed: %s"),
- errorstring);
+
+ vim_snprintf(errorreport, sizeof(errorreport),
+ _("XSMP SmcOpenConnection failed: %s"), errorstring);
if (p_verbose > 0)
MSG(errorreport);
return;
diff --git a/src/os_vms_mms.c b/src/os_vms_mms.c
index d653860be7..4da7b1ad41 100644
--- a/src/os_vms_mms.c
+++ b/src/os_vms_mms.c
@@ -40,7 +40,8 @@ int main(int argc, char *argv[])
strcat(target, argp);
}
}
- sprintf(cmd, "%s/output=tmp:errors.vim_tmp %s", mms, target);
+ vim_snprintf(cmd, sizeof(cmd), "%s/output=tmp:errors.vim_tmp %s",
+ mms, target);
system(cmd);
fpi = fopen("tmp:errors.vim_tmp", "r");
fpo = fopen(error_file, "w");
diff --git a/src/os_win32.h b/src/os_win32.h
index 5554c0ca76..d9aaa6e54e 100644
--- a/src/os_win32.h
+++ b/src/os_win32.h
@@ -24,7 +24,6 @@
# define HAVE_STRING_H
#endif
#define HAVE_STRCSPN
-#define HAVE_VSNPRINTF
#ifndef __GNUC__
#define HAVE_STRICMP
#define HAVE_STRNICMP
diff --git a/src/quickfix.c b/src/quickfix.c
index e022c787a5..a481b0f316 100644
--- a/src/quickfix.c
+++ b/src/quickfix.c
@@ -1478,7 +1478,8 @@ qf_list(eap)
if (fname == NULL)
sprintf((char *)IObuff, "%2d", i);
else
- sprintf((char *)IObuff, "%2d %s", i, (char *)fname);
+ vim_snprintf((char *)IObuff, IOSIZE, "%2d %s",
+ i, (char *)fname);
msg_outtrans_attr(IObuff, i == qf_lists[qf_curlist].qf_index
? hl_attr(HLF_L) : hl_attr(HLF_D));
if (qfp->qf_lnum == 0)
diff --git a/src/tag.c b/src/tag.c
index f9797de9e5..8b7c4e240d 100644
--- a/src/tag.c
+++ b/src/tag.c
@@ -598,7 +598,8 @@ do_tag(tag, type, count, forceit, verbose)
*IObuff = '>';
else
*IObuff = ' ';
- sprintf((char *)IObuff + 1, "%2d %s ", i + 1,
+ vim_snprintf((char *)IObuff + 1, IOSIZE - 1,
+ "%2d %s ", i + 1,
mt_names[matches[i][0] & MT_MASK]);
msg_puts(IObuff);
if (tagp.tagkind != NULL)
@@ -807,8 +808,7 @@ do_tag(tag, type, count, forceit, verbose)
* file didn't exist. Otherwise an EMSG() is given below.
*/
if (nofile_fname != NULL && error_cur_match != cur_match)
- msg_str((char_u *)_("File \"%s\" does not exist"),
- nofile_fname);
+ smsg((char_u *)_("File \"%s\" does not exist"), nofile_fname);
ic = (matches[cur_match][0] & MT_IC_OFF);
@@ -1360,7 +1360,7 @@ find_tags(pat, num_matches, matchesp, flags, mincount, buf_ffname)
continue;
if (p_verbose >= 5)
- msg_str((char_u *)_("Searching tags file %s"), tag_fname);
+ smsg((char_u *)_("Searching tags file %s"), tag_fname);
}
did_open = TRUE; /* remember that we found at least one file */
diff --git a/src/version.h b/src/version.h
index 487e09f5e4..b6d6137a64 100644
--- a/src/version.h
+++ b/src/version.h
@@ -36,5 +36,5 @@
#define VIM_VERSION_NODOT "vim70aa"
#define VIM_VERSION_SHORT "7.0aa"
#define VIM_VERSION_MEDIUM "7.0aa ALPHA"
-#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 May 18)"
-#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 May 18, compiled "
+#define VIM_VERSION_LONG "VIM - Vi IMproved 7.0aa ALPHA (2005 May 19)"
+#define VIM_VERSION_LONG_DATE "VIM - Vi IMproved 7.0aa ALPHA (2005 May 19, compiled "
diff --git a/src/workshop.c b/src/workshop.c
index e17f0e64fa..27323d4b1f 100644
--- a/src/workshop.c
+++ b/src/workshop.c
@@ -294,7 +294,7 @@ workshop_save_file(
#endif
/* Save the given file */
- sprintf(cbuf, "w %s", filename);
+ vim_snprintf(cbuf, sizeof(cbuf), "w %s", filename);
coloncmd(cbuf, TRUE);
}
@@ -380,14 +380,16 @@ workshop_add_mark_type(
{
if (colorspec != NULL && *colorspec)
{
- sprintf(cbuf, "highlight WS%s guibg=%s", gbuf, colorspec);
+ vim_snprintf(cbuf, sizeof(cbuf),
+ "highlight WS%s guibg=%s", gbuf, colorspec);
coloncmd(cbuf, FALSE);
- sprintf(cibuf, "linehl=WS%s", gbuf);
+ vim_snprintf(cibuf, sizeof(cibuf), "linehl=WS%s", gbuf);
}
else
cibuf[0] = NUL;
- sprintf(cbuf, "sign define %d %s icon=%s", idx, cibuf, sign);
+ vim_snprintf(cbuf, sizeof(cbuf),
+ "sign define %d %s icon=%s", idx, cibuf, sign);
coloncmd(cbuf, TRUE);
}
}
@@ -408,7 +410,7 @@ workshop_set_mark(
filename, lineno, markId, idx);
#endif
- sprintf(cbuf, "sign place %d line=%d name=%d file=%s",
+ vim_snprintf(cbuf, sizeof(cbuf), "sign place %d line=%d name=%d file=%s",
markId, lineno, idx, filename);
coloncmd(cbuf, TRUE);
}
@@ -428,7 +430,8 @@ workshop_change_mark_type(
filename, markId, idx);
#endif
- sprintf(cbuf, "sign place %d name=%d file=%s", markId, idx, filename);
+ vim_snprintf(cbuf, sizeof(cbuf),
+ "sign place %d name=%d file=%s", markId, idx, filename);
coloncmd(cbuf, TRUE);
}
@@ -453,7 +456,7 @@ workshop_goto_mark(
message : "<None>");
#endif
- sprintf(cbuf, "sign jump %d file=%s", markId, filename);
+ vim_snprintf(cbuf, sizeof(cbuf), "sign jump %d file=%s", markId, filename);
coloncmd(cbuf, TRUE);
if (message != NULL && *message != NUL)
gui_mch_set_footer((char_u *)message);
@@ -473,7 +476,8 @@ workshop_delete_mark(
filename, markId);
#endif
- sprintf(cbuf, "sign unplace %d file=%s", markId, filename);
+ vim_snprintf(cbuf, sizeof(cbuf),
+ "sign unplace %d file=%s", markId, filename);
coloncmd(cbuf, TRUE);
}
@@ -633,7 +637,7 @@ workshop_menu_begin(
mnembuf[idx++] = NUL;
name = addUniqueMnemonic(mnembuf, label);
- sprintf(curMenuName, "%s", name);
+ vim_snprintf(curMenuName, sizeof(curMenuName), "%s", name);
sprintf(curMenuPriority, "%d.0", menuPriority);
}
@@ -735,12 +739,12 @@ workshop_menu_item(
#endif
if (acceleratorText != NULL)
- sprintf(accText, "<Tab>%s", acceleratorText);
+ vim_snprintf(accText, sizeof(accText), "<Tab>%s", acceleratorText);
else
accText[0] = NUL;
updatePriority(False);
- sprintf(namebuf, "%s.%s", curMenuName, fixup(label));
- sprintf(cbuf, "amenu %s %s%s\t:wsverb %s<CR>",
+ vim_snprintf(namebuf, sizeof(namebuf), "%s.%s", curMenuName, fixup(label));
+ vim_snprintf(cbuf, sizeof(cbuf), "amenu %s %s%s\t:wsverb %s<CR>",
curMenuPriority, namebuf, accText, verb);
coloncmd(cbuf, TRUE);
@@ -748,7 +752,7 @@ workshop_menu_item(
if (*sensitive == '0')
{
- sprintf(cbuf, "amenu disable %s", namebuf);
+ vim_snprintf(cbuf, sizeof(cbuf), "amenu disable %s", namebuf);
coloncmd(cbuf, TRUE);
}
}
@@ -824,6 +828,7 @@ workshop_toolbar_button(
char namebuf[BUFSIZ];
static int tbid = 1;
char_u *p;
+ int len;
#ifdef WSDEBUG_TRACE
if (WSDLEVEL(WS_TRACE_VERBOSE))
@@ -858,16 +863,18 @@ workshop_toolbar_button(
}
p = vim_strsave_escaped((char_u *)label, (char_u *)"\\. ");
- sprintf(namebuf, "ToolBar.%s", p);
+ vim_snprintf(namebuf, sizeof(namebuf), "ToolBar.%s", p);
vim_free(p);
STRCPY(cbuf, "amenu <silent> ");
if (file != NULL && *file != NUL)
{
p = vim_strsave_escaped((char_u *)file, (char_u *)" ");
- sprintf(cbuf + STRLEN(cbuf), "icon=%s ", p);
+ len = STRLEN(cbuf);
+ vim_snprintf(cbuf + len, sizeof(cbuf) - len, "icon=%s ", p);
vim_free(p);
}
- sprintf(cbuf + STRLEN(cbuf), "1.%d %s :wsverb %s<CR>",
+ len = STRLEN(cbuf);
+ vim_snprintf(cbuf + len, sizeof(cbuf) - len,"1.%d %s :wsverb %s<CR>",
tbpri, namebuf, verb);
/* Define the menu item */
@@ -876,14 +883,14 @@ workshop_toolbar_button(
if (*sense == '0')
{
/* If menu isn't sensitive at startup... */
- sprintf(cbuf, "amenu disable %s", namebuf);
+ vim_snprintf(cbuf, sizeof(cbuf), "amenu disable %s", namebuf);
coloncmd(cbuf, True);
}
if (help && *help)
{
/* Do the tooltip */
- sprintf(cbuf, "tmenu %s %s", namebuf, help);
+ vim_snprintf(cbuf, sizeof(cbuf), "tmenu %s %s", namebuf, help);
coloncmd(cbuf, True);
}
@@ -961,7 +968,7 @@ workshop_set_option(
{
case 's':
if (strcmp(option, "syntax") == 0)
- sprintf(cbuf, "syntax %s", value);
+ vim_snprintf(cbuf, sizeof(cbuf), "syntax %s", value);
else if (strcmp(option, "savefiles") == 0)
; /* XXX - Not yet implemented */
break;
@@ -1074,7 +1081,8 @@ workshop_hotkeys(
{
if (mp->accel != NULL)
{
- sprintf(cbuf, "map %s :wsverb %s<CR>", mp->accel, mp->verb);
+ vim_snprintf(cbuf, sizeof(cbuf),
+ "map %s :wsverb %s<CR>", mp->accel, mp->verb);
coloncmd(cbuf, TRUE);
}
}
@@ -1083,7 +1091,7 @@ workshop_hotkeys(
{
if (mp->accel != NULL)
{
- sprintf(cbuf, "unmap %s", mp->accel);
+ vim_snprintf(cbuf, sizeof(cbuf), "unmap %s", mp->accel);
coloncmd(cbuf, TRUE);
}
}
@@ -1272,7 +1280,7 @@ load_buffer_by_name(
else
lnumbuf[0] = NUL;
- sprintf(cbuf, "e %s %s", lnumbuf, filename);
+ vim_snprintf(cbuf, sizeof(cbuf), "e %s %s", lnumbuf, filename);
coloncmd(cbuf, False);
}
@@ -1392,9 +1400,11 @@ updatePriority(
pri = atoi(p) + 10; /* our new priority */
if (subMenu)
- sprintf(curMenuPriority, "%s.%d.0", curMenuPriority, pri);
+ vim_snprintf(curMenuPriority, sizeof(curMenuPriority),
+ "%s.%d.0", curMenuPriority, pri);
else
- sprintf(curMenuPriority, "%s.%d", curMenuPriority, pri);
+ vim_snprintf(curMenuPriority, sizeof(curMenuPriority),
+ "%s.%d", curMenuPriority, pri);
}
static char *
@@ -1543,7 +1553,7 @@ fixAccelText(
if (*ap == 'F' && atoi(&ap[1]) > 0)
{
- sprintf(buf, "<%s%s>", shift, ap);
+ vim_snprintf(buf, sizeof(buf), "<%s%s>", shift, ap);
return strdup(buf);
}
else
@@ -1607,7 +1617,7 @@ workshop_beval_cb(
type = (int)GPLineEval_EVALUATE;
/* Send request to dbx */
- sprintf(buf, "toolVerb debug.balloonEval "
+ vim_snprintf(buf, sizeof(buf), "toolVerb debug.balloonEval "
"%s %ld,0 %d,0 %d,%d %ld %s\n",
(char *)wp->w_buffer->b_ffname,
(long)lnum, idx, type, serialNo++,
@@ -1670,7 +1680,8 @@ addMenu(
menuMap[menuMapSize++].verb = strdup(verb);
if (accel && workshopHotKeysEnabled)
{
- sprintf(cbuf, "map %s :wsverb %s<CR>", accel, verb);
+ vim_snprintf(cbuf, sizeof(cbuf),
+ "map %s :wsverb %s<CR>", accel, verb);
coloncmd(cbuf, TRUE);
}
}
diff --git a/src/wsdebug.c b/src/wsdebug.c
index c3dba9931c..2707fae205 100644
--- a/src/wsdebug.c
+++ b/src/wsdebug.c
@@ -86,10 +86,11 @@ wsdebug_log_init(
char *file; /* possible ws_debug output file */
char *cp; /* ws_dlevel pointer */
- if (log_var && (file = getenv(log_var)) != NULL) {
+ if (log_var && (file = getenv(log_var)) != NULL)
+ {
char buf[BUFSIZ];
- sprintf(buf, "date > %s", file);
+ vim_snprintf(buf, sizeof(buf), "date > %s", file);
system(buf);
ws_debug = fopen(file, "a");
if (level_var && (cp = getenv(level_var)) != NULL) {