!690 modify gs_ctl --help information & fix gsql core bug when running '\e'

Merge pull request !690 from chenxiaobin/110_bugfix
This commit is contained in:
opengauss-bot 2021-02-05 15:41:35 +08:00 committed by Gitee
commit d5daa40497
2 changed files with 19 additions and 16 deletions

View File

@ -3463,7 +3463,7 @@ static void do_help(void)
printf(_(" %s restart [-w] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n"
" [-o \"OPTIONS\"]\n"),
progname);
printf(_(" %s build [-D DATADIR] [-r SECS] [-q]\n"), progname);
printf(_(" %s build [-D DATADIR] [-b MODE] [-r SECS] [-q] [-M SERVERMODE]\n"), progname);
#endif
printf(_(" %s stop [-W] [-t SECS] [-D DATADIR] [-s] [-m SHUTDOWN-MODE]\n"), progname);
@ -3489,7 +3489,8 @@ static void do_help(void)
(void)printf(_(" %s hotpatch [-D DATADIR] [-a ACTION] [-n NAME]\n"), progname);
#endif
printf(_("\nCommon options:\n"));
printf(_(" -b, --mode=MODE the mode of building the datanode.MODE can be \"full\", \"incremental\"\n"));
printf(_(" -b, --mode=MODE the mode of building the datanode.MODE can be \"full\", \"incremental\", "
"\"auto\"\n"));
printf(_(" -D, --pgdata=DATADIR location of the database storage area\n"));
printf(_(" -s, --silent only print errors, no informational messages\n"));
printf(_(" -t, --timeout=SECS seconds to wait when using -w option\n"));

View File

@ -1870,22 +1870,23 @@ static bool editFile(const char* fname, int lineno)
return false;
}
check_env_value(editor_lineno_arg);
}
if (strlen(editor_lineno_arg) >= MAXPGPATH) {
psql_error("The value of \"editor_lineno_arg\" is too long.\n");
free(editor_lineno_arg);
editor_lineno_arg = NULL;
free(editorName);
editorName = NULL;
return false;
if (strlen(editor_lineno_arg) >= MAXPGPATH) {
psql_error("The value of \"editor_lineno_arg\" is too long.\n");
free(editor_lineno_arg);
editor_lineno_arg = NULL;
free(editorName);
editorName = NULL;
return false;
}
syssz = strlen(editorName) + strlen(editor_lineno_arg) + 10 /* for integer */
+ 1 + strlen(fname) + 10 + 1;
} else {
syssz = strlen(editorName) + strlen(fname) + 10 + 1;
}
/* Allocate sufficient memory for command line. */
lineno > 0 ? (syssz = strlen(editorName) + strlen(editor_lineno_arg) + 10 /* for integer */
+ 1 + strlen(fname) + 10 + 1) :
(syssz = strlen(editorName) + strlen(fname) + 10 + 1);
sys = (char*)pg_malloc(syssz);
/*
@ -1902,11 +1903,12 @@ static bool editFile(const char* fname, int lineno)
check_sprintf_s(sprintf_s(sys, syssz, "exec %s '%s'", editorName, fname));
}
#else
if (lineno > 0)
if (lineno > 0) {
check_sprintf_s(sprintf_s(
sys, syssz, SYSTEMQUOTE "\"%s\" %s%d \"%s\"" SYSTEMQUOTE, editorName, editor_lineno_arg, lineno, fname));
else
} else {
check_sprintf_s(sprintf_s(sys, syssz, SYSTEMQUOTE "\"%s\" \"%s\"" SYSTEMQUOTE, editorName, fname));
}
#endif
result = system(sys);
if (result == -1) {