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

Commit24a4aff

Browse files
committed
No need for screen_size to be static.
1 parent8c3d771 commit24a4aff

File tree

1 file changed

+20
-18
lines changed

1 file changed

+20
-18
lines changed

‎src/interfaces/libpq/fe-print.c

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,13 @@
1010
* didn't really belong there.
1111
*
1212
* IDENTIFICATION
13-
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.38 2000/05/29 21:25:04 momjian Exp $
13+
* $Header: /cvsroot/pgsql/src/interfaces/libpq/fe-print.c,v 1.39 2001/01/06 17:43:01 tgl Exp $
1414
*
1515
*-------------------------------------------------------------------------
1616
*/
1717
#include"postgres.h"
1818

1919
#include<signal.h>
20-
#include"libpq-fe.h"
21-
#include"libpq-int.h"
22-
#include"pqsignal.h"
2320

2421
#ifdefWIN32
2522
#include"win32.h"
@@ -36,17 +33,9 @@
3633
#endif
3734
#endif
3835

39-
#ifdefTIOCGWINSZ
40-
staticstructwinsizescreen_size;
41-
42-
#else
43-
staticstructwinsize
44-
{
45-
intws_row;
46-
intws_col;
47-
}screen_size;
48-
49-
#endif
36+
#include"libpq-fe.h"
37+
#include"libpq-int.h"
38+
#include"pqsignal.h"
5039

5140

5241
staticvoiddo_field(constPQprintOpt*po,constPGresult*res,
@@ -103,6 +92,15 @@ PQprint(FILE *fout,
10392
intusePipe=0;
10493
pqsigfuncoldsigpipehandler=NULL;
10594
char*pagerenv;
95+
#ifdefTIOCGWINSZ
96+
structwinsizescreen_size;
97+
#else
98+
structwinsize
99+
{
100+
intws_row;
101+
intws_col;
102+
}screen_size;
103+
#endif
106104

107105
nTups=PQntuples(res);
108106
if (!(fieldNames= (constchar**)calloc(nFields,sizeof(char*))))
@@ -151,17 +149,21 @@ PQprint(FILE *fout,
151149
#endif
152150
)
153151
{
154-
/* try to pipe to the pager program if possible */
152+
/*
153+
* If we think there'll be more than one screen of output,
154+
* try to pipe to the pager program.
155+
*/
155156
#ifdefTIOCGWINSZ
156157
if (ioctl(fileno(stdout),TIOCGWINSZ,&screen_size)==-1||
157158
screen_size.ws_col==0||
158159
screen_size.ws_row==0)
159160
{
160-
#endif
161161
screen_size.ws_row=24;
162162
screen_size.ws_col=80;
163-
#ifdefTIOCGWINSZ
164163
}
164+
#else
165+
screen_size.ws_row=24;
166+
screen_size.ws_col=80;
165167
#endif
166168
pagerenv=getenv("PAGER");
167169
if (pagerenv!=NULL&&

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp