--- src/bin/psql/command.c +++ src/bin/psql/command.c @@ -19,6 +19,7 @@ #include /* for stat() */ #include /* open() flags */ #include /* for geteuid(), getpid(), stat() */ +#include /* for getenv() */ #else #include #include @@ -526,6 +527,37 @@ } } +#ifndef WIN32 + /* \import an environment */ + else if (strcmp(cmd, "import") == 0) + { + char *opt0 = scan_option(&string, 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); @@ -701,6 +733,7 @@ /* Check for special variables */ if (strcmp(opt0, "VERBOSITY") == 0) SyncVerbosityVariable(); + success = true; } else {