std-getstring


Synopsis

(std-getstring <flag> <msg> <def> <spflag>)

Description

Pauses for user input of a string, and returns that string.

Formatting of the <msg> argument:

The prompt is formatted with a leading "\n", the msg argument and def, converted to a string, if def is not-nil, is added. The last characters are always ": "

If the string is longer than 132 characters, it returns only the first 132 characters of the string. If the input string contains the backslash character (\), it is converted to two backslash characters (\\). This is done so that the returned value can contain file name paths that can be used by other functions.

Arguments

flag: integer, same as the INITGET flag or nil

msg: a string to be displayed as a prompt or nil.

def: default value or nil

spflag: if not-nil the input string can contain blanks (and must be terminated by a ENTER). Otherwise, the input string is terminated by space or ENTER.

Return Value

A string, either the given input or the default value.

Side Effects

Interrupts the program flow, prints the formatted message and waits for user input.

If no default is given and flag 1 is used and the user enters wrong types, the functions loops until break or correct input.

Module

(std-require 'STDINPUT)

Defined in STDINPUT