Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit326e215

Browse files
committed
Hi Peter,
I try change prompt in the psql, but it is set '.' (as '%m') fornon-TCP/IPconnection. This small patch try use uname() information for non-TCP/IPinstead '.'. Karel
1 parenteae5184 commit326e215

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

‎src/bin/psql/prompt.c

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright 2000 by PostgreSQL Global Development Group
55
*
6-
* $Header: /cvsroot/pgsql/src/bin/psql/prompt.c,v 1.9 2000/02/16 13:15:26 momjian Exp $
6+
* $Header: /cvsroot/pgsql/src/bin/psql/prompt.c,v 1.10 2000/03/08 01:38:59 momjian Exp $
77
*/
88
#include"postgres.h"
99
#include"prompt.h"
@@ -19,7 +19,7 @@
1919
#include<win32.h>
2020
#endif
2121

22-
22+
#include<sys/utsname.h>
2323

2424
/*--------------------------
2525
* get_prompt
@@ -121,8 +121,17 @@ get_prompt(promptStatus_t status)
121121
if (*p=='m')
122122
buf[strcspn(buf,".")]='\0';
123123
}
124-
else
124+
elseif (*p=='M')
125125
buf[0]='.';
126+
else
127+
{
128+
structutsnameubuf;
129+
130+
if (uname(&ubuf)<0)
131+
buf[0]='.';
132+
else
133+
strncpy(buf,ubuf.nodename,MAX_PROMPT_SIZE);
134+
}
126135
}
127136
break;
128137
/* DB server port number */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp