Files
asterisk/main/editline_compat.h
Sean Bright 27cab02ab2 asterisk.c: Allow multi-byte characters on the Asterisk CLI.
Versions of libedit that support Unicode expect that the
EL_GETCFN (the function that does character I/O) will fill in a
`wchar_t` with a character, which may be multi-byte. The built-in
function that libedit provides, but does not expose with a public API,
does properly handle multi-byte sequences.

Due to the design of Asterisk's console processing loop, Asterisk
provides its own implementation which does not handle multi-byte
characters. Changing Asterisk to use libedit's built-in function would
be ideal, but would also require changing some fundamental things
about console processing which could be fairly disruptive.

Instead, we bring in libedit's `read_char` implementation and modify
it to suit our specific needs.

Resolves: #60
2026-01-05 14:46:27 +00:00

27 lines
745 B
C

/*
* Asterisk -- An open source telephony toolkit.
*
* Copyright (C) 2026, Sean Bright
*
* Sean Bright <sean@seanbright.com>
*
* See http://www.asterisk.org for more information about
* the Asterisk project. Please do not directly contact
* any of the maintainers of this project for assistance;
* the project provides a web site, mailing lists and IRC
* channels for your use.
*
* This program is free software, distributed under the terms of
* the GNU General Public License Version 2. See the LICENSE file
* at the top of the source tree.
*/
#ifndef EDITLINE_COMPAT_PRIVATE_H
#define EDITLINE_COMPAT_PRIVATE_H
#include <histedit.h>
int editline_read_char(EditLine *el, wchar_t *cp);
#endif /* EDITLINE_COMPAT_PRIVATE_H */