# The "arln" Package

These routines are meant to provide a simple to use asynchronous line reading facility. When reading from pipes, connections and terminals, the routines continue polling for events (using the chm_poll and cm_poll routines). They are not usable in a module which also uses an alternative event management scheme (such as Xt Intrinsics or the XView notifier).

Library: karma
Link With: -lkarma

#### Functions

arln_read_float | Read a floating point value from the user.
arln_read_int | Read an integer value from the user.
arln_read_flag | Read a boolean value from the user.
arln_read_line | Read a string from the user.
arln_read_from_stdin | Read a line from the user.

## Functions

float arln_read_float (CONST char *prompt, float default_value)

This routine will prompt the user for a single floating point number. If no input is given, the routine returns a default value.

Parameters:

- prompt : The prompt.
- default_value : The default value.

Returns: The point value.
Multithreading Level: Unsafe

int arln_read_int (CONST char *prompt, int default_value)

This routine will prompt the user for a single integer number. If no input is given, the routine returns a default value.

Parameters:

- prompt : The prompt.
- default_value : The default value.

Returns: The value.
Multithreading Level: Unsafe

flag arln_read_flag (CONST char *prompt, flag default_value)

This routine will prompt the user for a single boolean value. If no input is given, the routine returns a default value.

Parameters:

- prompt : The prompt.
- default_value : The default value.

Returns: TRUE if "yes" was typed in, else FALSE.
Multithreading Level: Unsafe

flag arln_read_line (char *buffer, unsigned int length, CONST char *prompt)

This routine will read a line from a the standard input, stripping all comments, leading and trailing whitespace. The comment character is '#'.

Parameters:

- buffer : The NULL terminated string will be written here. The routine will NOT copy the '\n' newline character into the buffer.
- length : The length of the buffer.
- prompt : The prompt which is to be displayed. The prompt is only displayed if the standard input is NOT a disc file.

Returns: TRUE on successful reading, else FALSE (indicating End-Of-File).
Multithreading Level: Unsafe

flag arln_read_from_stdin (char *buffer, unsigned int length, CONST char *prompt)

This routine will read a line from the standard input without preventing event processing. The standard input channel is internally allocated.

Parameters:

- buffer : The NULL terminated string will be written here. The routine will NOT copy the '\n' newline character into the buffer.
- length : The length of the buffer.
- prompt : The prompt which is to be displayed. Note that the prompt is only displayed if the standard input is NOT a disc file.

Returns: TRUE on successful reading, else FALSE.
Multithreading Level: Unsafe

Back to Karma Home Page