Add support for Unicode Output

This commit is contained in:
Kaian 2015-02-24 23:42:50 +01:00
commit f7cf974af0
3 changed files with 59 additions and 19 deletions

View File

@ -33,6 +33,35 @@ AC_CHECK_HEADER([ncurses.h], [], [
AC_MSG_ERROR([ You need to have ncurses development files installed to compile sngrep.])
])
# Check for Ncurses Wide character support
AC_ARG_ENABLE([unicode],
AC_HELP_STRING([--enable-unicode], [Enable Ncurses Unicode support]),
[AC_SUBST(UNICODE, $enableval)],
[AC_SUBST(UNICODE, no)]
)
AS_IF([test "x$enable_unicode" == "xyes"], [
# Ncurses with wide-character support
AC_DEFINE([WITH_UNICODE], [], [Compile With Unicode compatibility])
AC_CHECK_LIB([ncursesw], [initscr], [], [
AC_MSG_ERROR([ You need to have libncursesw installed to compile sngrep.])
])
AC_CHECK_LIB([panelw], [new_panel], [], [
AC_MSG_ERROR([ You need to have ncurses panelw library installed to compile sngrep.])
])
AC_CHECK_LIB([formw], [new_form], [], [
AC_MSG_ERROR([ You need to have ncurses formsw library installed to compile sngrep.])
])
AC_CHECK_LIB([menuw], [new_item], [], [
AC_MSG_ERROR([ You need to have ncurses menuw library installed to compile sngrep.])
])
], [
# Ncurses without wide-character support
AC_CHECK_LIB([ncurses], [initscr], [], [
AC_MSG_ERROR([ You need to have libncurses installed to compile sngrep.])
])
@ -48,6 +77,7 @@ AC_CHECK_LIB([form], [new_form], [], [
AC_CHECK_LIB([menu], [new_item], [], [
AC_MSG_ERROR([ You need to have ncurses menu library installed to compile sngrep.])
])
])
AC_CHECK_LIB([pthread], [pthread_create], [], [
AC_MSG_ERROR([ You need to have libpthread installed to compile sngrep.])
@ -62,7 +92,10 @@ AC_CHECK_HEADER([pcap.h], [], [
# Check for SSL dependencies
AC_ARG_ENABLE([openssl],
AC_HELP_STRING([--disable-openssl], [Disable TLS SIP Transport]))
AC_HELP_STRING([--disable-openssl], [Disable SSL Support (TLS SIP Transport)]),
[AC_SUBST(OPENSSL, $enableval)],
[AC_SUBST(OPENSSL, yes)]
)
AS_IF([test "x$enable_openssl" != "xno"], [
@ -105,11 +138,11 @@ if test "x${silent}" != "xyes" ; then
echo
fi
AC_MSG_NOTICE
AC_MSG_NOTICE( ====================================================== )
AC_MSG_NOTICE( sngrep configure finished )
AC_MSG_NOTICE( ---------------------------------------------------- )
AC_MSG_NOTICE( ====================================================== )
AC_MSG_NOTICE( OpenSSL Support : ${OPENSSL} )
AC_MSG_NOTICE( Unicode Support : ${UNICODE} )
AC_MSG_NOTICE( ====================================================== )
AC_MSG_NOTICE

View File

@ -30,6 +30,7 @@
#include <string.h>
#include <math.h>
#include <stdlib.h>
#include <locale.h>
#include "option.h"
#include "ui_manager.h"
#include "ui_call_list.h"
@ -124,6 +125,8 @@ init_interface()
{
int bg, fg;
const char *term;
// Set Locale
setlocale(LC_CTYPE, "");
// Initialize curses
if (!initscr()) {

View File

@ -35,8 +35,12 @@
*/
#ifndef __SNGREP_UI_MANAGER_H
#define __SNGREP_UI_MANAGER_H
#ifdef WITH_UNICODE
#define _X_OPEN_SOURCE_EXTENDED
#include <ncursesw/ncurses.h>
#else
#include <ncurses.h>
#endif
#include <panel.h>
#include "sip.h"
#include "group.h"