libtecla(3) libtecla(3)
NAME
libtecla - An interactive command-line input library.
SYNOPSIS
gcc ... -ltecla -lcurses
DESCRIPTION
The tecla library provides programs with interactive command line
editing facilities, similar to those of the unix tcsh shell. In
addition to simple command-line editing, it supports recall of
previously entered command lines, TAB completion of file names or
other tokens, and in-line wild-card expansion of filenames. The
internal functions which perform file-name completion and wild-card
expansion are also available externally for optional use by the
calling program.
The various parts of the library are documented in the following man
pages:
gl_get_line(3) - The interactive line-input module.
cpl_complete_word(3) - The word completion module.
ef_expand_file(3) - The filename expansion module.
pca_lookup_file(3) - A directory-list based filename
lookup and completion module.
THREAD SAFETY
If the library is compiled with -D_POSIX_C_SOURCE=199506L, reentrant
versions of as many functions as possible are used. This includes
using getpwuid_r() and getpwnam_r() instead of getpwuid() and
getpwnam() when looking up the home directories of specific users in
the password file (for ~user/ expansion), and readdir_r() instead of
readdir() for reading directory entries when doing filename
completion. The reentrant version of the library is usually called
libtecla_r.a instead of libtecla.a, so if only the latter is
available, it probably isn't the correct version to link with threaded
programs.
Reentrant functions for iterating through the password file aren't
available, so when the library is compiled to be reentrant, TAB
completion of incomplete usernames in ~username/ expressions is
disabled. This doesn't disable expansion of complete ~username
expressions, which can be done reentrantly, or expansion of the parts
of filenames that follow them, so this doesn't remove much
functionality.
The terminfo functions setupterm(), tigetstr(), tigetnum() and tputs()
also aren't reentrant, but very few programs will want to interact
with multiple terminals, so this shouldn't prevent this library from
being used in threaded programs.
- 1 - Formatted: October 26, 2025
libtecla(3) libtecla(3)
TRIVIA
In Spanish, "teclas" are the keys of a keyboard. Since this library
centers on keyboard input, and given that I wrote the library while
working in Chile, this seemed like a suitable name.
FILES
libtecla.a - The tecla library.
libtecla.h - The tecla header file.
~/.teclarc - The tecla personal customization file.
SEE ALSO
gl_get_line(3), ef_expand_file(3), cpl_complete_word(3),
pca_lookup_file(3)
AUTHOR
Martin Shepherd (mcs@astro.caltech.edu)
- 2 - Formatted: October 26, 2025