aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Reed <m.reed@mykolab.com>2015-05-30 01:06:19 -0400
committerMichael Reed <m.reed@mykolab.com>2015-05-30 17:09:22 -0400
commit7c2afbd9a69c5aa2d148251f1a7e5773fb0f2ebb (patch)
treef492c5cf87de386d5b50de628a9e4f257d590e8a
parent53774af5e94f437135e4664949d65ccf3be030e0 (diff)
downloadrneovim-7c2afbd9a69c5aa2d148251f1a7e5773fb0f2ebb.tar.gz
rneovim-7c2afbd9a69c5aa2d148251f1a7e5773fb0f2ebb.tar.bz2
rneovim-7c2afbd9a69c5aa2d148251f1a7e5773fb0f2ebb.zip
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>
-rw-r--r--src/nvim/main.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/src/nvim/main.c b/src/nvim/main.c
index ef9390aaf8..d917d4a9b8 100644
--- a/src/nvim/main.c
+++ b/src/nvim/main.c
@@ -122,6 +122,8 @@ typedef struct {
# include "main.c.generated.h"
#endif
+static char *argv0;
+
// Error messages
static const char *err_arg_missing = N_("Argument missing after");
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)
#endif
{
+ argv0 = (char *)path_tail((char_u *)argv[0]);
+
char_u *fname = NULL; /* file name from command line */
mparm_T params; /* various parameters passed between
* 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
+ mch_errmsg(argv0);
+ mch_errmsg(": ");
mch_errmsg(_(errstr));
if (str != NULL) {
mch_errmsg(": \"");
mch_errmsg(str);
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);
}