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

Commit3b2440e

Browse files
committed
Remove simple_prompt from /contrib C files, now that it is in /port.
They had the old versions anyway.
1 parent635d00e commit3b2440e

File tree

2 files changed

+1
-219
lines changed

2 files changed

+1
-219
lines changed

‎contrib/dbase/dbf2pg.c

Lines changed: 0 additions & 109 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,6 @@ char *convert_charset(char *string);
6565
voidusage(void);
6666
unsignedintisinteger(char*);
6767

68-
char*simple_prompt(constchar*prompt,intmaxlen,boolecho);
6968

7069

7170
unsignedint
@@ -565,114 +564,6 @@ do_inserts(PGconn *conn, char *table, dbhead * dbh)
565564
}
566565

567566

568-
/*
569-
* simple_prompt --- borrowed from psql
570-
*
571-
* Generalized function especially intended for reading in usernames and
572-
* password interactively. Reads from /dev/tty or stdin/stderr.
573-
*
574-
* prompt:The prompt to print
575-
* maxlen:How many characters to accept
576-
* echo:Set to false if you want to hide what is entered (for passwords)
577-
*
578-
* Returns a malloc()'ed string with the input (w/o trailing newline).
579-
*/
580-
staticboolprompt_state= false;
581-
582-
char*
583-
simple_prompt(constchar*prompt,intmaxlen,boolecho)
584-
{
585-
intlength;
586-
char*destination;
587-
FILE*termin,
588-
*termout;
589-
590-
#ifdefHAVE_TERMIOS_H
591-
structtermiost_orig,
592-
t;
593-
#endif
594-
595-
destination= (char*)malloc(maxlen+2);
596-
if (!destination)
597-
returnNULL;
598-
599-
prompt_state= true;/* disable SIGINT */
600-
601-
/*
602-
* Do not try to collapse these into one "w+" mode file. Doesn't work
603-
* on some platforms (eg, HPUX 10.20).
604-
*/
605-
termin=fopen("/dev/tty","r");
606-
termout=fopen("/dev/tty","w");
607-
if (!termin|| !termout)
608-
{
609-
if (termin)
610-
fclose(termin);
611-
if (termout)
612-
fclose(termout);
613-
termin=stdin;
614-
termout=stderr;
615-
}
616-
617-
#ifdefHAVE_TERMIOS_H
618-
if (!echo)
619-
{
620-
tcgetattr(fileno(termin),&t);
621-
t_orig=t;
622-
t.c_lflag &= ~ECHO;
623-
tcsetattr(fileno(termin),TCSAFLUSH,&t);
624-
}
625-
#endif
626-
627-
if (prompt)
628-
{
629-
fputs(gettext(prompt),termout);
630-
fflush(termout);
631-
}
632-
633-
if (fgets(destination,maxlen,termin)==NULL)
634-
destination[0]='\0';
635-
636-
length=strlen(destination);
637-
if (length>0&&destination[length-1]!='\n')
638-
{
639-
/* eat rest of the line */
640-
charbuf[128];
641-
intbuflen;
642-
643-
do
644-
{
645-
if (fgets(buf,sizeof(buf),termin)==NULL)
646-
break;
647-
buflen=strlen(buf);
648-
}while (buflen>0&&buf[buflen-1]!='\n');
649-
}
650-
651-
if (length>0&&destination[length-1]=='\n')
652-
/* remove trailing newline */
653-
destination[length-1]='\0';
654-
655-
#ifdefHAVE_TERMIOS_H
656-
if (!echo)
657-
{
658-
tcsetattr(fileno(termin),TCSAFLUSH,&t_orig);
659-
fputs("\n",termout);
660-
fflush(termout);
661-
}
662-
#endif
663-
664-
if (termin!=stdin)
665-
{
666-
fclose(termin);
667-
fclose(termout);
668-
}
669-
670-
prompt_state= false;/* SIGINT okay again */
671-
672-
returndestination;
673-
}
674-
675-
676567
int
677568
main(intargc,char**argv)
678569
{

‎contrib/vacuumlo/vacuumlo.c

Lines changed: 1 addition & 110 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $Header: /cvsroot/pgsql/contrib/vacuumlo/vacuumlo.c,v 1.22 2003/08/04 22:03:39 tgl Exp $
11+
* $Header: /cvsroot/pgsql/contrib/vacuumlo/vacuumlo.c,v 1.23 2003/08/08 20:20:49 momjian Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -44,118 +44,9 @@ struct _param
4444
};
4545

