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

Commit25ee7f5

Browse files
author
Sergey Petrov
committed
pg_puts added
1 parentb7e2050 commit25ee7f5

File tree

4 files changed

+33
-5
lines changed

4 files changed

+33
-5
lines changed

‎src/common/exec.c

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,13 +441,13 @@ pipe_read_line(char *cmd, char *line, int maxsize)
441441
/* Let's see if we can read */
442442
if (WaitForSingleObject(childstdoutrddup,10000)!=WAIT_OBJECT_0)
443443
break;/* Timeout, but perhaps we got a line already */
444-
444+
445445
if (!ReadFile(childstdoutrddup,lineptr,maxsize- (lineptr-line),
446-
&bytesread,NULL))
446+
&bytesread,NULL))
447447
break;/* Error, but perhaps we got a line already */
448-
448+
449449
lineptr+=strlen(lineptr);
450-
450+
451451
if (!bytesread)
452452
break;/* EOF */
453453

@@ -578,6 +578,11 @@ set_pglocale_pgservice(const char *argv0, const char *app)
578578
bindtextdomain(app,path);
579579
textdomain(app);
580580

581+
#if defined(HAVE_WIN32_LIBEDIT)&& defined(ENABLE_NLS)
582+
bind_textdomain_codeset(app,"UTF-8");
583+
bind_textdomain_codeset(PG_TEXTDOMAIN("libpq"),"UTF-8");
584+
#endif
585+
581586
if (getenv("PGLOCALEDIR")==NULL)
582587
{
583588
/* set for libpq to use */

‎src/include/port.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,7 @@ extern intpg_printf(const char *fmt,...) pg_attribute_printf(1, 2);
164164

165165
#ifdefHAVE_WIN32_LIBEDIT
166166
externintpg_fputs(constchar*s,FILE*stream);
167+
externintpg_puts(constchar*s);
167168
#endif
168169
/*
169170
*The GCC-specific code below prevents the pg_attribute_printf above from
@@ -188,6 +189,7 @@ extern int pg_fputs(const char *s, FILE *stream);
188189
#ifdefHAVE_WIN32_LIBEDIT
189190
/* Catch fputs as well so we can use WriteConsole for table output */
190191
#definefputs(s,f)pg_fputs(s,f)
192+
#defineputs(s)pg_puts(s)
191193
#endif
192194
#endif/* USE_REPL_SNPRINTF */
193195

‎src/port/snprintf.c

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/*
1+
/*
22
* Copyright (c) 1983, 1995, 1996 Eric P. Allman
33
* Copyright (c) 1988, 1993
44
*The Regents of the University of California. All rights reserved.
@@ -292,6 +292,7 @@ flushbuffer(PrintfTarget *target)
292292
#endif
293293
}
294294
target->bufptr=target->bufstart;
295+
fflush(target->stream);
295296
}
296297

297298

@@ -1182,4 +1183,22 @@ int pg_fputs(const char *s, FILE *stream)
11821183
flushbuffer(&target);
11831184
returntarget.failed ?-1 :target.nchars;
11841185
}
1186+
1187+
/* replacement to puts function which uses flushBuffer */
1188+
intpg_puts(constchar*tmps)
1189+
{
1190+
char*s=NULL;
1191+
1192+
s= (char*)malloc(strlen(tmps)+1);
1193+
sprintf(s,"%s\n",tmps);
1194+
PrintfTargettarget;
1195+
target.bufstart=s;
1196+
target.nchars=0;
1197+
target.bufptr=s+strlen(s);
1198+
target.bufend=NULL;
1199+
target.failed= false;
1200+
target.stream=stdout;
1201+
flushbuffer(&target);
1202+
returntarget.failed ?-1 :target.nchars;
1203+
}
11851204
#endif

‎src/tools/msvc/Solution.pm

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,8 @@ s{PG_VERSION_STR "[^"]+"}{__STRINGIFY(x) #x\n#define __STRINGIFY2(z) __STRINGIFY
168168
print O"#define PG_MAJORVERSION\"$self->{majorver}\"\n";
169169
print O"#define LOCALEDIR\"/share/locale\"\n"
170170
if ($self->{options}->{nls});
171+
print O"#define LC_MESSAGES 6\n"
172+
if ($self->{options}->{nls});
171173
print O"/* defines added by config steps */\n";
172174
print O"#ifndef IGNORE_CONFIGURED_SETTINGS\n";
173175
print O"#define USE_ASSERT_CHECKING 1\n"

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp