Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Postgres FD Implementation
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Abuhujair Javed
Postgres FD Implementation
Commits
4b965f57
Commit
4b965f57
authored
Aug 01, 1997
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix stout/stderr paging. Do not page \h select, but page \h *.
parent
da767117
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
15 deletions
+17
-15
src/bin/psql/psql.c
src/bin/psql/psql.c
+17
-15
No files found.
src/bin/psql/psql.c
View file @
4b965f57
...
@@ -7,7 +7,7 @@
...
@@ -7,7 +7,7 @@
*
*
*
*
* IDENTIFICATION
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.
79 1997/08/01 03:33:02
momjian Exp $
* $Header: /cvsroot/pgsql/src/bin/psql/Attic/psql.c,v 1.
80 1997/08/01 04:07:55
momjian Exp $
*
*
*-------------------------------------------------------------------------
*-------------------------------------------------------------------------
*/
*/
...
@@ -123,7 +123,7 @@ usage(char *progname)
...
@@ -123,7 +123,7 @@ usage(char *progname)
fprintf
(
stderr
,
"
\t
-d dbName specify database name
\n
"
);
fprintf
(
stderr
,
"
\t
-d dbName specify database name
\n
"
);
fprintf
(
stderr
,
"
\t
-e echo the query sent to the backend
\n
"
);
fprintf
(
stderr
,
"
\t
-e echo the query sent to the backend
\n
"
);
fprintf
(
stderr
,
"
\t
-f filename use file as a source of queries
\n
"
);
fprintf
(
stderr
,
"
\t
-f filename use file as a source of queries
\n
"
);
fprintf
(
stderr
,
"
\t
-F sep set the field separator (default is
"
|
"
)
\n
"
);
fprintf
(
stderr
,
"
\t
-F sep set the field separator (default is
'|'
)
\n
"
);
fprintf
(
stderr
,
"
\t
-h host set database server host
\n
"
);
fprintf
(
stderr
,
"
\t
-h host set database server host
\n
"
);
fprintf
(
stderr
,
"
\t
-H turn on html3.0 table output
\n
"
);
fprintf
(
stderr
,
"
\t
-H turn on html3.0 table output
\n
"
);
fprintf
(
stderr
,
"
\t
-l list available databases
\n
"
);
fprintf
(
stderr
,
"
\t
-l list available databases
\n
"
);
...
@@ -164,7 +164,7 @@ slashUsage(PsqlSettings * ps)
...
@@ -164,7 +164,7 @@ slashUsage(PsqlSettings * ps)
pqsignal
(
SIGPIPE
,
SIG_IGN
);
pqsignal
(
SIGPIPE
,
SIG_IGN
);
}
}
else
else
fout
=
std
err
;
fout
=
std
out
;
fprintf
(
fout
,
"
\\
? -- help
\n
"
);
fprintf
(
fout
,
"
\\
? -- help
\n
"
);
fprintf
(
fout
,
"
\\
a -- toggle field-alignment (currenty %s)
\n
"
,
on
(
ps
->
opt
.
align
));
fprintf
(
fout
,
"
\\
a -- toggle field-alignment (currenty %s)
\n
"
,
on
(
ps
->
opt
.
align
));
...
@@ -621,7 +621,7 @@ SendQuery(bool * success_p, PsqlSettings * settings, const char *query,
...
@@ -621,7 +621,7 @@ SendQuery(bool * success_p, PsqlSettings * settings, const char *query,
case
PGRES_COMMAND_OK
:
case
PGRES_COMMAND_OK
:
*
success_p
=
true
;
*
success_p
=
true
;
if
(
!
settings
->
quiet
)
if
(
!
settings
->
quiet
)
fprintf
(
stdout
,
"%s
\n
"
,
PQcmdStatus
(
results
));
printf
(
"%s
\n
"
,
PQcmdStatus
(
results
));
break
;
break
;
case
PGRES_COPY_OUT
:
case
PGRES_COPY_OUT
:
*
success_p
=
true
;
*
success_p
=
true
;
...
@@ -629,7 +629,7 @@ SendQuery(bool * success_p, PsqlSettings * settings, const char *query,
...
@@ -629,7 +629,7 @@ SendQuery(bool * success_p, PsqlSettings * settings, const char *query,
handleCopyOut
(
results
,
settings
->
quiet
,
copystream
);
handleCopyOut
(
results
,
settings
->
quiet
,
copystream
);
}
else
{
}
else
{
if
(
!
settings
->
quiet
)
if
(
!
settings
->
quiet
)
fprintf
(
stdout
,
"Copy command returns...
\n
"
);
printf
(
"Copy command returns...
\n
"
);
handleCopyOut
(
results
,
settings
->
quiet
,
stdout
);
handleCopyOut
(
results
,
settings
->
quiet
,
stdout
);
}
}
...
@@ -693,7 +693,7 @@ toggle(PsqlSettings * settings, bool * sw, char *msg)
...
@@ -693,7 +693,7 @@ toggle(PsqlSettings * settings, bool * sw, char *msg)
{
{
*
sw
=
!*
sw
;
*
sw
=
!*
sw
;
if
(
!
settings
->
quiet
)
if
(
!
settings
->
quiet
)
fprintf
(
stderr
,
"turned %s %s
\n
"
,
on
(
*
sw
),
msg
);
printf
(
"turned %s %s
\n
"
,
on
(
*
sw
),
msg
);
return
*
sw
;
return
*
sw
;
}
}
...
@@ -869,9 +869,9 @@ do_copy(const char *args, PsqlSettings * settings)
...
@@ -869,9 +869,9 @@ do_copy(const char *args, PsqlSettings * settings)
fclose
(
copystream
);
fclose
(
copystream
);
if
(
!
settings
->
quiet
)
{
if
(
!
settings
->
quiet
)
{
if
(
success
)
if
(
success
)
fprintf
(
stdout
,
"Successfully copied.
\n
"
);
printf
(
"Successfully copied.
\n
"
);
else
else
fprintf
(
stdout
,
"Copy failed.
\n
"
);
printf
(
"Copy failed.
\n
"
);
}
}
}
}
}
}
...
@@ -1046,14 +1046,16 @@ do_help(const char *topic)
...
@@ -1046,14 +1046,16 @@ do_help(const char *topic)
char
*
pagerenv
;
char
*
pagerenv
;
FILE
*
fout
;
FILE
*
fout
;
if
((
pagerenv
=
getenv
(
"PAGER"
))
&&
(
pagerenv
[
0
]
!=
'\0'
)
&&
\
if
(
strcmp
(
topic
,
"*"
)
==
0
&&
(
pagerenv
=
getenv
(
"PAGER"
))
&&
(
pagerenv
[
0
]
!=
'\0'
)
&&
(
fout
=
popen
(
pagerenv
,
"w"
)))
(
fout
=
popen
(
pagerenv
,
"w"
)))
{
{
usePipe
=
1
;
usePipe
=
1
;
pqsignal
(
SIGPIPE
,
SIG_IGN
);
pqsignal
(
SIGPIPE
,
SIG_IGN
);
}
}
else
else
fout
=
std
err
;
fout
=
std
out
;
help_found
=
false
;
/* Haven't found it yet */
help_found
=
false
;
/* Haven't found it yet */
for
(
i
=
0
;
QL_HELP
[
i
].
cmd
;
i
++
)
{
for
(
i
=
0
;
QL_HELP
[
i
].
cmd
;
i
++
)
{
...
@@ -1075,7 +1077,7 @@ do_help(const char *topic)
...
@@ -1075,7 +1077,7 @@ do_help(const char *topic)
}
}
if
(
!
help_found
)
if
(
!
help_found
)
printf
(
"command not found, "
fprintf
(
stderr
,
"command not found, "
"try
\\
h with no arguments to see available help
\n
"
);
"try
\\
h with no arguments to see available help
\n
"
);
}
}
}
}
...
@@ -1291,7 +1293,7 @@ HandleSlashCmds(PsqlSettings * settings,
...
@@ -1291,7 +1293,7 @@ HandleSlashCmds(PsqlSettings * settings,
exit
(
1
);
exit
(
1
);
}
}
if
(
!
settings
->
quiet
)
if
(
!
settings
->
quiet
)
fprintf
(
stderr
,
"field separater changed to '%s'
\n
"
,
settings
->
opt
.
fieldSep
);
printf
(
"field separater changed to '%s'
\n
"
,
settings
->
opt
.
fieldSep
);
break
;
break
;
}
}
case
'g'
:
/* \g means send query */
case
'g'
:
/* \g means send query */
...
@@ -1346,7 +1348,7 @@ HandleSlashCmds(PsqlSettings * settings,
...
@@ -1346,7 +1348,7 @@ HandleSlashCmds(PsqlSettings * settings,
case
'r'
:
/* reset(clear) the buffer */
case
'r'
:
/* reset(clear) the buffer */
query
[
0
]
=
'\0'
;
query
[
0
]
=
'\0'
;
if
(
!
settings
->
quiet
)
if
(
!
settings
->
quiet
)
fprintf
(
stderr
,
"buffer reset(cleared)
\n
"
);
printf
(
"buffer reset(cleared)
\n
"
);
break
;
break
;
case
's'
:
/* \s is save history to a file */
case
's'
:
/* \s is save history to a file */
if
(
!
optarg
)
if
(
!
optarg
)
...
@@ -1364,13 +1366,13 @@ HandleSlashCmds(PsqlSettings * settings,
...
@@ -1364,13 +1366,13 @@ HandleSlashCmds(PsqlSettings * settings,
free
(
settings
->
opt
.
fieldSep
);
free
(
settings
->
opt
.
fieldSep
);
settings
->
opt
.
fieldSep
=
strdup
(
"|"
);
settings
->
opt
.
fieldSep
=
strdup
(
"|"
);
if
(
!
settings
->
quiet
)
if
(
!
settings
->
quiet
)
fprintf
(
stderr
,
"field separater changed to '%s'
\n
"
,
settings
->
opt
.
fieldSep
);
printf
(
"field separater changed to '%s'
\n
"
,
settings
->
opt
.
fieldSep
);
}
else
{
}
else
{
if
(
settings
->
opt
.
fieldSep
)
if
(
settings
->
opt
.
fieldSep
)
free
(
settings
->
opt
.
fieldSep
);
free
(
settings
->
opt
.
fieldSep
);
settings
->
opt
.
fieldSep
=
strdup
(
DEFAULT_FIELD_SEP
);
settings
->
opt
.
fieldSep
=
strdup
(
DEFAULT_FIELD_SEP
);
if
(
!
settings
->
quiet
)
if
(
!
settings
->
quiet
)
fprintf
(
stderr
,
"field separater changed to '%s'
\n
"
,
settings
->
opt
.
fieldSep
);
printf
(
"field separater changed to '%s'
\n
"
,
settings
->
opt
.
fieldSep
);
}
}
break
;
break
;
case
'z'
:
/* list table rights (grant/revoke) */
case
'z'
:
/* list table rights (grant/revoke) */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment