mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
main.c:mainerr(): Namespace messages
Error messages in general should be namespaced, especially in the context of a shell. Given the possibility of a backgrounded job printing messages to standard output/error, namespacing these messages should avoid any confusion as to where the message came from. Helped-by: Scott Prager <splinterofchaos@gmail.com> Helped-by: oni-link <knil.ino@gmail.com>
This commit is contained in:
parent
53774af5e9
commit
7c2afbd9a6
@ -122,6 +122,8 @@ typedef struct {
|
|||||||
# include "main.c.generated.h"
|
# include "main.c.generated.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
static char *argv0;
|
||||||
|
|
||||||
// Error messages
|
// Error messages
|
||||||
static const char *err_arg_missing = N_("Argument missing after");
|
static const char *err_arg_missing = N_("Argument missing after");
|
||||||
static const char *err_opt_garbage = N_("Garbage after option argument");
|
static const char *err_opt_garbage = N_("Garbage after option argument");
|
||||||
@ -180,6 +182,8 @@ int nvim_main(int argc, char **argv)
|
|||||||
int main(int argc, char **argv)
|
int main(int argc, char **argv)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
|
argv0 = (char *)path_tail((char_u *)argv[0]);
|
||||||
|
|
||||||
char_u *fname = NULL; /* file name from command line */
|
char_u *fname = NULL; /* file name from command line */
|
||||||
mparm_T params; /* various parameters passed between
|
mparm_T params; /* various parameters passed between
|
||||||
* main() and other functions. */
|
* main() and other functions. */
|
||||||
@ -1929,13 +1933,17 @@ static void mainerr(const char *errstr, const char *str)
|
|||||||
{
|
{
|
||||||
signal_stop(); // kill us with CTRL-C here, if you like
|
signal_stop(); // kill us with CTRL-C here, if you like
|
||||||
|
|
||||||
|
mch_errmsg(argv0);
|
||||||
|
mch_errmsg(": ");
|
||||||
mch_errmsg(_(errstr));
|
mch_errmsg(_(errstr));
|
||||||
if (str != NULL) {
|
if (str != NULL) {
|
||||||
mch_errmsg(": \"");
|
mch_errmsg(": \"");
|
||||||
mch_errmsg(str);
|
mch_errmsg(str);
|
||||||
mch_errmsg("\"");
|
mch_errmsg("\"");
|
||||||
}
|
}
|
||||||
mch_errmsg(_("\nMore info with \"nvim -h\"\n"));
|
mch_errmsg(_("\nMore info with \""));
|
||||||
|
mch_errmsg(argv0);
|
||||||
|
mch_errmsg(" -h\"\n");
|
||||||
|
|
||||||
mch_exit(1);
|
mch_exit(1);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user