|
3 | 3 | * |
4 | 4 | * Copyright (c) 2000-2010, PostgreSQL Global Development Group |
5 | 5 | * |
6 | | - * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.224 2010/07/23 14:56:54 rhaas Exp $ |
| 6 | + * $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.225 2010/08/03 18:33:09 tgl Exp $ |
7 | 7 | */ |
8 | 8 | #include "postgres_fe.h" |
9 | 9 | #include "command.h" |
@@ -294,28 +294,25 @@ exec_command(const char *cmd, |
294 | 294 | free(opt); |
295 | 295 | } |
296 | 296 |
|
297 | | - /* \conninfo -- display information about the current connection */ |
| 297 | + /* \conninfo -- display information about the current connection */ |
298 | 298 | else if (strcmp(cmd, "conninfo") == 0) |
299 | 299 | { |
300 | 300 | char *db = PQdb(pset.db); |
301 | 301 | char *host = PQhost(pset.db); |
302 | 302 |
|
303 | 303 | if (db == NULL) |
304 | | - printf("You are not connected.\n"); |
| 304 | + printf(_("You are not connected.\n")); |
305 | 305 | else |
306 | 306 | { |
307 | 307 | if (host == NULL) |
308 | 308 | host = DEFAULT_PGSOCKET_DIR; |
309 | | - /* |
310 | | - * If the host is an absolute path, the connection is via local |
311 | | - * socket. |
312 | | - */ |
| 309 | + /* If the host is an absolute path, the connection is via socket */ |
313 | 310 | if (is_absolute_path(host)) |
314 | | - printf("You are connected to database \"%s\" via local socket in \"%s\" at port \"%s\" as user \"%s\".\n", |
315 | | - db, host, PQport(pset.db), PQuser(pset.db)); |
| 311 | + printf(_("You are connected to database \"%s\" as user \"%s\" via socket in \"%s\" at port \"%s\".\n"), |
| 312 | + db, PQuser(pset.db), host, PQport(pset.db)); |
316 | 313 | else |
317 | | - printf("You are connected to database \"%s\" on host \"%s\" at port \"%s\" as user \"%s\".\n", |
318 | | - db, host, PQport(pset.db), PQuser(pset.db)); |
| 314 | + printf(_("You are connected to database \"%s\" as user \"%s\" on host \"%s\" at port \"%s\".\n"), |
| 315 | + db, PQuser(pset.db), host, PQport(pset.db)); |
319 | 316 | } |
320 | 317 | } |
321 | 318 |
|
@@ -1372,26 +1369,24 @@ do_connect(char *dbname, char *user, char *host, char *port) |
1372 | 1369 | /* Tell the user about the new connection */ |
1373 | 1370 | if (!pset.quiet) |
1374 | 1371 | { |
1375 | | - printf(_("You are now connected to database \"%s\""), PQdb(pset.db)); |
1376 | | - |
1377 | | - if (param_is_newly_set(PQhost(o_conn), PQhost(pset.db))) |
| 1372 | + if (param_is_newly_set(PQhost(o_conn), PQhost(pset.db)) || |
| 1373 | + param_is_newly_set(PQport(o_conn), PQport(pset.db))) |
1378 | 1374 | { |
1379 | 1375 | char *host = PQhost(pset.db); |
1380 | 1376 |
|
1381 | | - /* If the host is an absolute path, the connection is via local socket */ |
| 1377 | + if (host == NULL) |
| 1378 | + host = DEFAULT_PGSOCKET_DIR; |
| 1379 | + /* If the host is an absolute path, the connection is via socket */ |
1382 | 1380 | if (is_absolute_path(host)) |
1383 | | - printf(_(" via local socket in \"%s\""), host); |
| 1381 | + printf(_("You are now connected to database \"%s\" as user \"%s\" via socket in \"%s\" at port \"%s\".\n"), |
| 1382 | + PQdb(pset.db), PQuser(pset.db), host, PQport(pset.db)); |
1384 | 1383 | else |
1385 | | - printf(_(" on host \"%s\""), host); |
| 1384 | + printf(_("You are now connected to database \"%s\" as user \"%s\" on host \"%s\" at port \"%s\".\n"), |
| 1385 | + PQdb(pset.db), PQuser(pset.db), host, PQport(pset.db)); |
1386 | 1386 | } |
1387 | | - |
1388 | | - if (param_is_newly_set(PQport(o_conn), PQport(pset.db))) |
1389 | | - printf(_(" at port \"%s\""), PQport(pset.db)); |
1390 | | - |
1391 | | - if (param_is_newly_set(PQuser(o_conn), PQuser(pset.db))) |
1392 | | - printf(_(" as user \"%s\""), PQuser(pset.db)); |
1393 | | - |
1394 | | - printf(".\n"); |
| 1387 | + else |
| 1388 | + printf(_("You are now connected to database \"%s\" as user \"%s\".\n"), |
| 1389 | + PQdb(pset.db), PQuser(pset.db)); |
1395 | 1390 | } |
1396 | 1391 |
|
1397 | 1392 | if (o_conn) |
|
0 commit comments