diff --git a/src/bin/psql/command.c b/src/bin/psql/command.c new file mode 100644 index 740884f..d3b97ca *** a/src/bin/psql/command.c --- b/src/bin/psql/command.c *************** *** 7,12 **** --- 7,13 ---- */ #include "postgres_fe.h" #include "command.h" + #include "stringutils.h" #ifdef __BORLANDC__ /* needed for BCC */ #undef mkdir *************** exec_command(const char *cmd, *** 1047,1054 **** /* This scrolls off the screen when using /dev/tty */ success = saveHistory(fname ? fname : DEVTTY, -1, false, false); if (success && !pset.quiet && fname) ! printf(gettext("Wrote history to file \"%s/%s\".\n"), ! pset.dirname ? pset.dirname : ".", fname); if (!fname) putchar('\n'); free(fname); --- 1048,1060 ---- /* This scrolls off the screen when using /dev/tty */ success = saveHistory(fname ? fname : DEVTTY, -1, false, false); if (success && !pset.quiet && fname) ! { ! char *fname_formatted = format_fname(fname, pset.dirname); ! printf(gettext("Wrote history to file \"%s\".\n"), ! fname_formatted); ! free(fname_formatted); ! } ! if (!fname) putchar('\n'); free(fname); diff --git a/src/bin/psql/input.c b/src/bin/psql/input.c new file mode 100644 index 07c9e89..092ce93 *** a/src/bin/psql/input.c --- b/src/bin/psql/input.c *************** *** 16,21 **** --- 16,22 ---- #include "settings.h" #include "tab-complete.h" #include "common.h" + #include "stringutils.h" #ifndef WIN32 #define PSQLHISTORY ".psql_history" *************** bool *** 341,347 **** saveHistory(char *fname, int max_lines, bool appendFlag, bool encodeFlag) { #ifdef USE_READLINE ! /* * Suppressing the write attempt when HISTFILE is set to /dev/null may * look like a negligible optimization, but it's necessary on e.g. Darwin, --- 342,348 ---- saveHistory(char *fname, int max_lines, bool appendFlag, bool encodeFlag) { #ifdef USE_READLINE ! char *fname_formatted; /* * Suppressing the write attempt when HISTFILE is set to /dev/null may * look like a negligible optimization, but it's necessary on e.g. Darwin, *************** saveHistory(char *fname, int max_lines, *** 404,411 **** return true; } psql_error("could not save history to file \"%s\": %s\n", ! fname, strerror(errno)); } #else /* only get here in \s case, so complain */ --- 405,414 ---- return true; } + fname_formatted = format_fname(fname, pset.dirname); psql_error("could not save history to file \"%s\": %s\n", ! fname_formatted, strerror(errno)); ! free(fname_formatted); } #else /* only get here in \s case, so complain */ diff --git a/src/bin/psql/po/cs.po b/src/bin/psql/po/cs.po new file mode 100644 index 2b647e5..bb0d12e *** a/src/bin/psql/po/cs.po --- b/src/bin/psql/po/cs.po *************** msgstr "" *** 10,16 **** "Project-Id-Version: postgresql 8.4\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2009-05-21 21:08+0000\n" ! "PO-Revision-Date: 2009-05-24 15:46+0200\n" "Last-Translator: Zdeněk Kotala\n" "Language-Team: Czech \n" "MIME-Version: 1.0\n" --- 10,16 ---- "Project-Id-Version: postgresql 8.4\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2009-05-21 21:08+0000\n" ! "PO-Revision-Date: 2013-01-20 10:05+0900\n" "Last-Translator: Zdeněk Kotala\n" "Language-Team: Czech \n" "MIME-Version: 1.0\n" *************** msgstr "Buffer dotazů vyprázdněn." *** 100,107 **** #: command.c:912 #, c-format ! msgid "Wrote history to file \"%s/%s\".\n" ! msgstr "Historie zapsána do soubor: \"%s/%s\".\n" #: command.c:950 common.c:52 common.c:66 input.c:198 mainloop.c:69 #: mainloop.c:227 print.c:61 print.c:75 --- 100,107 ---- #: command.c:912 #, c-format ! msgid "Wrote history to file \"%s\".\n" ! msgstr "Historie zapsána do soubor: \"%s\".\n" #: command.c:950 common.c:52 common.c:66 input.c:198 mainloop.c:69 #: mainloop.c:227 print.c:61 print.c:75 diff --git a/src/bin/psql/po/de.po b/src/bin/psql/po/de.po new file mode 100644 index 63d33df..b8b2fc7 *** a/src/bin/psql/po/de.po --- b/src/bin/psql/po/de.po *************** msgstr "" *** 10,16 **** "Project-Id-Version: PostgreSQL 9.1\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2011-07-27 16:54+0000\n" ! "PO-Revision-Date: 2011-07-27 23:43+0300\n" "Last-Translator: Peter Eisentraut \n" "Language-Team: German \n" "Language: de\n" --- 10,16 ---- "Project-Id-Version: PostgreSQL 9.1\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2011-07-27 16:54+0000\n" ! "PO-Revision-Date: 2013-01-20 10:07+0900\n" "Last-Translator: Peter Eisentraut \n" "Language-Team: German \n" "Language: de\n" *************** msgstr "Anfragepuffer wurde gelöscht." *** 130,137 **** #: command.c:1047 #, c-format ! msgid "Wrote history to file \"%s/%s\".\n" ! msgstr "Befehlsgeschichte in Datei »%s/%s« geschrieben.\n" #: command.c:1085 common.c:52 common.c:66 common.c:90 input.c:209 #: mainloop.c:72 mainloop.c:234 print.c:137 print.c:151 --- 130,137 ---- #: command.c:1047 #, c-format ! msgid "Wrote history to file \"%s\".\n" ! msgstr "Befehlsgeschichte in Datei »%s« geschrieben.\n" #: command.c:1085 common.c:52 common.c:66 common.c:90 input.c:209 #: mainloop.c:72 mainloop.c:234 print.c:137 print.c:151 diff --git a/src/bin/psql/po/es.po b/src/bin/psql/po/es.po new file mode 100644 index e9ec8a8..06018ad *** a/src/bin/psql/po/es.po --- b/src/bin/psql/po/es.po *************** msgstr "" *** 13,19 **** "Project-Id-Version: psql (PostgreSQL 9.0)\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2010-09-01 18:03+0000\n" ! "PO-Revision-Date: 2010-09-01 17:17-0400\n" "Last-Translator: Álvaro Herrera \n" "Language-Team: PgSQL Español \n" "MIME-Version: 1.0\n" --- 13,19 ---- "Project-Id-Version: psql (PostgreSQL 9.0)\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2010-09-01 18:03+0000\n" ! "PO-Revision-Date: 2013-01-20 10:08+0900\n" "Last-Translator: Álvaro Herrera \n" "Language-Team: PgSQL Español \n" "MIME-Version: 1.0\n" *************** msgstr "El búfer de consulta ha sido re *** 105,112 **** #: command.c:940 #, c-format ! msgid "Wrote history to file \"%s/%s\".\n" ! msgstr "Se escribió la historia en el archivo «%s/%s».\n" #: command.c:978 common.c:52 common.c:66 input.c:209 mainloop.c:72 #: mainloop.c:234 print.c:137 print.c:151 --- 105,112 ---- #: command.c:940 #, c-format ! msgid "Wrote history to file \"%s\".\n" ! msgstr "Se escribió la historia en el archivo «%s».\n" #: command.c:978 common.c:52 common.c:66 input.c:209 mainloop.c:72 #: mainloop.c:234 print.c:137 print.c:151 diff --git a/src/bin/psql/po/fr.po b/src/bin/psql/po/fr.po new file mode 100644 index 658c41b..f3ba8ba *** a/src/bin/psql/po/fr.po --- b/src/bin/psql/po/fr.po *************** msgstr "" *** 12,18 **** "Project-Id-Version: PostgreSQL 8.4\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2011-06-13 14:55+0000\n" ! "PO-Revision-Date: 2011-06-14 21:32+0100\n" "Last-Translator: Guillaume Lelarge \n" "Language-Team: French \n" "Language: fr\n" --- 12,18 ---- "Project-Id-Version: PostgreSQL 8.4\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2011-06-13 14:55+0000\n" ! "PO-Revision-Date: 2013-01-20 10:06+0900\n" "Last-Translator: Guillaume Lelarge \n" "Language-Team: French \n" "Language: fr\n" *************** msgstr "Le tampon de requte a t effac *** 137,144 **** #: command.c:1047 #, c-format ! msgid "Wrote history to file \"%s/%s\".\n" ! msgstr "Historique sauvegard dans le fichier %s/%s .\n" #: command.c:1085 #: common.c:52 --- 137,144 ---- #: command.c:1047 #, c-format ! msgid "Wrote history to file \"%s\".\n" ! msgstr "Historique sauvegard dans le fichier %s .\n" #: command.c:1085 #: common.c:52 diff --git a/src/bin/psql/po/ja.po b/src/bin/psql/po/ja.po new file mode 100644 index 1df315e..30d61ec *** a/src/bin/psql/po/ja.po --- b/src/bin/psql/po/ja.po *************** msgstr "" *** 6,12 **** "Project-Id-Version: PostgreSQL 9.1 beta2\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2011-06-14 22:18+0900\n" ! "PO-Revision-Date: 2011-06-16 05:26+0900\n" "Last-Translator: HOTTA Michihide \n" "Language-Team: jpug-doc \n" "MIME-Version: 1.0\n" --- 6,12 ---- "Project-Id-Version: PostgreSQL 9.1 beta2\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2011-06-14 22:18+0900\n" ! "PO-Revision-Date: 2013-01-20 10:07+0900\n" "Last-Translator: HOTTA Michihide \n" "Language-Team: jpug-doc \n" "MIME-Version: 1.0\n" *************** msgstr "クエリーバッファがリ *** 122,129 **** #: command.c:1047 #, c-format ! msgid "Wrote history to file \"%s/%s\".\n" ! msgstr "ファイル \"%s/%s\" にヒストリを出力しました。\n" #: command.c:1085 common.c:52 common.c:66 input.c:209 mainloop.c:72 #: mainloop.c:234 print.c:137 print.c:151 --- 122,129 ---- #: command.c:1047 #, c-format ! msgid "Wrote history to file \"%s\".\n" ! msgstr "ファイル \"%s\" にヒストリを出力しました。\n" #: command.c:1085 common.c:52 common.c:66 input.c:209 mainloop.c:72 #: mainloop.c:234 print.c:137 print.c:151 diff --git a/src/bin/psql/po/pt_BR.po b/src/bin/psql/po/pt_BR.po new file mode 100644 index 1182e77..ff8f995 *** a/src/bin/psql/po/pt_BR.po --- b/src/bin/psql/po/pt_BR.po *************** msgstr "" *** 8,14 **** "Project-Id-Version: PostgreSQL 9.0\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2010-09-08 23:58-0300\n" ! "PO-Revision-Date: 2005-11-02 10:30-0300\n" "Last-Translator: Euler Taveira de Oliveira \n" "Language-Team: Brazilian Portuguese \n" "Language: pt_BR\n" --- 8,14 ---- "Project-Id-Version: PostgreSQL 9.0\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2010-09-08 23:58-0300\n" ! "PO-Revision-Date: 2013-01-20 10:06+0900\n" "Last-Translator: Euler Taveira de Oliveira \n" "Language-Team: Brazilian Portuguese \n" "Language: pt_BR\n" *************** msgstr "Buffer de consulta reiniciado (l *** 101,108 **** #: command.c:940 #, c-format ! msgid "Wrote history to file \"%s/%s\".\n" ! msgstr "Histórico escrito para arquivo \"%s/%s\".\n" #: command.c:978 common.c:52 common.c:66 input.c:209 mainloop.c:72 #: mainloop.c:234 print.c:137 print.c:151 --- 101,108 ---- #: command.c:940 #, c-format ! msgid "Wrote history to file \"%s\".\n" ! msgstr "Histórico escrito para arquivo \"%s\".\n" #: command.c:978 common.c:52 common.c:66 input.c:209 mainloop.c:72 #: mainloop.c:234 print.c:137 print.c:151 diff --git a/src/bin/psql/po/sv.po b/src/bin/psql/po/sv.po new file mode 100644 index f0db905..866d830 *** a/src/bin/psql/po/sv.po --- b/src/bin/psql/po/sv.po *************** msgstr "" *** 11,17 **** "Project-Id-Version: PostgreSQL 8.4\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2010-07-01 15:17+0000\n" ! "PO-Revision-Date: 2010-07-02 21:48-0400\n" "Last-Translator: Peter Eisentraut \n" "Language-Team: Swedish \n" "MIME-Version: 1.0\n" --- 11,17 ---- "Project-Id-Version: PostgreSQL 8.4\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2010-07-01 15:17+0000\n" ! "PO-Revision-Date: 2013-01-20 10:08+0900\n" "Last-Translator: Peter Eisentraut \n" "Language-Team: Swedish \n" "MIME-Version: 1.0\n" *************** msgstr "Frgebufferten har blivit bortta *** 101,108 **** #: command.c:940 #, c-format ! msgid "Wrote history to file \"%s/%s\".\n" ! msgstr "Kommandohistorien har skrivits till \"%s/%s\".\n" #: command.c:978 common.c:52 common.c:66 input.c:209 mainloop.c:72 #: mainloop.c:234 print.c:137 print.c:151 --- 101,108 ---- #: command.c:940 #, c-format ! msgid "Wrote history to file \"%s\".\n" ! msgstr "Kommandohistorien har skrivits till \"%s\".\n" #: command.c:978 common.c:52 common.c:66 input.c:209 mainloop.c:72 #: mainloop.c:234 print.c:137 print.c:151 diff --git a/src/bin/psql/po/tr.po b/src/bin/psql/po/tr.po new file mode 100644 index f515915..407821e *** a/src/bin/psql/po/tr.po --- b/src/bin/psql/po/tr.po *************** msgstr "" *** 6,12 **** "Project-Id-Version: psql-tr\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2009-06-11 05:09+0000\n" ! "PO-Revision-Date: 2009-06-11 10:57+0200\n" "Last-Translator: Devrim GÜNDÜZ \n" "Language-Team: Turkish \n" "MIME-Version: 1.0\n" --- 6,12 ---- "Project-Id-Version: psql-tr\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2009-06-11 05:09+0000\n" ! "PO-Revision-Date: 2013-01-20 10:08+0900\n" "Last-Translator: Devrim GÜNDÜZ \n" "Language-Team: Turkish \n" "MIME-Version: 1.0\n" *************** msgstr "Sorgu tamponu sıfırlanmış." *** 113,120 **** #: command.c:912 #, c-format ! msgid "Wrote history to file \"%s/%s\".\n" ! msgstr "Geçmiş, \"%s/%s\" dosyasına yazılmış.\n" #: command.c:950 #: common.c:52 --- 113,120 ---- #: command.c:912 #, c-format ! msgid "Wrote history to file \"%s\".\n" ! msgstr "Geçmiş, \"%s\" dosyasına yazılmış.\n" #: command.c:950 #: common.c:52 diff --git a/src/bin/psql/po/zh_CN.po b/src/bin/psql/po/zh_CN.po new file mode 100644 index 1a0ca28..992e561 *** a/src/bin/psql/po/zh_CN.po --- b/src/bin/psql/po/zh_CN.po *************** msgstr "" *** 3,9 **** "Project-Id-Version: psql (PostgreSQL 9.0)\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2010-10-01 14:42+0000\n" ! "PO-Revision-Date: 2010-10-01 13:08+0800\n" "Last-Translator: Weibin \n" "Language-Team: Chinese (Simplified)\n" "com>\n" --- 3,9 ---- "Project-Id-Version: psql (PostgreSQL 9.0)\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2010-10-01 14:42+0000\n" ! "PO-Revision-Date: 2013-01-20 10:07+0900\n" "Last-Translator: Weibin \n" "Language-Team: Chinese (Simplified)\n" "com>\n" *************** msgstr "查询缓存区重置(清空)。 *** 123,130 **** # command.c:646 #: command.c:940 #, c-format ! msgid "Wrote history to file \"%s/%s\".\n" ! msgstr "书写历程到档案 \"%s/%s\".\n" # command.c:681 # common.c:85 --- 123,130 ---- # command.c:646 #: command.c:940 #, c-format ! msgid "Wrote history to file \"%s\".\n" ! msgstr "书写历程到档案 \"%s\".\n" # command.c:681 # common.c:85 diff --git a/src/bin/psql/po/zh_TW.po b/src/bin/psql/po/zh_TW.po new file mode 100644 index d313637..7d4b0bb *** a/src/bin/psql/po/zh_TW.po --- b/src/bin/psql/po/zh_TW.po *************** msgstr "" *** 8,14 **** "Project-Id-Version: PostgreSQL 9.1\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2011-05-16 04:41+0000\n" ! "PO-Revision-Date: 2011-05-16 15:22+0800\n" "Last-Translator: Zhenbang Wei \n" "Language-Team: The PostgreSQL Global Development Group \n" "Language: \n" --- 8,14 ---- "Project-Id-Version: PostgreSQL 9.1\n" "Report-Msgid-Bugs-To: pgsql-bugs@postgresql.org\n" "POT-Creation-Date: 2011-05-16 04:41+0000\n" ! "PO-Revision-Date: 2013-01-20 10:06+0900\n" "Last-Translator: Zhenbang Wei \n" "Language-Team: The PostgreSQL Global Development Group \n" "Language: \n" *************** msgstr "查詢緩存區重置(清空)。 *** 163,170 **** # command.c:646 #: command.c:1047 #, c-format ! msgid "Wrote history to file \"%s/%s\".\n" ! msgstr "書寫歷程到檔案 \"%s/%s\".\n" # command.c:681 # common.c:85 --- 163,170 ---- # command.c:646 #: command.c:1047 #, c-format ! msgid "Wrote history to file \"%s\".\n" ! msgstr "書寫歷程到檔案 \"%s\".\n" # command.c:681 # common.c:85 diff --git a/src/bin/psql/stringutils.c b/src/bin/psql/stringutils.c new file mode 100644 index 450240d..5ce661b *** a/src/bin/psql/stringutils.c --- b/src/bin/psql/stringutils.c *************** quote_if_needed(const char *source, cons *** 341,343 **** --- 341,375 ---- return ret; } + + + /* + * format_fname + * + * Format a user-supplied filepath, either as an absolute filepath + * if supplied as such or psql's current working directory is set, + * otherwise as a relative filepath. + * + * dirname - psql's current working directory, or NULL + * fname - filepath supplied by user + */ + + char * + format_fname(const char *fname, const char *dirname) { + int fname_size; + char *fname_formatted; + + Assert(fname != NULL); + + fname_size = (dirname ? strlen(dirname) : 0) + strlen(fname) + 3; + fname_formatted = pg_malloc(fname_size); + + if(!pg_strncasecmp(fname, "/", 1)) + strncpy(fname_formatted, fname, strlen(fname) + 1); + else + sprintf(fname_formatted,"%s/%s", + dirname ? dirname : ".", + fname); + + return fname_formatted; + } diff --git a/src/bin/psql/stringutils.h b/src/bin/psql/stringutils.h new file mode 100644 index b991376..2cbb180 *** a/src/bin/psql/stringutils.h --- b/src/bin/psql/stringutils.h *************** extern char *strtokx(const char *s, *** 22,25 **** --- 22,27 ---- extern char *quote_if_needed(const char *source, const char *entails_quote, char quote, char escape, int encoding); + extern char *format_fname(const char *fname, const char *dirname); + #endif /* STRINGUTILS_H */