NAME

kjb_query - Prompt the user for terminal input and returns the result.

SYNOPSIS

#include "l/l_io.h"

Example compile flags (system dependent):
  -DLINUX_X86_64 -DLINUX_X86_64_OPTERON  -DGNU_COMPILER 
   -I/home/kobus/include
   -L/home/kobus/misc/load/linux_x86_64_opteron -L/usr/lib/x86_64-linux-gnu
  -lKJB                               -lfftw3  -lgsl -lgslcblas -ljpeg  -lSVM -lstdc++                    -lpthread -lSLATEC -lg2c    -lacml -lacml_mv -lblas -lg2c      -lncursesw 


long kjb_query
(
	const char *prompt,
	char *input,
	size_t input_size
);

PARAMETERS

const char *prompt
Prompt for the query
char *input
A buffer for the reply.
size_t input_size
Max number of characters to read including NULL

DESCRIPTION

Writes the character string "prompt" on the terminal, and reads up to input_size minus 1 characters from the terminal into "input". A NULL is added to the end of input. The routine returns when a carriage return is entered, or as soon as input_size minus 1 characters are read. The routine also returns when the end-of-file character (often CTL-D) is entered. If input_size is 2, then the routine returns as soon as the user depresses a key. If input_size is less then 2, then the return is immediate.

RETURNS

On error, kjb_query returns ERROR. Possible problems include failure to obtain a terminal device. On success, the number of characters read is returned. See also; term_get_line, term_getc, enhanced_term_getc, yes_no_query

NOTE

This routine reads from the terminal, regardless of whether or not stdin is a terminal.

NOTE

It is programming error to make input_size greater than INT_MAX.

WARNING

Some keys generated escape sequences which are more than one character. Since this routine will only read up the input_size minus 1 character, such characters can be missed. Thus this routine is not a good choice for general purpose "cbreak" input.

DISCLAIMER

This software is not adequatedly tested. It is recomended that results are checked independantly where appropriate.

AUTHOR

Kobus Barnard

DOCUMENTER

Kobus Barnard

SEE ALSO

set_program_prompt , print_blanks , rep_print , count_real_lines , count_data_lines_until_next_header , count_tokens_in_file , get_real_line , string_count_real_lines , string_get_real_line , get_command_text , add_line_to_input_stream , read_int_from_file , read_dbl_from_file , push_no_overwrite , pop_no_overwrite , set_no_overwrite , get_no_overwrite