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

Commit712f053

Browse files
committed
Add sprintf support, that were were missing.
Add support for snprintf '+', 'h', and %* length settings.
1 parentca66797 commit712f053

File tree

3 files changed

+118
-49
lines changed

3 files changed

+118
-49
lines changed

‎src/bin/psql/command.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*
44
* Copyright (c) 2000-2005, PostgreSQL Global Development Group
55
*
6-
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.141 2005/03/11 17:20:34 momjian Exp $
6+
* $PostgreSQL: pgsql/src/bin/psql/command.c,v 1.142 2005/03/16 21:27:23 momjian Exp $
77
*/
88
#include"postgres_fe.h"
99
#include"command.h"
@@ -1574,11 +1574,13 @@ do_shell(const char *command)
15741574
shellName=DEFAULT_SHELL;
15751575

15761576
sys=pg_malloc(strlen(shellName)+16);
1577+
#ifndefWIN32
15771578
sprintf(sys,
15781579
/* See EDITOR handling comment for an explaination */
1579-
#ifndefWIN32
15801580
"exec %s",shellName);
15811581
#else
1582+
sprintf(sys,
1583+
/* See EDITOR handling comment for an explaination */
15821584
"%s\"%s\"%s",SYSTEMQUOTE,shellName,SYSTEMQUOTE);
15831585
#endif
15841586
result=system(sys);

‎src/include/port.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
9-
* $PostgreSQL: pgsql/src/include/port.h,v 1.72 2005/03/11 19:13:42 momjian Exp $
9+
* $PostgreSQL: pgsql/src/include/port.h,v 1.73 2005/03/16 21:27:23 momjian Exp $
1010
*
1111
*-------------------------------------------------------------------------
1212
*/
@@ -112,6 +112,9 @@ extern int pg_vsnprintf(char *str, size_t count, const char *fmt, va_list args);
112112
externintpg_snprintf(char*str,size_tcount,constchar*fmt,...)
113113
/* This extension allows gcc to check the format string */
114114
__attribute__((format(printf,3,4)));
115+
externintpg_sprintf(char*str,constchar*fmt,...)
116+
/* This extension allows gcc to check the format string */
117+
__attribute__((format(printf,2,3)));
115118
externintpg_fprintf(FILE*stream,constchar*fmt,...)
116119
/* This extension allows gcc to check the format string */
117120
__attribute__((format(printf,2,3)));
@@ -127,11 +130,13 @@ __attribute__((format(printf, 1, 2)));
127130
#ifdef__GNUC__
128131
#definevsnprintf(...)pg_vsnprintf(__VA_ARGS__)
129132
#definesnprintf(...)pg_snprintf(__VA_ARGS__)
133+
#definesprintf(...)pg_sprintf(__VA_ARGS__)
130134
#definefprintf(...)pg_fprintf(__VA_ARGS__)
131135
#defineprintf(...)pg_printf(__VA_ARGS__)
132136
#else
133137
#definevsnprintfpg_vsnprintf
134138
#definesnprintfpg_snprintf
139+
#definesprintfpg_sprintf
135140
#definefprintfpg_fprintf
136141
#defineprintfpg_printf
137142
#endif

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp