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
3b2440eb
Commit
3b2440eb
authored
Aug 08, 2003
by
Bruce Momjian
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove simple_prompt from /contrib C files, now that it is in /port.
They had the old versions anyway.
parent
635d00ec
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
1 addition
and
219 deletions
+1
-219
contrib/dbase/dbf2pg.c
contrib/dbase/dbf2pg.c
+0
-109
contrib/vacuumlo/vacuumlo.c
contrib/vacuumlo/vacuumlo.c
+1
-110
No files found.
contrib/dbase/dbf2pg.c
View file @
3b2440eb
...
...
@@ -65,7 +65,6 @@ char *convert_charset(char *string);
void
usage
(
void
);
unsigned
int
isinteger
(
char
*
);
char
*
simple_prompt
(
const
char
*
prompt
,
int
maxlen
,
bool
echo
);
unsigned
int
...
...
@@ -565,114 +564,6 @@ do_inserts(PGconn *conn, char *table, dbhead * dbh)
}
/*
* simple_prompt --- borrowed from psql
*
* 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).
*/
static
bool
prompt_state
=
false
;
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
+
2
);
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
,
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
;
}
int
main
(
int
argc
,
char
**
argv
)
{
...
...
contrib/vacuumlo/vacuumlo.c
View file @
3b2440eb
...
...
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/contrib/vacuumlo/vacuumlo.c,v 1.2
2 2003/08/04 22:03:39 tgl
Exp $
* $Header: /cvsroot/pgsql/contrib/vacuumlo/vacuumlo.c,v 1.2
3 2003/08/08 20:20:49 momjian
Exp $
*
*-------------------------------------------------------------------------
*/
...
...
@@ -44,118 +44,9 @@ struct _param
};
int
vacuumlo
(
char
*
,
struct
_param
*
);
char
*
simple_prompt
(
const
char
*
prompt
,
int
,
int
);
void
usage
(
void
);
/*
* 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 0 if you want to hide what is entered (for passwords)
*
* Returns a malloc()'ed string with the input (w/o trailing newline).
*/
static
int
prompt_state
=
0
;
char
*
simple_prompt
(
const
char
*
prompt
,
int
maxlen
,
int
echo
)
{
int
length
;
char
*
destination
;
FILE
*
termin
,
*
termout
;
#ifdef HAVE_TERMIOS_H
struct
termios
t_orig
,
t
;
#endif
destination
=
(
char
*
)
malloc
(
maxlen
+
2
);
if
(
!
destination
)
return
NULL
;
prompt_state
=
1
;
/* 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
(
prompt
,
termout
);
fflush
(
termout
);
}
if
(
fgets
(
destination
,
maxlen
,
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
=
0
;
/* SIGINT okay again */
return
destination
;
}
/*
* This vacuums LOs of one database. It returns 0 on success, -1 on failure.
...
...
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