--- src/bin/psql/command.c +++ src/bin/psql/command.c @@ -21,6 +21,7 @@ #include /* for stat() */ #include /* open() flags */ #include /* for geteuid(), getpid(), stat() */ +#include /* for getenv() */ #else #include #include @@ -669,6 +670,37 @@ } } +#ifndef WIN32 + /* \import an environment */ + else if (strcmp(cmd, "import") == 0) + { + char *opt0 = psql_scan_slash_option(scan_state, OT_NORMAL, NULL, false); + + if (!opt0) + { + /* XXX Not implemented yet */ + success = true; + } + else + { + char *opt; + + if ((opt = getenv(opt0))) + { + if (!SetVariable(pset.vars, opt0, opt)) + { + psql_error("\\%s: error\n", cmd); + success = false; + }else success = true; + }else + { + psql_error("\\%s: error\n", cmd); + success = false; + } } + free(opt0); + } +#endif + /* \l is list databases */ else if (strcmp(cmd, "l") == 0 || strcmp(cmd, "list") == 0) success = listAllDbs(false);