~ubuntu-branches/ubuntu/hardy/gnupg/hardy-updates

« back to all changes in this revision

Viewing changes to util/ttyio.c

  • Committer: Bazaar Package Importer
  • Author(s): Martin Pitt
  • Date: 2005-12-16 16:57:39 UTC
  • mto: This revision was merged to the branch mainline in revision 4.
  • Revision ID: james.westby@ubuntu.com-20051216165739-v0m2d1you6hd8jho
Tags: upstream-1.4.2
ImportĀ upstreamĀ versionĀ 1.4.2

Show diffs side-by-side

added added

removed removed

Lines of Context:
16
16
 *
17
17
 * You should have received a copy of the GNU General Public License
18
18
 * along with this program; if not, write to the Free Software
19
 
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
 
19
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301,
 
20
 * USA.
20
21
 */
21
22
 
22
23
#include <config.h>
165
166
#ifdef HAVE_LIBREADLINE
166
167
    rl_catch_signals = 0;
167
168
    rl_instream = rl_outstream = ttyfp;
 
169
    rl_inhibit_completion = 1;
168
170
#endif
169
171
#endif
170
172
#ifdef HAVE_TCGETATTR
173
175
    initialized = 1;
174
176
}
175
177
 
 
178
#ifdef HAVE_LIBREADLINE
 
179
void
 
180
tty_enable_completion(rl_completion_func_t *completer)
 
181
{
 
182
  if( !initialized )
 
183
    init_ttyfp();
 
184
  rl_attempted_completion_function=completer;
 
185
  rl_inhibit_completion=0;
 
186
}
 
187
 
 
188
void
 
189
tty_disable_completion(void)
 
190
{
 
191
  if( !initialized )
 
192
    init_ttyfp();
 
193
  rl_inhibit_completion=1;
 
194
}
 
195
#endif /*HAVE_LIBREADLINE*/
 
196
 
176
197
int
177
198
tty_batchmode( int onoff )
178
199
{
376
397
        init_ttyfp();
377
398
 
378
399
    last_prompt_len = 0;
379
 
    tty_printf( "%s", prompt );
380
400
    buf = m_alloc(n=50);
381
401
    i = 0;
382
402
 
384
404
    if( hidden )
385
405
        SetConsoleMode(con.in, HID_INPMODE );
386
406
 
 
407
    tty_printf( "%s", prompt );
 
408
 
387
409
    for(;;) {
388
410
        DWORD nread;
389
411
 
415
437
        SetConsoleMode(con.in, DEF_INPMODE );
416
438
 
417
439
#elif defined(__riscos__)
 
440
    tty_printf( "%s", prompt );
418
441
    do {
419
442
        c = riscos_getchar();
420
443
        if (c == 0xa || c == 0xd) { /* Return || Enter */
469
492
#endif
470
493
    }
471
494
 
 
495
    tty_printf( "%s", prompt );
 
496
 
472
497
    /* fixme: How can we avoid that the \n is echoed w/o disabling
473
498
     * canonical mode - w/o this kill_prompt can't work */
474
499
    while( read(fileno(ttyfp), cbuf, 1) == 1 && *cbuf != '\n' ) {