4646
intvacuumlo(char*,struct_param*);
47-
char*simple_prompt(constchar*prompt,int,int);
4847
voidusage(void);
4948

5049

51-
/*
52-
* simple_prompt
53-
*
54-
* Generalized function especially intended for reading in usernames and
55-
* password interactively. Reads from /dev/tty or stdin/stderr.
56-
*
57-
* prompt:The prompt to print
58-
* maxlen:How many characters to accept
59-
* echo:Set to 0 if you want to hide what is entered (for passwords)
60-
*
61-
* Returns a malloc()'ed string with the input (w/o trailing newline).
62-
*/
63-
staticintprompt_state=0;
64-
65-
char*
66-
simple_prompt(constchar*prompt,intmaxlen,intecho)
67-
{
68-
intlength;
69-
char*destination;
70-
FILE*termin,
71-
*termout;
72-
73-
#ifdefHAVE_TERMIOS_H
74-
structtermiost_orig,
75-
t;
76-
#endif
77-
78-
destination= (char*)malloc(maxlen+2);
79-
if (!destination)
80-
returnNULL;
81-
82-
prompt_state=1;/* disable SIGINT */
83-
84-
/*
85-
* Do not try to collapse these into one "w+" mode file. Doesn't work
86-
* on some platforms (eg, HPUX 10.20).
87-
*/
88-
termin=fopen("/dev/tty","r");
89-
termout=fopen("/dev/tty","w");
90-
if (!termin|| !termout)
91-
{
92-
if (termin)
93-
fclose(termin);
94-
if (termout)
95-
fclose(termout);
96-
termin=stdin;
97-
termout=stderr;
98-
}
99-
100-
#ifdefHAVE_TERMIOS_H
101-
if (!echo)
102-
{
103-
tcgetattr(fileno(termin),&t);
104-
t_orig=t;
105-
t.c_lflag &= ~ECHO;
106-
tcsetattr(fileno(termin),TCSAFLUSH,&t);
107-
}
108-
#endif
109-
110-
if (prompt)
111-
{
112-
fputs(prompt,termout);
113-
fflush(termout);
114-
}
115-
116-
if (fgets(destination,maxlen,termin)==NULL)
117-
destination[0]='\0';
118-
119-
length=strlen(destination);
120-
if (length>0&&destination[length-1]!='\n')
121-
{
122-
/* eat rest of the line */
123-
charbuf[128];
124-
intbuflen;
125-
126-
do
127-
{
128-
if (fgets(buf,sizeof(buf),termin)==NULL)
129-
break;
130-
buflen=strlen(buf);
131-
}while (buflen>0&&buf[buflen-1]!='\n');
132-
}
133-
134-
if (length>0&&destination[length-1]=='\n')
135-
/* remove trailing newline */
136-
destination[length-1]='\0';
137-
138-
#ifdefHAVE_TERMIOS_H
139-
if (!echo)
140-
{
141-
tcsetattr(fileno(termin),TCSAFLUSH,&t_orig);
142-
fputs("\n",termout);
143-
fflush(termout);
144-
}
145-
#endif
146-
147-
if (termin!=stdin)
148-
{
149-
fclose(termin);
150-
fclose(termout);
151-
}
152-
153-
prompt_state=0;/* SIGINT okay again */
154-
155-
returndestination;
156-
}
157-
158-
15950

16051
/*
16152
* This vacuums LOs of one database. It returns 0 on success, -1 on failure.

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp