本文整理汇总了C++中MSG_PUTS函数的典型用法代码示例。如果您正苦于以下问题:C++ MSG_PUTS函数的具体用法?C++ MSG_PUTS怎么用?C++ MSG_PUTS使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了MSG_PUTS函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: list_version
void list_version(void)
{
MSG(longVersion);
MSG(version_buildtype);
list_lua_version();
MSG(version_cflags);
#ifdef HAVE_PATHDEF
if ((*compiled_user != NUL) || (*compiled_sys != NUL)) {
MSG_PUTS(_("\nCompiled "));
if (*compiled_user != NUL) {
MSG_PUTS(_("by "));
MSG_PUTS(compiled_user);
}
if (*compiled_sys != NUL) {
MSG_PUTS("@");
MSG_PUTS(compiled_sys);
}
}
#endif // ifdef HAVE_PATHDEF
version_msg(_("\n\nFeatures: "));
list_features();
#ifdef SYS_VIMRC_FILE
version_msg(_(" system vimrc file: \""));
version_msg(SYS_VIMRC_FILE);
version_msg("\"\n");
#endif // ifdef SYS_VIMRC_FILE
#ifdef HAVE_PATHDEF
if (*default_vim_dir != NUL) {
version_msg(_(" fall-back for $VIM: \""));
version_msg(default_vim_dir);
version_msg("\"\n");
}
if (*default_vimruntime_dir != NUL) {
version_msg(_(" f-b for $VIMRUNTIME: \""));
version_msg(default_vimruntime_dir);
version_msg("\"\n");
}
#endif // ifdef HAVE_PATHDEF
version_msg("\nRun :checkhealth for more info");
}
示例2: ex_changes
/*
* print the changelist
*/
void ex_changes(exarg_T *eap)
{
int i;
char_u *name;
/* Highlight title */
MSG_PUTS_TITLE(_("\nchange line col text"));
for (i = 0; i < curbuf->b_changelistlen && !got_int; ++i) {
if (curbuf->b_changelist[i].lnum != 0) {
msg_putchar('\n');
if (got_int)
break;
sprintf((char *)IObuff, "%c %3d %5ld %4d ",
i == curwin->w_changelistidx ? '>' : ' ',
i > curwin->w_changelistidx ? i - curwin->w_changelistidx
: curwin->w_changelistidx - i,
(long)curbuf->b_changelist[i].lnum,
curbuf->b_changelist[i].col);
msg_outtrans(IObuff);
name = mark_line(&curbuf->b_changelist[i], 17);
if (name == NULL)
break;
msg_outtrans_attr(name, hl_attr(HLF_D));
vim_free(name);
ui_breakcheck();
}
out_flush();
}
if (curwin->w_changelistidx == curbuf->b_changelistlen)
MSG_PUTS("\n>");
}
示例3: proc_cleanup_exit
static int proc_cleanup_exit(ProcessData *proc_data,
uv_process_options_t *proc_opts,
int shellopts)
{
if (proc_data->exited) {
if (!emsg_silent && proc_data->exit_status != 0 &&
!(shellopts & kShellOptSilent)) {
MSG_PUTS(_("\nshell returned "));
msg_outnum((int64_t)proc_data->exit_status);
msg_putchar('\n');
}
}
State = proc_data->old_state;
if (proc_data->old_mode == TMODE_RAW) {
// restore mode
settmode(TMODE_RAW);
}
signal_accept_deadly();
// Release argv memory
shell_free_argv(proc_opts->args);
return proc_data->exit_status;
}
示例4: version_msg_wrap
/*
* Output a string for the version message. If it's going to wrap, output a
* newline, unless the message is too long to fit on the screen anyway.
* When "wrap" is TRUE wrap the string in [].
*/
static void
version_msg_wrap(char_u *s, int wrap)
{
int len = (int)vim_strsize(s) + (wrap ? 2 : 0);
if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
&& *s != '\n')
msg_putchar('\n');
if (!got_int)
{
if (wrap)
MSG_PUTS("[");
MSG_PUTS(s);
if (wrap)
MSG_PUTS("]");
}
}
示例5: list_features
/// List all features aligned in columns, dictionary style.
static void list_features(void)
{
int nfeat = 0;
int width = 0;
// Find the length of the longest feature name, use that + 1 as the column
// width
int i;
for (i = 0; features[i] != NULL; ++i) {
int l = (int)STRLEN(features[i]);
if (l > width) {
width = l;
}
nfeat++;
}
width += 1;
if (Columns < width) {
// Not enough screen columns - show one per line
for (i = 0; features[i] != NULL; ++i) {
version_msg(features[i]);
if (msg_col > 0) {
msg_putchar('\n');
}
}
return;
}
// The rightmost column doesn't need a separator.
// Sacrifice it to fit in one more column if possible.
int ncol = (int)(Columns + 1) / width;
int nrow = nfeat / ncol + (nfeat % ncol ? 1 : 0);
// i counts columns then rows. idx counts rows then columns.
for (i = 0; !got_int && i < nrow * ncol; ++i) {
int idx = (i / ncol) + (i % ncol) * nrow;
if (idx < nfeat) {
int last_col = (i + 1) % ncol == 0;
msg_puts((char_u *)features[idx]);
if (last_col) {
if (msg_col > 0) {
msg_putchar('\n');
}
} else {
while (msg_col % width) {
msg_putchar(' ');
}
}
} else {
if (msg_col > 0) {
msg_putchar('\n');
}
}
}
MSG_PUTS("For differences from Vim, see :help vim-differences\n\n");
}
示例6: mch_copy_sec
// Copy security info from "from_file" to "to_file".
void mch_copy_sec(char_u *from_file, char_u *to_file)
{
if (from_file == NULL)
return;
if (selinux_enabled == -1)
selinux_enabled = is_selinux_enabled();
if (selinux_enabled > 0) {
security_context_t from_context = NULL;
security_context_t to_context = NULL;
if (getfilecon((char *)from_file, &from_context) < 0) {
// If the filesystem doesn't support extended attributes,
// the original had no special security context and the
// target cannot have one either.
if (errno == EOPNOTSUPP) {
return;
}
MSG_PUTS(_("\nCould not get security context for "));
msg_outtrans(from_file);
msg_putchar('\n');
return;
}
if (getfilecon((char *)to_file, &to_context) < 0) {
MSG_PUTS(_("\nCould not get security context for "));
msg_outtrans(to_file);
msg_putchar('\n');
freecon (from_context);
return;
}
if (strcmp(from_context, to_context) != 0) {
if (setfilecon((char *)to_file, from_context) < 0) {
MSG_PUTS(_("\nCould not set security context for "));
msg_outtrans(to_file);
msg_putchar('\n');
}
}
freecon(to_context);
freecon(from_context);
}
}
示例7: version_msg
/*
* Output a string for the version message. If it's going to wrap, output a
* newline, unless the message is too long to fit on the screen anyway.
*/
static void
version_msg(char *s)
{
int len = (int)STRLEN(s);
if (!got_int && len < (int)Columns && msg_col + len >= (int)Columns
&& *s != '\n')
msg_putchar('\n');
if (!got_int)
MSG_PUTS(s);
}
示例8: os_call_shell
/// Calls the user-configured 'shell' (p_sh) for running a command or wildcard
/// expansion.
///
/// @param cmd The command to execute, or NULL to run an interactive shell.
/// @param opts Options that control how the shell will work.
/// @param extra_args Extra arguments to the shell, or NULL.
int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_args)
{
DynamicBuffer input = DYNAMIC_BUFFER_INIT;
char *output = NULL, **output_ptr = NULL;
int current_state = State;
bool forward_output = true;
// While the child is running, ignore terminating signals
signal_reject_deadly();
if (opts & (kShellOptHideMess | kShellOptExpand)) {
forward_output = false;
} else {
State = EXTERNCMD;
if (opts & kShellOptWrite) {
read_input(&input);
}
if (opts & kShellOptRead) {
output_ptr = &output;
forward_output = false;
}
}
size_t nread;
int status = do_os_system(shell_build_argv((char *)cmd, (char *)extra_args),
input.data,
input.len,
output_ptr,
&nread,
emsg_silent,
forward_output);
xfree(input.data);
if (output) {
(void)write_output(output, nread, true, true);
xfree(output);
}
if (!emsg_silent && status != 0 && !(opts & kShellOptSilent)) {
MSG_PUTS(_("\nshell returned "));
msg_outnum(status);
msg_putchar('\n');
}
State = current_state;
signal_accept_deadly();
return status;
}
示例9: copy_security_context
int
copy_security_context(const char *from_file, const char *to_file)
{
int status = 0;
#ifdef WITH_SELINUX
security_context_t from_context;
security_context_t to_context;
if (selinux_enabled == -1)
selinux_enabled = (is_selinux_enabled() > 0);
if (!selinux_enabled)
return 0;
if (getfilecon(from_file, &from_context) < 0) {
/*
* If the filesystem doesn't support extended
* attributes, the original had no special security
* context and the target cannot have one either.
*/
if (errno == EOPNOTSUPP)
return 0;
error(0, errno, joe_gettext(_("Could not get security context for %s")),
from_file);
return 1;
}
if (getfilecon(to_file, &to_context) < 0) {
MSG_PUTS(_(joe_gettext(_("\nCould not get security context for "))));
msg_outtrans(to_file);
msg_putchar('\n');
freecon(from_context);
return 1;
}
if (zcmp(from_context, to_context) != 0) {
if (setfilecon(to_file, from_context) < 0) {
error(0, errno,
joe_gettext(_("Could not set security context for %s")),
to_file);
status = 1;
}
}
freecon(to_context);
freecon(from_context);
#endif
return status;
}
示例10: version_msg
/// Output a string for the version message. If it's going to wrap, output a
/// newline, unless the message is too long to fit on the screen anyway.
///
/// @param s
static void version_msg(char *s)
{
int len = (int)STRLEN(s);
if (!got_int
&& (len < (int)Columns)
&& (msg_col + len >= (int)Columns)
&& (*s != '\n')) {
msg_putchar('\n');
}
if (!got_int) {
MSG_PUTS(s);
}
}
示例11: ex_jumps
/*
* print the jumplist
*/
void ex_jumps(exarg_T *eap)
{
int i;
char_u *name;
cleanup_jumplist();
/* Highlight title */
MSG_PUTS_TITLE(_("\n jump line col file/text"));
for (i = 0; i < curwin->w_jumplistlen && !got_int; ++i) {
if (curwin->w_jumplist[i].fmark.mark.lnum != 0) {
if (curwin->w_jumplist[i].fmark.fnum == 0)
fname2fnum(&curwin->w_jumplist[i]);
name = fm_getname(&curwin->w_jumplist[i].fmark, 16);
if (name == NULL) /* file name not available */
continue;
msg_putchar('\n');
if (got_int) {
vim_free(name);
break;
}
sprintf((char *)IObuff, "%c %2d %5ld %4d ",
i == curwin->w_jumplistidx ? '>' : ' ',
i > curwin->w_jumplistidx ? i - curwin->w_jumplistidx
: curwin->w_jumplistidx - i,
curwin->w_jumplist[i].fmark.mark.lnum,
curwin->w_jumplist[i].fmark.mark.col);
msg_outtrans(IObuff);
msg_outtrans_attr(name,
curwin->w_jumplist[i].fmark.fnum == curbuf->b_fnum
? hl_attr(HLF_D) : 0);
vim_free(name);
ui_breakcheck();
}
out_flush();
}
if (curwin->w_jumplistidx == curwin->w_jumplistlen)
MSG_PUTS("\n>");
}
示例12: os_call_shell
/// Calls the user shell for running a command, interactive session or
/// wildcard expansion. It uses the shell set in the `sh` option.
///
/// @param cmd The command to be executed. If NULL it will run an interactive
/// shell
/// @param opts Various options that control how the shell will work
/// @param extra_arg Extra argument to be passed to the shell
int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_arg)
{
DynamicBuffer input = DYNAMIC_BUFFER_INIT;
char *output = NULL, **output_ptr = NULL;
int current_state = State, old_mode = cur_tmode;
bool forward_output = true;
out_flush();
if (opts & kShellOptCooked) {
settmode(TMODE_COOK);
}
// While the child is running, ignore terminating signals
signal_reject_deadly();
if (opts & (kShellOptHideMess | kShellOptExpand)) {
forward_output = false;
} else {
State = EXTERNCMD;
if (opts & kShellOptWrite) {
read_input(&input);
}
if (opts & kShellOptRead) {
output_ptr = &output;
forward_output = false;
}
}
size_t nread;
int status = shell((const char *)cmd,
(const char *)extra_arg,
input.data,
input.len,
output_ptr,
&nread,
emsg_silent,
forward_output);
if (input.data) {
free(input.data);
}
if (output) {
write_output(output, nread);
free(output);
}
if (!emsg_silent && status != 0 && !(opts & kShellOptSilent)) {
MSG_PUTS(_("\nshell returned "));
msg_outnum(status);
msg_putchar('\n');
}
if (old_mode == TMODE_RAW) {
// restore mode
settmode(TMODE_RAW);
}
State = current_state;
signal_accept_deadly();
return status;
}
示例13: list_version
void list_version(void)
{
// When adding features here, don't forget to update the list of
// internal variables in eval.c!
MSG(longVersionWithDate);
MSG(version_commit);
MSG(version_buildtype);
MSG(version_cflags);
// Print the list of extra patch descriptions if there is at least one.
char *s = "";
if (extra_patches[0] != NULL) {
MSG_PUTS(_("\nExtra patches: "));
s = "";
for (int i = 0; extra_patches[i] != NULL; ++i) {
MSG_PUTS(s);
s = ", ";
MSG_PUTS(extra_patches[i]);
}
}
#ifdef HAVE_PATHDEF
if ((*compiled_user != NUL) || (*compiled_sys != NUL)) {
MSG_PUTS(_("\nCompiled "));
if (*compiled_user != NUL) {
MSG_PUTS(_("by "));
MSG_PUTS(compiled_user);
}
if (*compiled_sys != NUL) {
MSG_PUTS("@");
MSG_PUTS(compiled_sys);
}
}
#endif // ifdef HAVE_PATHDEF
version_msg(_("\n\nOptional features included (+) or not (-): "));
list_features();
#ifdef SYS_VIMRC_FILE
version_msg(_(" system vimrc file: \""));
version_msg(SYS_VIMRC_FILE);
version_msg("\"\n");
#endif // ifdef SYS_VIMRC_FILE
#ifdef USR_VIMRC_FILE
version_msg(_(" user vimrc file: \""));
version_msg(USR_VIMRC_FILE);
version_msg("\"\n");
#endif // ifdef USR_VIMRC_FILE
#ifdef USR_VIMRC_FILE2
version_msg(_(" 2nd user vimrc file: \""));
version_msg(USR_VIMRC_FILE2);
version_msg("\"\n");
#endif // ifdef USR_VIMRC_FILE2
#ifdef USR_VIMRC_FILE3
version_msg(_(" 3rd user vimrc file: \""));
version_msg(USR_VIMRC_FILE3);
version_msg("\"\n");
#endif // ifdef USR_VIMRC_FILE3
#ifdef USR_EXRC_FILE
version_msg(_(" user exrc file: \""));
version_msg(USR_EXRC_FILE);
version_msg("\"\n");
#endif // ifdef USR_EXRC_FILE
#ifdef USR_EXRC_FILE2
version_msg(_(" 2nd user exrc file: \""));
version_msg(USR_EXRC_FILE2);
version_msg("\"\n");
#endif // ifdef USR_EXRC_FILE2
#ifdef HAVE_PATHDEF
if (*default_vim_dir != NUL) {
version_msg(_(" fall-back for $VIM: \""));
version_msg(default_vim_dir);
version_msg("\"\n");
}
if (*default_vimruntime_dir != NUL) {
version_msg(_(" f-b for $VIMRUNTIME: \""));
version_msg(default_vimruntime_dir);
version_msg("\"\n");
}
#endif // ifdef HAVE_PATHDEF
}
示例14: list_version
void list_version(void)
{
int i;
int first;
char *s = "";
// When adding features here, don't forget to update the list of
// internal variables in eval.c!
MSG(longVersion);
// Print the list of patch numbers if there is at least one.
// Print a range when patches are consecutive: "1-10, 12, 15-40, 42-45"
if (included_patches[0] != 0) {
MSG_PUTS(_("\nIncluded patches: "));
first = -1;
// find last one
for (i = 0; included_patches[i] != 0; ++i) {}
while (--i >= 0) {
if (first < 0) {
first = included_patches[i];
}
if ((i == 0) || (included_patches[i - 1] != included_patches[i] + 1)) {
MSG_PUTS(s);
s = ", ";
msg_outnum((long)first);
if (first != included_patches[i]) {
MSG_PUTS("-");
msg_outnum((long)included_patches[i]);
}
first = -1;
}
}
}
// Print the list of extra patch descriptions if there is at least one.
if (extra_patches[0] != NULL) {
MSG_PUTS(_("\nExtra patches: "));
s = "";
for (i = 0; extra_patches[i] != NULL; ++i) {
MSG_PUTS(s);
s = ", ";
MSG_PUTS(extra_patches[i]);
}
}
#ifdef MODIFIED_BY
MSG_PUTS("\n");
MSG_PUTS(_("Modified by "));
MSG_PUTS(MODIFIED_BY);
#endif // ifdef MODIFIED_BY
#ifdef HAVE_PATHDEF
if ((*compiled_user != NUL) || (*compiled_sys != NUL)) {
MSG_PUTS(_("\nCompiled "));
if (*compiled_user != NUL) {
MSG_PUTS(_("by "));
MSG_PUTS(compiled_user);
}
if (*compiled_sys != NUL) {
MSG_PUTS("@");
MSG_PUTS(compiled_sys);
}
}
#endif // ifdef HAVE_PATHDEF
MSG_PUTS(_("\nHuge version "));
MSG_PUTS(_("without GUI."));
version_msg(_(" Features included (+) or not (-):\n"));
list_features();
#ifdef SYS_VIMRC_FILE
version_msg(_(" system vimrc file: \""));
version_msg(SYS_VIMRC_FILE);
version_msg("\"\n");
#endif // ifdef SYS_VIMRC_FILE
#ifdef USR_VIMRC_FILE
version_msg(_(" user vimrc file: \""));
version_msg(USR_VIMRC_FILE);
version_msg("\"\n");
#endif // ifdef USR_VIMRC_FILE
#ifdef USR_VIMRC_FILE2
version_msg(_(" 2nd user vimrc file: \""));
version_msg(USR_VIMRC_FILE2);
version_msg("\"\n");
#endif // ifdef USR_VIMRC_FILE2
#ifdef USR_VIMRC_FILE3
version_msg(_(" 3rd user vimrc file: \""));
version_msg(USR_VIMRC_FILE3);
version_msg("\"\n");
#endif // ifdef USR_VIMRC_FILE3
#ifdef USR_EXRC_FILE
//.........这里部分代码省略.........
示例15: show_menus_recursive
/*
* Recursively show the mappings associated with the menus under the given one
*/
static void show_menus_recursive(vimmenu_T *menu, int modes, int depth)
{
int i;
int bit;
if (menu != NULL && (menu->modes & modes) == 0x0)
return;
if (menu != NULL) {
msg_putchar('\n');
if (got_int) /* "q" hit for "--more--" */
return;
for (i = 0; i < depth; i++)
MSG_PUTS(" ");
if (menu->priority) {
msg_outnum((long)menu->priority);
MSG_PUTS(" ");
}
/* Same highlighting as for directories!? */
msg_outtrans_attr(menu->name, hl_attr(HLF_D));
}
if (menu != NULL && menu->children == NULL) {
for (bit = 0; bit < MENU_MODES; bit++)
if ((menu->modes & modes & (1 << bit)) != 0) {
msg_putchar('\n');
if (got_int) /* "q" hit for "--more--" */
return;
for (i = 0; i < depth + 2; i++)
MSG_PUTS(" ");
msg_putchar(menu_mode_chars[bit]);
if (menu->noremap[bit] == REMAP_NONE)
msg_putchar('*');
else if (menu->noremap[bit] == REMAP_SCRIPT)
msg_putchar('&');
else
msg_putchar(' ');
if (menu->silent[bit])
msg_putchar('s');
else
msg_putchar(' ');
if ((menu->modes & menu->enabled & (1 << bit)) == 0)
msg_putchar('-');
else
msg_putchar(' ');
MSG_PUTS(" ");
if (*menu->strings[bit] == NUL)
msg_puts_attr((char_u *)"<Nop>", hl_attr(HLF_8));
else
msg_outtrans_special(menu->strings[bit], FALSE);
}
} else {
if (menu == NULL) {
menu = root_menu;
depth--;
} else
menu = menu->children;
/* recursively show all children. Skip PopUp[nvoci]. */
for (; menu != NULL && !got_int; menu = menu->next)
if (!menu_is_hidden(menu->dname))
show_menus_recursive(menu, modes, depth + 1);
}
}