diff options
author | Tatsuo Ishii <ishii@postgresql.org> | 2000-01-15 05:38:50 +0000 |
---|---|---|
committer | Tatsuo Ishii <ishii@postgresql.org> | 2000-01-15 05:38:50 +0000 |
commit | bfbd58ce131c527d04911dac59feaf28876cf4cf (patch) | |
tree | 74f43028cefc4253e133b0317305691684a1d36d /src/bin/psql/copy.c | |
parent | 8fc386a2d830c94dbf990e97297cb9ae75fa4453 (diff) |
Adapt to the changes of libpq(eliminateing using putenv()).
Diffstat (limited to 'src/bin/psql/copy.c')
-rw-r--r-- | src/bin/psql/copy.c | 32 |
1 files changed, 16 insertions, 16 deletions
diff --git a/src/bin/psql/copy.c b/src/bin/psql/copy.c index 66449873346..8e64c80b982 100644 --- a/src/bin/psql/copy.c +++ b/src/bin/psql/copy.c @@ -58,7 +58,7 @@ free_copy_options(struct copy_options * ptr) static struct copy_options * -parse_slash_copy(const char *args) +parse_slash_copy(const char *args, int encoding) { struct copy_options *result; char *line; @@ -74,7 +74,7 @@ parse_slash_copy(const char *args) exit(EXIT_FAILURE); } - token = strtokx(line, " \t", "\"", '\\', "e, NULL); + token = strtokx(line, " \t", "\"", '\\', "e, NULL, encoding); if (!token) error = true; else @@ -84,7 +84,7 @@ parse_slash_copy(const char *args) if (!quote && strcasecmp(token, "binary") == 0) { result->binary = true; - token = strtokx(NULL, " \t", "\"", '\\', "e, NULL); + token = strtokx(NULL, " \t", "\"", '\\', "e, NULL, encoding); if (!token) error = true; } @@ -99,14 +99,14 @@ parse_slash_copy(const char *args) if (!error) { - token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL); + token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL, encoding); if (!token) error = true; else { if (strcasecmp(token, "with") == 0) { - token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL); + token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL, encoding); if (!token || strcasecmp(token, "oids") != 0) error = true; else @@ -114,7 +114,7 @@ parse_slash_copy(const char *args) if (!error) { - token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL); + token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL, encoding); if (!token) error = true; } @@ -131,7 +131,7 @@ parse_slash_copy(const char *args) if (!error) { - token = strtokx(NULL, " \t", "'", '\\', "e, NULL); + token = strtokx(NULL, " \t", "'", '\\', "e, NULL, encoding); if (!token) error = true; else if (!quote && (strcasecmp(token, "stdin")==0 || strcasecmp(token, "stdout")==0)) @@ -142,21 +142,21 @@ parse_slash_copy(const char *args) if (!error) { - token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL); + token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL, encoding); if (token) { if (strcasecmp(token, "using") == 0) { - token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL); + token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL, encoding); if (!token || strcasecmp(token, "delimiters") != 0) error = true; else { - token = strtokx(NULL, " \t", "'", '\\', NULL, NULL); + token = strtokx(NULL, " \t", "'", '\\', NULL, NULL, encoding); if (token) { result->delim = xstrdup(token); - token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL); + token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL, encoding); } else error = true; @@ -167,17 +167,17 @@ parse_slash_copy(const char *args) { if (strcasecmp(token, "with") == 0) { - token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL); + token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL, encoding); if (!token || strcasecmp(token, "null") != 0) error = true; else { - token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL); + token = strtokx(NULL, " \t", NULL, '\\', NULL, NULL, encoding); if (!token || strcasecmp(token, "as") != 0) error = true; else { - token = strtokx(NULL, " \t", "'", '\\', NULL, NULL); + token = strtokx(NULL, " \t", "'", '\\', NULL, NULL, encoding); if (token) result->null = xstrdup(token); } @@ -214,7 +214,7 @@ parse_slash_copy(const char *args) * file or route its response into the file. */ bool -do_copy(const char *args) +do_copy(const char *args, int encoding) { char query[128 + NAMEDATALEN]; FILE *copystream; @@ -223,7 +223,7 @@ do_copy(const char *args) bool success; /* parse options */ - options = parse_slash_copy(args); + options = parse_slash_copy(args, encoding); if (!options) return false; |