Skip to main content

Return codes

Every code is an int. LT_OK is 0 and every error is negative, so rc < 0 tests for failure. lt_strerror returns the text in the last column.

CodeValueMeaninglt_strerror
LT_OK0successok
LT_ERR-1a generic failure, usually a NULL pointer or an empty argumentgeneric error
LT_ERR_NEED_MORE-2an escape sequence is incomplete and more input is neededneed more input
LT_ERR_INIT_ALREADY-3lt_init called while already initialisedalready initialized
LT_ERR_INIT_OPEN-4the terminal could not be opened or is not a tty, lt_last_errno has the causefailed to open terminal
LT_ERR_MEM-5an allocation failed or the grapheme cluster table is fullout of memory
LT_ERR_NO_EVENT-6no event within the timeout, or no reply to a colour queryno event
LT_ERR_NO_TERM-7no terminal is availableno terminal
LT_ERR_NOT_INIT-8a call that needs a terminal before lt_initnot initialized
LT_ERR_OUT_OF_BOUNDS-9a coordinate or index outside the valid rangecoordinates out of bounds
LT_ERR_READ-10reading input failed, lt_last_errno has the causeread error
LT_ERR_RESIZE_IOCTL-11the terminal size ioctl failedresize: ioctl failed
LT_ERR_RESIZE_PIPE-12the resize self-pipe could not be createdresize: pipe failed
LT_ERR_RESIZE_SIGACTION-13the SIGWINCH handler could not be installedresize: sigaction failed
LT_ERR_POLL-14waiting for input failed, lt_last_errno has the causepoll failed
LT_ERR_TCGETATTR-15reading the terminal attributes failedtcgetattr failed
LT_ERR_TCSETATTR-16setting the terminal attributes failedtcsetattr failed
LT_ERR_UNSUPPORTED_TERM-17the operation is not available on this terminal or platformunsupported terminal
LT_ERR_RESIZE_WRITE-18writing to the resize self-pipe failedresize: write failed
LT_ERR_RESIZE_POLL-19polling the resize self-pipe failedresize: poll failed
LT_ERR_RESIZE_READ-20reading the resize self-pipe failedresize: read failed
LT_ERR_RESIZE_SSCANF-21parsing a size report failedresize: sscanf failed
LT_ERR_CAP_COLLISION-22two terminal capabilities collidedcapability collision

The values mirror termbox2's TB_ERR_* codes, so code that compares against numbers keeps working through the compat header.

See Errors and return codes for which calls return which codes.