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
360162b1
Commit
360162b1
authored
Aug 08, 2003
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove, no in /port.
parent
b1504b60
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
0 additions
and
126 deletions
+0
-126
src/bin/pg_dump/sprompt.c
src/bin/pg_dump/sprompt.c
+0
-126
No files found.
src/bin/pg_dump/sprompt.c
deleted
100644 → 0
View file @
b1504b60
/*
* psql - the PostgreSQL interactive terminal
*
* Copyright (c) 2000-2003, PostgreSQL Global Development Group
*
* $Header: /cvsroot/pgsql/src/bin/pg_dump/Attic/sprompt.c,v 1.5 2003/08/04 23:59:39 tgl Exp $
*/
/*
* simple_prompt
*
* Generalized function especially intended for reading in usernames and
* password interactively. Reads from /dev/tty or stdin/stderr.
*
* prompt: The prompt to print
* maxlen: How many characters to accept
* echo: Set to false if you want to hide what is entered (for passwords)
*
* Returns a malloc()'ed string with the input (w/o trailing newline).
*/
/* This file is shared by psql and pg_dump. */
#include "postgres_fe.h"
#ifdef HAVE_TERMIOS_H
#include <termios.h>
#endif
bool
prompt_state
=
false
;
extern
char
*
simple_prompt
(
const
char
*
prompt
,
int
maxlen
,
bool
echo
);
char
*
simple_prompt
(
const
char
*
prompt
,
int
maxlen
,
bool
echo
)
{
int
length
;
char
*
destination
;
FILE
*
termin
,
*
termout
;
#ifdef HAVE_TERMIOS_H
struct
termios
t_orig
,
t
;
#endif
destination
=
(
char
*
)
malloc
(
maxlen
+
1
);
if
(
!
destination
)
return
NULL
;
prompt_state
=
true
;
/* disable SIGINT */
/*
* Do not try to collapse these into one "w+" mode file. Doesn't work
* on some platforms (eg, HPUX 10.20).
*/
termin
=
fopen
(
"/dev/tty"
,
"r"
);
termout
=
fopen
(
"/dev/tty"
,
"w"
);
if
(
!
termin
||
!
termout
)
{
if
(
termin
)
fclose
(
termin
);
if
(
termout
)
fclose
(
termout
);
termin
=
stdin
;
termout
=
stderr
;
}
#ifdef HAVE_TERMIOS_H
if
(
!
echo
)
{
tcgetattr
(
fileno
(
termin
),
&
t
);
t_orig
=
t
;
t
.
c_lflag
&=
~
ECHO
;
tcsetattr
(
fileno
(
termin
),
TCSAFLUSH
,
&
t
);
}
#endif
if
(
prompt
)
{
fputs
(
gettext
(
prompt
),
termout
);
fflush
(
termout
);
}
if
(
fgets
(
destination
,
maxlen
+
1
,
termin
)
==
NULL
)
destination
[
0
]
=
'\0'
;
length
=
strlen
(
destination
);
if
(
length
>
0
&&
destination
[
length
-
1
]
!=
'\n'
)
{
/* eat rest of the line */
char
buf
[
128
];
int
buflen
;
do
{
if
(
fgets
(
buf
,
sizeof
(
buf
),
termin
)
==
NULL
)
break
;
buflen
=
strlen
(
buf
);
}
while
(
buflen
>
0
&&
buf
[
buflen
-
1
]
!=
'\n'
);
}
if
(
length
>
0
&&
destination
[
length
-
1
]
==
'\n'
)
/* remove trailing newline */
destination
[
length
-
1
]
=
'\0'
;
#ifdef HAVE_TERMIOS_H
if
(
!
echo
)
{
tcsetattr
(
fileno
(
termin
),
TCSAFLUSH
,
&
t_orig
);
fputs
(
"
\n
"
,
termout
);
fflush
(
termout
);
}
#endif
if
(
termin
!=
stdin
)
{
fclose
(
termin
);
fclose
(
termout
);
}
prompt_state
=
false
;
/* SIGINT okay again */
return
destination
;
}
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