diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2015-11-03 11:49:21 -0500 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2015-11-03 11:49:21 -0500 |
commit | f4057cdffc355f5d4a9d8411fb953069be6d72ea (patch) | |
tree | e28afd4921201c72c0c413db90962d66a6b86988 /src | |
parent | fd5ce6b89b63bdb9632a925a80f6f7d4e7bd2e00 (diff) | |
download | postgresql-f4057cdffc355f5d4a9d8411fb953069be6d72ea.tar.gz postgresql-f4057cdffc355f5d4a9d8411fb953069be6d72ea.zip |
Code + docs review for unicode linestyle patch.
Fix some brain fade in commit a2dabf0e1dda93c8: erroneous variable names
in docs, rearrangements that made sentences less clear not more so,
undocumented and poorly-chosen-anyway API behaviors of subroutines,
bad grammar in error messages, copy-and-paste faults.
Albe Laurenz and Tom Lane
Diffstat (limited to 'src')
-rw-r--r-- | src/bin/psql/command.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c index 22bfddcd08a..fd7bb7db1fc 100644 --- a/src/bin/psql/command.c +++ b/src/bin/psql/command.c @@ -2302,11 +2302,11 @@ _align2string(enum printFormat in) } /* - * Parse entered unicode linestyle. Returns true, when entered string is - * known linestyle: single, double else returns false. + * Parse entered unicode linestyle. If ok, update *linestyle and return + * true, else return false. */ static bool -set_unicode_line_style(printQueryOpt *popt, const char *value, size_t vallen, +set_unicode_line_style(const char *value, size_t vallen, unicode_linestyle *linestyle) { if (pg_strncasecmp("single", value, vallen) == 0) @@ -2315,10 +2315,6 @@ set_unicode_line_style(printQueryOpt *popt, const char *value, size_t vallen, *linestyle = UNICODE_LINESTYLE_DOUBLE; else return false; - - /* input is ok, generate new unicode style */ - refresh_utf8format(&(popt->topt)); - return true; } @@ -2404,10 +2400,12 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet) { if (!value) ; - else if (!set_unicode_line_style(popt, value, vallen, - &popt->topt.unicode_border_linestyle)) + else if (set_unicode_line_style(value, vallen, + &popt->topt.unicode_border_linestyle)) + refresh_utf8format(&(popt->topt)); + else { - psql_error("\\pset: allowed unicode border linestyle are single, double\n"); + psql_error("\\pset: allowed unicode border linestyles are single, double\n"); return false; } } @@ -2417,10 +2415,12 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet) { if (!value) ; - else if (!set_unicode_line_style(popt, value, vallen, - &popt->topt.unicode_column_linestyle)) + else if (set_unicode_line_style(value, vallen, + &popt->topt.unicode_column_linestyle)) + refresh_utf8format(&(popt->topt)); + else { - psql_error("\\pset: allowed unicode column linestyle are single, double\n"); + psql_error("\\pset: allowed unicode column linestyles are single, double\n"); return false; } } @@ -2430,10 +2430,12 @@ do_pset(const char *param, const char *value, printQueryOpt *popt, bool quiet) { if (!value) ; - else if (!set_unicode_line_style(popt, value, vallen, - &popt->topt.unicode_header_linestyle)) + else if (set_unicode_line_style(value, vallen, + &popt->topt.unicode_header_linestyle)) + refresh_utf8format(&(popt->topt)); + else { - psql_error("\\pset: allowed unicode header linestyle are single, double\n"); + psql_error("\\pset: allowed unicode header linestyles are single, double\n"); return false; } } @@ -2758,7 +2760,7 @@ printPsetInfo(const char *param, struct printQueryOpt *popt) else if (strcmp(param, "unicode_header_linestyle") == 0) { - printf(_("Unicode border linestyle is \"%s\".\n"), + printf(_("Unicode header linestyle is \"%s\".\n"), _unicode_linestyle2string(popt->topt.unicode_header_linestyle)); } |