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

Commitc5672bc

Browse files
committed
Fixed output without pager
1 parent4290269 commitc5672bc

File tree

3 files changed

+23
-3
lines changed

3 files changed

+23
-3
lines changed

‎src/bin/psql/command.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1886,6 +1886,11 @@ printSSLInfo(void)
18861886
staticvoid
18871887
checkWin32Codepage(void)
18881888
{
1889+
#ifdefHAVE_WIN32_LIBEDIT
1890+
if (isatty(fileno(stdout)))
1891+
printf(_("WARNING: Unicode mode enabled. "
1892+
"You need TTF font in your console window\n"));
1893+
#else
18891894
unsignedintwincp,
18901895
concp;
18911896

@@ -1898,6 +1903,7 @@ checkWin32Codepage(void)
18981903
" page \"Notes for Windows users\" for details.\n"),
18991904
concp,wincp);
19001905
}
1906+
#endif
19011907
}
19021908
#endif
19031909

‎src/bin/psql/print.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -316,8 +316,19 @@ format_numeric_locale(const char *my_str)
316316
staticvoid
317317
fputnbytes(FILE*f,constchar*str,size_tn)
318318
{
319+
320+
#ifdefHAVE_WIN32_LIBEDIT
321+
charbuffer[1024];
322+
char*buf=buffer;
323+
if (n>1023)buf=malloc(n+1);
324+
strncpy(buf,str,n);
325+
buf[n]=0;
326+
fputs(buf,f);
327+
if (n>1023)free(buf);
328+
#else
319329
while (n-->0)
320330
fputc(*str++,f);
331+
#endif
321332
}
322333

323334

‎src/port/snprintf.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ flushbuffer(PrintfTarget *target)
271271
{
272272
/* Convert message from buffer (expected as utf8)
273273
to widechar */
274-
HANDLEconsoleHandle=_get_osf_handle(_fileno(target->stream));
274+
HANDLEconsoleHandle=_get_osfhandle(_fileno(target->stream));
275275
DWORDactuallyWritten;
276276
wchar_t*widebuf= (wchar_t*)malloc(nc*sizeof(wchar_t));
277277
written=MultiByteToWideChar(CP_UTF8,0,target->bufstart,nc,widebuf,nc);
@@ -280,6 +280,7 @@ flushbuffer(PrintfTarget *target)
280280
target->nchars+=nc;
281281
else
282282
target->failed= true;
283+
free(widebuf);
283284
}else {
284285
#endif
285286
written = fwrite(target->bufstart, 1, nc, target->stream);
@@ -1172,10 +1173,12 @@ int pg_fputs(const char *s, FILE *stream)
11721173
errno=EINVAL;
11731174
return-1;
11741175
}
1175-
target.bufstart=target.bufptr=s;
1176-
target.nchars=strlen(s);
1176+
target.bufstart=s;
1177+
target.nchars=0;
1178+
target.bufptr=s+strlen(s);
11771179
target.bufend=NULL;
11781180
target.failed=false;
1181+
target.stream=stream;
11791182
flushbuffer(&target);
11801183
returntarget.failed ?-1 :target.nchars;
11811184
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp