summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt8
-rw-r--r--ChangeLog.adoc1
-rw-r--r--configure.ac21
-rw-r--r--debian-stable/weechat-curses.install3
-rw-r--r--doc/cs/CMakeLists.txt16
-rw-r--r--doc/cs/cmdline_options.cs.adoc5
-rw-r--r--doc/cs/weechat.1.cs.adoc6
-rw-r--r--doc/de/CMakeLists.txt16
-rw-r--r--doc/de/cmdline_options.de.adoc5
-rw-r--r--doc/de/weechat.1.de.adoc6
-rw-r--r--doc/en/CMakeLists.txt16
-rw-r--r--doc/en/cmdline_options.en.adoc4
-rw-r--r--doc/en/weechat.1.en.adoc5
-rw-r--r--doc/en/weechat_dev.en.adoc78
-rw-r--r--doc/fr/CMakeLists.txt16
-rw-r--r--doc/fr/cmdline_options.fr.adoc4
-rw-r--r--doc/fr/weechat.1.fr.adoc6
-rw-r--r--doc/fr/weechat_dev.fr.adoc78
-rw-r--r--doc/it/CMakeLists.txt16
-rw-r--r--doc/it/cmdline_options.it.adoc5
-rw-r--r--doc/it/weechat.1.it.adoc6
-rw-r--r--doc/ja/CMakeLists.txt16
-rw-r--r--doc/ja/cmdline_options.ja.adoc5
-rw-r--r--doc/ja/weechat.1.ja.adoc6
-rw-r--r--doc/ja/weechat_dev.ja.adoc84
-rw-r--r--doc/pl/CMakeLists.txt16
-rw-r--r--doc/pl/cmdline_options.pl.adoc5
-rw-r--r--doc/pl/weechat.1.pl.adoc6
-rw-r--r--doc/ru/CMakeLists.txt16
-rw-r--r--doc/ru/cmdline_options.ru.adoc5
-rw-r--r--doc/ru/weechat.1.ru.adoc6
-rw-r--r--po/POTFILES.in3
-rw-r--r--po/cs.po33
-rw-r--r--po/de.po33
-rw-r--r--po/es.po33
-rw-r--r--po/fr.po39
-rw-r--r--po/hu.po33
-rw-r--r--po/it.po33
-rw-r--r--po/ja.po33
-rw-r--r--po/pl.po37
-rw-r--r--po/pt.po33
-rw-r--r--po/pt_BR.po33
-rw-r--r--po/ru.po33
-rw-r--r--po/srcfiles.cmake3
-rw-r--r--po/tr.po33
-rw-r--r--po/weechat.pot33
-rw-r--r--src/core/CMakeLists.txt53
-rw-r--r--src/core/weechat.c40
-rw-r--r--src/core/weechat.h2
-rw-r--r--src/gui/CMakeLists.txt47
-rw-r--r--src/gui/Makefile.am6
-rw-r--r--src/gui/curses/CMakeLists.txt72
-rw-r--r--src/gui/curses/Makefile.am46
-rw-r--r--src/gui/curses/gui-curses-main.c28
-rw-r--r--src/gui/curses/gui-curses.h4
-rw-r--r--src/gui/curses/headless/CMakeLists.txt57
-rw-r--r--src/gui/curses/headless/Makefile.am55
-rw-r--r--src/gui/curses/headless/main.c125
-rw-r--r--src/gui/curses/headless/ncurses-fake.c433
-rw-r--r--src/gui/curses/headless/ncurses-fake.h126
-rw-r--r--src/gui/curses/normal/CMakeLists.txt81
-rw-r--r--src/gui/curses/normal/Makefile.am62
-rw-r--r--src/gui/curses/normal/main.c (renamed from src/gui/curses/main.c)8
-rw-r--r--src/plugins/CMakeLists.txt16
-rw-r--r--tests/CMakeLists.txt8
-rw-r--r--tests/Makefile.am8
-rw-r--r--tests/ncurses-fake.c315
-rw-r--r--tests/tests.cpp1
68 files changed, 1844 insertions, 680 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0885d566b..ff9ed87ef 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -82,7 +82,8 @@ else()
set(INCLUDEDIR ${CMAKE_INSTALL_PREFIX}/include/${PROJECT_NAME})
endif()
-option(ENABLE_NCURSES "Enable Ncurses interface" ON)
+option(ENABLE_NCURSES "Compile the Ncurses interface" ON)
+option(ENABLE_HEADLESS "Compile the headless binary (required for tests)" ON)
option(ENABLE_NLS "Enable Native Language Support" ON)
option(ENABLE_GNUTLS "Enable SSLv3/TLS support" ON)
option(ENABLE_LARGEFILE "Enable Large File Support" ON)
@@ -114,6 +115,11 @@ option(ENABLE_MAN "Enable build of man page" OFF)
option(ENABLE_DOC "Enable build of documentation" OFF)
option(ENABLE_TESTS "Enable tests" OFF)
+# headless mode is required for tests
+if(ENABLE_TESTS AND NOT ENABLE_HEADLESS)
+ message(FATAL_ERROR "Headless mode is required for tests.")
+endif()
+
# option WEECHAT_HOME
if(NOT DEFINED WEECHAT_HOME OR "${WEECHAT_HOME}" STREQUAL "")
set(WEECHAT_HOME "~/.weechat")
diff --git a/ChangeLog.adoc b/ChangeLog.adoc
index 8c96b0e46..01150e5c3 100644
--- a/ChangeLog.adoc
+++ b/ChangeLog.adoc
@@ -20,6 +20,7 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features::
+ * core: add binary weechat-headless to run WeeChat without interface, with optional daemon mode (command line option "--daemon") (issue #1120)
* core: add options "-newbuffer", "-free" and "-switch" in command /print (issue #1113)
* core: add option "-y" in command /print, add support of buffers with free content
* core: add option "add" in command /buffer (issue #1113)
diff --git a/configure.ac b/configure.ac
index 002543624..f00d387e2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -137,6 +137,7 @@ AH_VERBATIM([CA_FILE], [#define CA_FILE "/etc/ssl/certs/ca-certificates.crt"])
# Arguments for ./configure
AC_ARG_ENABLE(ncurses, [ --disable-ncurses turn off ncurses interface (default=compiled if found)],enable_ncurses=$enableval,enable_ncurses=yes)
+AC_ARG_ENABLE(headless, [ --disable-headless turn off headless binary (default=compiled), this is required for tests],enable_headless=$enableval,enable_headless=yes)
AC_ARG_ENABLE(gnutls, [ --disable-gnutls turn off gnutls support (default=compiled if found)],enable_gnutls=$enableval,enable_gnutls=yes)
AC_ARG_ENABLE(largefile, [ --disable-largefile turn off Large File Support (default=on)],enable_largefile=$enableval,enable_largefile=yes)
AC_ARG_ENABLE(alias, [ --disable-alias turn off Alias plugin (default=compiled)],enable_alias=$enableval,enable_alias=yes)
@@ -185,6 +186,10 @@ AC_DEFINE_UNQUOTED(CA_FILE, "$CA_FILE")
not_asked=""
not_found=""
+if test "x$enable_headless" != "xyes" && test "x$enable_tests" = "xyes"; then
+ AC_MSG_ERROR([*** Headless mode is required for tests.])
+fi
+
# ------------------------------------------------------------------------------
# pkg-config
# ------------------------------------------------------------------------------
@@ -242,6 +247,14 @@ else
fi
# ------------------------------------------------------------------------------
+# headless
+# ------------------------------------------------------------------------------
+
+if test "x$enable_headless" != "xyes" ; then
+ not_asked="$not_asked headless"
+fi
+
+# ------------------------------------------------------------------------------
# iconv
# ------------------------------------------------------------------------------
@@ -1375,6 +1388,7 @@ AM_CONDITIONAL(HAVE_GNUTLS, test "$enable_gnutls" = "yes")
AM_CONDITIONAL(HAVE_FLOCK, test "$enable_flock" = "yes")
AM_CONDITIONAL(HAVE_EAT_NEWLINE_GLITCH, test "$enable_eatnewlineglitch" = "yes")
AM_CONDITIONAL(GUI_NCURSES, test "$enable_ncurses" = "yes")
+AM_CONDITIONAL(HEADLESS, test "$enable_headless" = "yes")
AM_CONDITIONAL(PLUGIN_ALIAS, test "$enable_alias" = "yes")
AM_CONDITIONAL(PLUGIN_ASPELL, test "$enable_aspell" = "yes")
AM_CONDITIONAL(PLUGIN_BUFLIST, test "$enable_buflist" = "yes")
@@ -1437,6 +1451,8 @@ AC_OUTPUT([Makefile
src/plugins/xfer/Makefile
src/gui/Makefile
src/gui/curses/Makefile
+ src/gui/curses/normal/Makefile
+ src/gui/curses/headless/Makefile
tests/Makefile
intl/Makefile
po/Makefile.in])
@@ -1449,11 +1465,14 @@ listgui=""
if test "x$enable_ncurses" = "xyes" ; then
listgui="$listgui ncurses"
fi
+if test "x$enable_headless" = "xyes" ; then
+ listgui="$listgui headless"
+fi
if test "x$listgui" = "x" ; then
AC_MSG_ERROR([
*** No interface specified...
-*** Please enable at least ncurses.])
+*** Please enable at least ncurses or headless.])
fi
listplugins=""
diff --git a/debian-stable/weechat-curses.install b/debian-stable/weechat-curses.install
index 9ca632180..13ee787f4 100644
--- a/debian-stable/weechat-curses.install
+++ b/debian-stable/weechat-curses.install
@@ -1,4 +1,7 @@
usr/bin/weechat
+usr/bin/weechat-headless
debian/weechat.xpm usr/share/pixmaps
usr/share/man/man1/weechat.1
usr/share/man/*/man1/weechat.1
+usr/share/man/man1/weechat-headless.1
+usr/share/man/*/man1/weechat-headless.1
diff --git a/doc/cs/CMakeLists.txt b/doc/cs/CMakeLists.txt
index 9e81542be..db441959b 100644
--- a/doc/cs/CMakeLists.txt
+++ b/doc/cs/CMakeLists.txt
@@ -28,8 +28,22 @@ if(ENABLE_MAN)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building weechat.1 (cs)"
)
- add_custom_target(doc-man-cs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
+ add_custom_target(doc-man-weechat-cs ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat.1 DESTINATION ${MANDIR}/cs/man1)
+
+ # symbolic link weechat-headless.1 -> weechat.1
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1
+ COMMAND ${CMAKE_COMMAND} -E remove -f "weechat-headless.1"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink "weechat.1" "weechat-headless.1"
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat.1.cs.adoc
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmdline_options.cs.adoc
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Creating symbolic link weechat-headless.1 (cs)"
+ )
+ add_custom_target(doc-man-weechat-headless-en ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1 DESTINATION ${MANDIR}/cs/man1)
endif()
if(ENABLE_DOC)
diff --git a/doc/cs/cmdline_options.cs.adoc b/doc/cs/cmdline_options.cs.adoc
index 286b8738b..3711df278 100644
--- a/doc/cs/cmdline_options.cs.adoc
+++ b/doc/cs/cmdline_options.cs.adoc
@@ -4,6 +4,11 @@
*-c*, *--colors*::
Zobraz defaultní barvy v terminálu.
+// TRANSLATION MISSING
+*--daemon*::
+ Run WeeChat in background, as a daemon (works only with the command
+ *weechat-headless*).
+
*-d*, *--dir* _<path>_::
Nastav cestu jako dovmský adresář pro WeeChat (použitou pro konfigurační
soubory, logy, uživatelské pluginy a skripty), výchozí hodnota je
diff --git a/doc/cs/weechat.1.cs.adoc b/doc/cs/weechat.1.cs.adoc
index 03de6ad29..e87441d5c 100644
--- a/doc/cs/weechat.1.cs.adoc
+++ b/doc/cs/weechat.1.cs.adoc
@@ -20,12 +20,18 @@ weechat - the extensible chat client
*weechat* [-l|--license]
*weechat* [-v|--version]
+*weechat-headless* [-a|--no-connect] [--daemon] [-d|--dir <path>] [-p|--no-plugin] [-r|--run-command <command>] [-s|--no-script] [--upgrade] [plugin:option...]
+
== POPIS
WeeChat (Wee Enhanced Environment for Chat) je svobodný chatovací klient.
Je lehký, plně konfigurovatelný a lehce rozšiřitelný pomocí pluginů a scriptů
v obvyklých sciptovacích jazycích.
+// TRANSLATION MISSING
+The command *weechat-headless* runs WeeChat in a headless mode (no interface).
+It can be used for tests or to daemonize WeeChat with the option "--daemon".
+
== VOLBY
diff --git a/doc/de/CMakeLists.txt b/doc/de/CMakeLists.txt
index 025d03d3d..28874e476 100644
--- a/doc/de/CMakeLists.txt
+++ b/doc/de/CMakeLists.txt
@@ -28,8 +28,22 @@ if(ENABLE_MAN)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building weechat.1 (de)"
)
- add_custom_target(doc-man-de ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
+ add_custom_target(doc-man-weechat-de ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat.1 DESTINATION ${MANDIR}/de/man1)
+
+ # symbolic link weechat-headless.1 -> weechat.1
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1
+ COMMAND ${CMAKE_COMMAND} -E remove -f "weechat-headless.1"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink "weechat.1" "weechat-headless.1"
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat.1.de.adoc
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmdline_options.de.adoc
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Creating symbolic link weechat-headless.1 (de)"
+ )
+ add_custom_target(doc-man-weechat-headless-en ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1 DESTINATION ${MANDIR}/de/man1)
endif()
if(ENABLE_DOC)
diff --git a/doc/de/cmdline_options.de.adoc b/doc/de/cmdline_options.de.adoc
index 447e5d9bb..9f6f10287 100644
--- a/doc/de/cmdline_options.de.adoc
+++ b/doc/de/cmdline_options.de.adoc
@@ -4,6 +4,11 @@
*-c*, *--colors*::
zeigt die Standardfarben im Terminal an.
+// TRANSLATION MISSING
+*--daemon*::
+ Run WeeChat in background, as a daemon (works only with the command
+ *weechat-headless*).
+
*-d*, *--dir* _<path>_::
legt den Konfigurationsordner für WeeChat fest in welchem die Erweiterungen,
Skripten, Protokolldateien etc.pp. gesichert werden (Voreinstellung: "~/.weechat").
diff --git a/doc/de/weechat.1.de.adoc b/doc/de/weechat.1.de.adoc
index f61c55428..8fbacecf0 100644
--- a/doc/de/weechat.1.de.adoc
+++ b/doc/de/weechat.1.de.adoc
@@ -19,12 +19,18 @@ weechat - der erweiterbare Chat Client
*weechat* [-l|--license]
*weechat* [-v|--version]
+*weechat-headless* [-a|--no-connect] [--daemon] [-d|--dir <path>] [-p|--no-plugin] [-r|--run-command <command>] [-s|--no-script] [--upgrade] [plugin:option...]
+
== BESCHREIBUNG
WeeChat (Wee Enhanced Environment for Chat) ist ein freier, schneller und
schlanker Chat-Client der für unterschiedliche Betriebssysteme entwickelt wird.
Durch Skripten ist das Hauptprogramm äußerst flexibel und erweiterbar.
+// TRANSLATION MISSING
+The command *weechat-headless* runs WeeChat in a headless mode (no interface).
+It can be used for tests or to daemonize WeeChat with the option "--daemon".
+
== OPTIONEN
include::cmdline_options.de.adoc[]
diff --git a/doc/en/CMakeLists.txt b/doc/en/CMakeLists.txt
index 094649aec..654c260aa 100644
--- a/doc/en/CMakeLists.txt
+++ b/doc/en/CMakeLists.txt
@@ -28,8 +28,22 @@ if(ENABLE_MAN)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building weechat.1 (en)"
)
- add_custom_target(doc-man-en ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
+ add_custom_target(doc-man-weechat-en ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat.1 DESTINATION ${MANDIR}/man1)
+
+ # symbolic link weechat-headless.1 -> weechat.1
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1
+ COMMAND ${CMAKE_COMMAND} -E remove -f "weechat-headless.1"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink "weechat.1" "weechat-headless.1"
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat.1.en.adoc
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmdline_options.en.adoc
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Creating symbolic link weechat-headless.1 (en)"
+ )
+ add_custom_target(doc-man-weechat-headless-en ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1 DESTINATION ${MANDIR}/man1)
endif()
if(ENABLE_DOC)
diff --git a/doc/en/cmdline_options.en.adoc b/doc/en/cmdline_options.en.adoc
index 82a1c8fb8..5a559f895 100644
--- a/doc/en/cmdline_options.en.adoc
+++ b/doc/en/cmdline_options.en.adoc
@@ -4,6 +4,10 @@
*-c*, *--colors*::
Display default colors in terminal.
+*--daemon*::
+ Run WeeChat in background, as a daemon (works only with the command
+ *weechat-headless*).
+
*-d*, *--dir* _<path>_::
Set path as home for WeeChat (used for configuration files, logs, user
plugins and scripts), default value is "~/.weechat" (note: directory is
diff --git a/doc/en/weechat.1.en.adoc b/doc/en/weechat.1.en.adoc
index ee4e5ab58..132022985 100644
--- a/doc/en/weechat.1.en.adoc
+++ b/doc/en/weechat.1.en.adoc
@@ -19,12 +19,17 @@ weechat - the extensible chat client
*weechat* [-l|--license]
*weechat* [-v|--version]
+*weechat-headless* [-a|--no-connect] [--daemon] [-d|--dir <path>] [-p|--no-plugin] [-r|--run-command <command>] [-s|--no-script] [--upgrade] [plugin:option...]
+
== DESCRIPTION
WeeChat (Wee Enhanced Environment for Chat) is a free chat client, fast and
light, designed for many operating systems.
It is highly customizable and extensible with scripts.
+The command *weechat-headless* runs WeeChat in a headless mode (no interface).
+It can be used for tests or to daemonize WeeChat with the option "--daemon".
+
== OPTIONS
include::cmdline_options.en.adoc[]
diff --git a/doc/en/weechat_dev.en.adoc b/doc/en/weechat_dev.en.adoc
index 6c87c879f..3fe02b9ac 100644
--- a/doc/en/weechat_dev.en.adoc
+++ b/doc/en/weechat_dev.en.adoc
@@ -60,41 +60,43 @@ The main WeeChat directories are:
[width="100%",cols="1m,3",options="header"]
|===
-| Directory | Description
-| src/ | Root of sources.
-|    core/ | Core functions: entry point, internal structures.
-|    gui/ | Functions for buffers, windows, ... (used by all interfaces).
-|       curses/ | Curses interface.
-|    plugins/ | Plugin and scripting API.
-|       alias/ | Alias plugin.
-|       aspell/ | Aspell plugin.
-|       buflist/ | Buflist plugin.
-|       charset/ | Charset plugin.
-|       exec/ | Exec plugin.
-|       fifo/ | Fifo plugin (FIFO pipe used to remotely send commands to WeeChat).
-|       fset/ | Fset (Fast Set) plugin.
-|       guile/ | Guile (scheme) scripting API.
-|       irc/ | IRC (Internet Relay Chat) plugin.
-|       javascript/ | JavaScript scripting API.
-|       logger/ | Logger plugin (write messages displayed to files).
-|       lua/ | Lua scripting API.
-|       perl/ | Perl scripting API.
-|       php/ | PHP scripting API.
-|       python/ | Python scripting API.
-|       relay/ | Relay plugin (irc proxy + relay for remote interfaces).
-|       ruby/ | Ruby scripting API.
-|       script/ | Script manager.
-|       tcl/ | Tcl scripting API.
-|       trigger/ | Trigger plugin.
-|       xfer/ | Xfer plugin (IRC DCC file/chat).
-| tests/ | Tests.
-|    scripts/ | Scripting API tests.
-|       python/ | Python scripts to generate and run the scripting API tests.
-|    unit/ | Unit tests.
-|       core/ | Unit tests for core functions.
-| doc/ | Documentation.
-| po/ | Translations files (gettext).
-| debian/ | Debian packaging.
+| Directory | Description
+| src/ | Root of sources.
+|    core/ | Core functions: entry point, internal structures.
+|    gui/ | Functions for buffers, windows, ... (used by all interfaces).
+|       curses/ | Curses interface.
+|          headless/ | Headless mode (no interface).
+|          normal/ | Curses interface.
+|    plugins/ | Plugin and scripting API.
+|       alias/ | Alias plugin.
+|       aspell/ | Aspell plugin.
+|       buflist/ | Buflist plugin.
+|       charset/ | Charset plugin.
+|       exec/ | Exec plugin.
+|       fifo/ | Fifo plugin (FIFO pipe used to remotely send commands to WeeChat).
+|       fset/ | Fset (Fast Set) plugin.
+|       guile/ | Guile (scheme) scripting API.
+|       irc/ | IRC (Internet Relay Chat) plugin.
+|       javascript/ | JavaScript scripting API.
+|       logger/ | Logger plugin (write messages displayed to files).
+|       lua/ | Lua scripting API.
+|       perl/ | Perl scripting API.
+|       php/ | PHP scripting API.
+|       python/ | Python scripting API.
+|       relay/ | Relay plugin (irc proxy + relay for remote interfaces).
+|       ruby/ | Ruby scripting API.
+|       script/ | Script manager.
+|       tcl/ | Tcl scripting API.
+|       trigger/ | Trigger plugin.
+|       xfer/ | Xfer plugin (IRC DCC file/chat).
+| tests/ | Tests.
+|    scripts/ | Scripting API tests.
+|       python/ | Python scripts to generate and run the scripting API tests.
+|    unit/ | Unit tests.
+|       core/ | Unit tests for core functions.
+| doc/ | Documentation.
+| po/ | Translations files (gettext).
+| debian/ | Debian packaging.
|===
[[sources]]
@@ -168,7 +170,11 @@ WeeChat "core" is located in following directories:
|       gui-curses-mouse.c | Mouse.
|       gui-curses-term.c | Functions about terminal.
|       gui-curses-window.c | Windows.
-|       main.c | Entry point.
+|       headless/ | Headless mode (no interface).
+|          main.c | Entry point for headless mode.
+|          ncurses-fake.c | Fake ncurses library.
+|       normal/ | Curses interface.
+|          main.c | Entry point for Curses interface.
|===
[[sources_plugins]]
diff --git a/doc/fr/CMakeLists.txt b/doc/fr/CMakeLists.txt
index 27943c1f2..916c68030 100644
--- a/doc/fr/CMakeLists.txt
+++ b/doc/fr/CMakeLists.txt
@@ -28,8 +28,22 @@ if(ENABLE_MAN)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building weechat.1 (fr)"
)
- add_custom_target(doc-man-fr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
+ add_custom_target(doc-man-weechat-fr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat.1 DESTINATION ${MANDIR}/fr/man1)
+
+ # symbolic link weechat-headless.1 -> weechat.1
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1
+ COMMAND ${CMAKE_COMMAND} -E remove -f "weechat-headless.1"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink "weechat.1" "weechat-headless.1"
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat.1.fr.adoc
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmdline_options.fr.adoc
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Creating symbolic link weechat-headless.1 (fr)"
+ )
+ add_custom_target(doc-man-weechat-headless-en ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1 DESTINATION ${MANDIR}/fr/man1)
endif()
if(ENABLE_DOC)
diff --git a/doc/fr/cmdline_options.fr.adoc b/doc/fr/cmdline_options.fr.adoc
index b24fdbf71..29a2f75a6 100644
--- a/doc/fr/cmdline_options.fr.adoc
+++ b/doc/fr/cmdline_options.fr.adoc
@@ -4,6 +4,10 @@
*-c*, *--colors*::
Afficher les couleurs par défaut du terminal.
+*--daemon*::
+ Lancer WeeChat en tâche de fond, comme un daemon (fonctionne seulement avec
+ la commande *weechat-headless*).
+
*-d*, *--dir* _<répertoire>_::
Définir le répertoire comme étant la base de WeeChat
(utilisé pour les fichiers de configuration, logs, extensions
diff --git a/doc/fr/weechat.1.fr.adoc b/doc/fr/weechat.1.fr.adoc
index 18e0ded16..2f034c450 100644
--- a/doc/fr/weechat.1.fr.adoc
+++ b/doc/fr/weechat.1.fr.adoc
@@ -19,12 +19,18 @@ weechat - le client de discussion extensible
*weechat* [-l|--license]
*weechat* [-v|--version]
+*weechat-headless* [-a|--no-connect] [--daemon] [-d|--dir <path>] [-p|--no-plugin] [-r|--run-command <command>] [-s|--no-script] [--upgrade] [plugin:option...]
+
== DESCRIPTION
WeeChat (Wee Enhanced Environment for Chat) est un client de discussion libre,
rapide et léger, conçu pour différents systèmes d'exploitation.
Il est hautement paramétrable et extensible avec des scripts.
+La commande *weechat-headless* lance WeeChat en mode « headless » (sans interface).
+Elle peut être utilisée pour des tests ou lancer WeeChat en daemon
+avec l'option "--daemon".
+
== OPTIONS
include::cmdline_options.fr.adoc[]
diff --git a/doc/fr/weechat_dev.fr.adoc b/doc/fr/weechat_dev.fr.adoc
index 93ecfbcc1..0de1fb27a 100644
--- a/doc/fr/weechat_dev.fr.adoc
+++ b/doc/fr/weechat_dev.fr.adoc
@@ -62,41 +62,43 @@ Les répertoires principaux de WeeChat sont :
[width="100%",cols="1m,3",options="header"]
|===
-| Répertoire | Description
-| src/ | Racine des sources.
-|    core/ | Fonctions du cœur : point d'entrée, structures internes.
-|    gui/ | Fonctions pour les tampons, fenêtres, ... (utilisées par toutes les interfaces).
-|       curses/ | Interface Curses.
-|    plugins/ | API extension/script.
-|       alias/ | Extension Alias.
-|       aspell/ | Extension Aspell.
-|       buflist/ | Extension Buflist.
-|       charset/ | Extension Charset.
-|       exec/ | Extension Exec.
-|       fifo/ | Extension Fifo (tube FIFO utilisé pour envoyer des commandes à WeeChat).
-|       fset/ | Extension Fset (Fast Set).
-|       guile/ | API script Guile (scheme).
-|       irc/ | Extension IRC (Internet Relay Chat).
-|       javascript/ | API script JavaScript.
-|       logger/ | Extension Logger (enregistrer les messages affichés dans des fichiers).
-|       lua/ | API script Lua.
-|       perl/ | API script Perl.
-|       php/ | API script PHP.
-|       python/ | API script Python.
-|       relay/ | Extension Relay (proxy IRC + relai pour interfaces distantes).
-|       ruby/ | API script Ruby.
-|       script/ | Gestionnaire de scripts.
-|       tcl/ | API script Tcl.
-|       trigger/ | Extension Trigger.
-|       xfer/ | Extension Xfer (IRC DCC fichier/discussion).
-| tests/ | Tests.
-|    scripts/ | Tests de l'API script.
-|       python/ | Scripts Python pour générer et lancer les tests de l'API script.
-|    unit/ | Tests unitaires.
-|       core/ | Tests unitaires pour les fonctions du cœur.
-| doc/ | Documentation.
-| po/ | Fichiers de traductions (gettext).
-| debian/ | Empaquetage Debian.
+| Répertoire | Description
+| src/ | Racine des sources.
+|    core/ | Fonctions du cœur : point d'entrée, structures internes.
+|    gui/ | Fonctions pour les tampons, fenêtres, ... (utilisées par toutes les interfaces).
+|       curses/ | Interface Curses.
+|          headless/ | Mode sans interface (« headless »).
+|          normal/ | Interface Curses.
+|    plugins/ | API extension/script.
+|       alias/ | Extension Alias.
+|       aspell/ | Extension Aspell.
+|       buflist/ | Extension Buflist.
+|       charset/ | Extension Charset.
+|       exec/ | Extension Exec.
+|       fifo/ | Extension Fifo (tube FIFO utilisé pour envoyer des commandes à WeeChat).
+|       fset/ | Extension Fset (Fast Set).
+|       guile/ | API script Guile (scheme).
+|       irc/ | Extension IRC (Internet Relay Chat).
+|       javascript/ | API script JavaScript.
+|       logger/ | Extension Logger (enregistrer les messages affichés dans des fichiers).
+|       lua/ | API script Lua.
+|       perl/ | API script Perl.
+|       php/ | API script PHP.
+|       python/ | API script Python.
+|       relay/ | Extension Relay (proxy IRC + relai pour interfaces distantes).
+|       ruby/ | API script Ruby.
+|       script/ | Gestionnaire de scripts.
+|       tcl/ | API script Tcl.
+|       trigger/ | Extension Trigger.
+|       xfer/ | Extension Xfer (IRC DCC fichier/discussion).
+| tests/ | Tests.
+|    scripts/ | Tests de l'API script.
+|       python/ | Scripts Python pour générer et lancer les tests de l'API script.
+|    unit/ | Tests unitaires.
+|       core/ | Tests unitaires pour les fonctions du cœur.
+| doc/ | Documentation.
+| po/ | Fichiers de traductions (gettext).
+| debian/ | Empaquetage Debian.
|===
[[sources]]
@@ -170,7 +172,11 @@ Le cœur de WeeChat est situé dans les répertoires suivants :
|       gui-curses-mouse.c | Souris.
|       gui-curses-term.c | Fonctions pour le terminal.
|       gui-curses-window.c | Fenêtres.
-|       main.c | Point d'entrée.
+|       headless/ | Mode sans interface (« headless »).
+|          main.c | Point d'entrée pour le mode sans interface.
+|          ncurses-fake.c | Fausse bibliothèque ncurses.
+|       normal/ | Interface Curses.
+|          main.c | Point d'entrée pour l'interface Curses.
|===
[[sources_plugins]]
diff --git a/doc/it/CMakeLists.txt b/doc/it/CMakeLists.txt
index dd27768a1..00ffcb651 100644
--- a/doc/it/CMakeLists.txt
+++ b/doc/it/CMakeLists.txt
@@ -28,8 +28,22 @@ if(ENABLE_MAN)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building weechat.1 (it)"
)
- add_custom_target(doc-man-it ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
+ add_custom_target(doc-man-weechat-it ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat.1 DESTINATION ${MANDIR}/it/man1)
+
+ # symbolic link weechat-headless.1 -> weechat.1
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1
+ COMMAND ${CMAKE_COMMAND} -E remove -f "weechat-headless.1"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink "weechat.1" "weechat-headless.1"
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat.1.it.adoc
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmdline_options.it.adoc
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Creating symbolic link weechat-headless.1 (it)"
+ )
+ add_custom_target(doc-man-weechat-headless-en ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1 DESTINATION ${MANDIR}/it/man1)
endif()
if(ENABLE_DOC)
diff --git a/doc/it/cmdline_options.it.adoc b/doc/it/cmdline_options.it.adoc
index d3d682d92..8d0ccb770 100644
--- a/doc/it/cmdline_options.it.adoc
+++ b/doc/it/cmdline_options.it.adoc
@@ -5,6 +5,11 @@
Mostra i colori prefefiniti nel terminale.
// TRANSLATION MISSING
+*--daemon*::
+ Run WeeChat in background, as a daemon (works only with the command
+ *weechat-headless*).
+
+// TRANSLATION MISSING
*-d*, *--dir* _<path>_::
Imposta una directory come home per WeeChat (utilizzata per i file di
configurazione, log, plugin e script dell'utente), il valore predefinito
diff --git a/doc/it/weechat.1.it.adoc b/doc/it/weechat.1.it.adoc
index 7843c62d7..a0b80de5a 100644
--- a/doc/it/weechat.1.it.adoc
+++ b/doc/it/weechat.1.it.adoc
@@ -21,6 +21,8 @@ weechat - the extensible chat client
*weechat* [-l|--license]
*weechat* [-v|--version]
+*weechat-headless* [-a|--no-connect] [--daemon] [-d|--dir <path>] [-p|--no-plugin] [-r|--run-command <command>] [-s|--no-script] [--upgrade] [plugin:option...]
+
== DESCRIPTION
// TRANSLATION MISSING
@@ -28,6 +30,10 @@ WeeChat (Wee Enhanced Environment for Chat) è un client di chat
libero, veloce e leggero, realizzato per diversi sistemi operativi.
It is highly customizable and extensible with scripts.
+// TRANSLATION MISSING
+The command *weechat-headless* runs WeeChat in a headless mode (no interface).
+It can be used for tests or to daemonize WeeChat with the option "--daemon".
+
== OPTIONS
include::cmdline_options.it.adoc[]
diff --git a/doc/ja/CMakeLists.txt b/doc/ja/CMakeLists.txt
index 2a408dbaa..935e3d40d 100644
--- a/doc/ja/CMakeLists.txt
+++ b/doc/ja/CMakeLists.txt
@@ -28,8 +28,22 @@ if(ENABLE_MAN)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building weechat.1 (ja)"
)
- add_custom_target(doc-man-ja ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
+ add_custom_target(doc-man-weechat-ja ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat.1 DESTINATION ${MANDIR}/ja/man1)
+
+ # symbolic link weechat-headless.1 -> weechat.1
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1
+ COMMAND ${CMAKE_COMMAND} -E remove -f "weechat-headless.1"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink "weechat.1" "weechat-headless.1"
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat.1.ja.adoc
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmdline_options.ja.adoc
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Creating symbolic link weechat-headless.1 (ja)"
+ )
+ add_custom_target(doc-man-weechat-headless-en ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1 DESTINATION ${MANDIR}/ja/man1)
endif()
if(ENABLE_DOC)
diff --git a/doc/ja/cmdline_options.ja.adoc b/doc/ja/cmdline_options.ja.adoc
index 4fc052b30..936f60984 100644
--- a/doc/ja/cmdline_options.ja.adoc
+++ b/doc/ja/cmdline_options.ja.adoc
@@ -4,6 +4,11 @@
*-c*, *--colors*::
端末にデフォルト色を表示
+// TRANSLATION MISSING
+*--daemon*::
+ Run WeeChat in background, as a daemon (works only with the command
+ *weechat-headless*).
+
*-d*, *--dir* _<path>_::
WeeChat のホームディレクトリを path に設定 (設定ファイル、ログ、
ユーザプラグイン、スクリプトに利用される)、初期値は "~/.weechat" 。
diff --git a/doc/ja/weechat.1.ja.adoc b/doc/ja/weechat.1.ja.adoc
index 0aab9fe0a..ea929971e 100644
--- a/doc/ja/weechat.1.ja.adoc
+++ b/doc/ja/weechat.1.ja.adoc
@@ -19,12 +19,18 @@ weechat - 拡張可能なチャットクライアント
*weechat* [-l|--license]
*weechat* [-v|--version]
+*weechat-headless* [-a|--no-connect] [--daemon] [-d|--dir <path>] [-p|--no-plugin] [-r|--run-command <command>] [-s|--no-script] [--upgrade] [plugin:option...]
+
== 説明
WeeChat (Wee Enhanced Environment for Chat) はフリーのチャットクライアントです。
高速で軽量、多くのオペレーティングシステムで動くように設計されています。
スクリプトを使って高度にカスタマイズと拡張可能です。
+// TRANSLATION MISSING
+The command *weechat-headless* runs WeeChat in a headless mode (no interface).
+It can be used for tests or to daemonize WeeChat with the option "--daemon".
+
== オプション
include::cmdline_options.ja.adoc[]
diff --git a/doc/ja/weechat_dev.ja.adoc b/doc/ja/weechat_dev.ja.adoc
index c8a91d2e8..f8eaf2f72 100644
--- a/doc/ja/weechat_dev.ja.adoc
+++ b/doc/ja/weechat_dev.ja.adoc
@@ -66,41 +66,44 @@ qweechat::
[width="100%",cols="1m,3",options="header"]
|===
-| ディレクトリ | 説明
-| src/ | ソースコードのルートディレクトリ
-|    core/ | コア関数: エントリポイント、内部構造体
-|    gui/ | バッファ、ウィンドウ、... を操作する関数 (全てのインターフェイスで使う)
-|       curses/ | curses インターフェイス
-|    plugins/ | プラグインとスクリプト向け API
-|       alias/ | alias プラグイン
-|       aspell/ | aspell プラグイン
-|       buflist/ | buflist プラグイン
-|       charset/ | charset プラグイン
-|       exec/ | exec プラグイン
-|       fifo/ | fifo プラグイン (WeeChat にコマンドを送信する FIFO パイプ)
-|       fset/ | fset (高速設定) プラグイン
-|       guile/ | guile (scheme) スクリプト用 API
-|       irc/ | IRC (Internet Relay Chat) プラグイン
-|       javascript/ | javascript スクリプト用 API
-|       logger/ | logger プラグイン (表示されたメッセージをファイルに書き込む)
-|       lua/ | lua スクリプト用 API
-|       perl/ | perl スクリプト用 API
-|       php/ | php スクリプト用 API
-|       python/ | python スクリプト用 API
-|       relay/ | relay プラグイン (irc プロキシ + リモートインターフェイス用の中継)
-|       ruby/ | ruby スクリプト用 API
-|       script/ | スクリプトマネージャ
-|       tcl/ | tcl スクリプト用 API
-|       trigger/ | trigger プラグイン
-|       xfer/ | xfer (IRC DCC ファイル/チャット)
-| tests/ | テスト
-|    scripts/ | スクリプト API テスト
-|       python/ | スクリプト API テストを生成、実行する Python スクリプト
-|    unit/ | 単体テスト
-|       core/ | コア関数の単体テスト
-| doc/ | 文書
-| po/ | 翻訳ファイル (gettext)
-| debian/ | Debian パッケージ用
+| ディレクトリ | 説明
+| src/ | ソースコードのルートディレクトリ
+|    core/ | コア関数: エントリポイント、内部構造体
+|    gui/ | バッファ、ウィンドウ、... を操作する関数 (全てのインターフェイスで使う)
+|       curses/ | curses インターフェイス
+// TRANSLATION MISSING
+|          headless/ | Headless mode (no interface).
+|          normal/ | curses インターフェイス
+|    plugins/ | プラグインとスクリプト向け API
+|       alias/ | alias プラグイン
+|       aspell/ | aspell プラグイン
+|       buflist/ | buflist プラグイン
+|       charset/ | charset プラグイン
+|       exec/ | exec プラグイン
+|       fifo/ | fifo プラグイン (WeeChat にコマンドを送信する FIFO パイプ)
+|       fset/ | fset (高速設定) プラグイン
+|       guile/ | guile (scheme) スクリプト用 API
+|       irc/ | IRC (Internet Relay Chat) プラグイン
+|       javascript/ | javascript スクリプト用 API
+|       logger/ | logger プラグイン (表示されたメッセージをファイルに書き込む)
+|       lua/ | lua スクリプト用 API
+|       perl/ | perl スクリプト用 API
+|       php/ | php スクリプト用 API
+|       python/ | python スクリプト用 API
+|       relay/ | relay プラグイン (irc プロキシ + リモートインターフェイス用の中継)
+|       ruby/ | ruby スクリプト用 API
+|       script/ | スクリプトマネージャ
+|       tcl/ | tcl スクリプト用 API
+|       trigger/ | trigger プラグイン
+|       xfer/ | xfer (IRC DCC ファイル/チャット)
+| tests/ | テスト
+|    scripts/ | スクリプト API テスト
+|       python/ | スクリプト API テストを生成、実行する Python スクリプト
+|    unit/ | 単体テスト
+|       core/ | コア関数の単体テスト
+| doc/ | 文書
+| po/ | 翻訳ファイル (gettext)
+| debian/ | Debian パッケージ用
|===
[[sources]]
@@ -174,7 +177,16 @@ WeeChat "core" は以下のディレクトリに配置されています:
|       gui-curses-mouse.c | マウス
|       gui-curses-term.c | 端末についての関数
|       gui-curses-window.c | ウィンドウ
-|       main.c | エントリポイント
+// TRANSLATION MISSING
+|       headless/ | Headless mode (no interface).
+// TRANSLATION MISSING
+|          main.c | Entry point for headless mode.
+// TRANSLATION MISSING
+|          ncurses-fake.c | Fake ncurses library.
+// TRANSLATION MISSING
+|       normal/ | Curses interface.
+// TRANSLATION MISSING
+|          main.c | Entry point for Curses interface.
|===
[[sources_plugins]]
diff --git a/doc/pl/CMakeLists.txt b/doc/pl/CMakeLists.txt
index a3b498122..ec2f6af30 100644
--- a/doc/pl/CMakeLists.txt
+++ b/doc/pl/CMakeLists.txt
@@ -28,8 +28,22 @@ if(ENABLE_MAN)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building weechat.1 (pl)"
)
- add_custom_target(doc-man-pl ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
+ add_custom_target(doc-man-weechat-pl ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat.1 DESTINATION ${MANDIR}/pl/man1)
+
+ # symbolic link weechat-headless.1 -> weechat.1
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1
+ COMMAND ${CMAKE_COMMAND} -E remove -f "weechat-headless.1"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink "weechat.1" "weechat-headless.1"
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat.1.pl.adoc
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmdline_options.pl.adoc
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Creating symbolic link weechat-headless.1 (pl)"
+ )
+ add_custom_target(doc-man-weechat-headless-en ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1 DESTINATION ${MANDIR}/pl/man1)
endif()
if(ENABLE_DOC)
diff --git a/doc/pl/cmdline_options.pl.adoc b/doc/pl/cmdline_options.pl.adoc
index 97347ef0a..d91633110 100644
--- a/doc/pl/cmdline_options.pl.adoc
+++ b/doc/pl/cmdline_options.pl.adoc
@@ -4,6 +4,11 @@
*-c*, *--colors*::
Wyświetla domślne kolory w terminalu.
+// TRANSLATION MISSING
+*--daemon*::
+ Run WeeChat in background, as a daemon (works only with the command
+ *weechat-headless*).
+
*-d*, *--dir* _<ścieżka>_::
Ustawia ścieżkę jako katalog domowy WeeChat (używany dla plików
konfiguracyjnych, logów, wtyczek użytkownika i skryptów), domyślna wartość
diff --git a/doc/pl/weechat.1.pl.adoc b/doc/pl/weechat.1.pl.adoc
index 695fe97bf..3311f1c49 100644
--- a/doc/pl/weechat.1.pl.adoc
+++ b/doc/pl/weechat.1.pl.adoc
@@ -19,12 +19,18 @@ weechat - rozszerzalny klient rozmów
*weechat* [-l|--license]
*weechat* [-v|--version]
+*weechat-headless* [-a|--no-connect] [--daemon] [-d|--dir <path>] [-p|--no-plugin] [-r|--run-command <command>] [-s|--no-script] [--upgrade] [plugin:option...]
+
== OPIS
WeeChat (Wee Enhanced Environment for Chat) to darmowy klient rozmów, szybki
i lekki, przeznaczony dla wielu systemów operacyjnych.
Posiada dużo opcji konfiguracyjnych i dodatkowych wtyczek.
+// TRANSLATION MISSING
+The command *weechat-headless* runs WeeChat in a headless mode (no interface).
+It can be used for tests or to daemonize WeeChat with the option "--daemon".
+
== OPCJE
include::cmdline_options.pl.adoc[]
diff --git a/doc/ru/CMakeLists.txt b/doc/ru/CMakeLists.txt
index 996089600..bd8b5da37 100644
--- a/doc/ru/CMakeLists.txt
+++ b/doc/ru/CMakeLists.txt
@@ -28,8 +28,22 @@ if(ENABLE_MAN)
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Building weechat.1 (ru)"
)
- add_custom_target(doc-man-ru ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
+ add_custom_target(doc-man-weechat-ru ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat.1)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat.1 DESTINATION ${MANDIR}/ru/man1)
+
+ # symbolic link weechat-headless.1 -> weechat.1
+ add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1
+ COMMAND ${CMAKE_COMMAND} -E remove -f "weechat-headless.1"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink "weechat.1" "weechat-headless.1"
+ DEPENDS
+ ${CMAKE_CURRENT_SOURCE_DIR}/weechat.1.ru.adoc
+ ${CMAKE_CURRENT_SOURCE_DIR}/cmdline_options.ru.adoc
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Creating symbolic link weechat-headless.1 (ru)"
+ )
+ add_custom_target(doc-man-weechat-headless-en ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1)
+ install(FILES ${CMAKE_CURRENT_BINARY_DIR}/weechat-headless.1 DESTINATION ${MANDIR}/ru/man1)
endif()
if(ENABLE_DOC)
diff --git a/doc/ru/cmdline_options.ru.adoc b/doc/ru/cmdline_options.ru.adoc
index 36692ce15..d7b4c9bf2 100644
--- a/doc/ru/cmdline_options.ru.adoc
+++ b/doc/ru/cmdline_options.ru.adoc
@@ -4,6 +4,11 @@
*-c*, *--colors*::
Вывести в терминал умолчальные цвета.
+// TRANSLATION MISSING
+*--daemon*::
+ Run WeeChat in background, as a daemon (works only with the command
+ *weechat-headless*).
+
*-d*, *--dir* _<путь>_::
Установить <путь> как домашнюю директорию для WeeChat (используется для
конфигурационных файлов, логов, пользовательских плагинов и скриптов).
diff --git a/doc/ru/weechat.1.ru.adoc b/doc/ru/weechat.1.ru.adoc
index cf8763c0e..51072eb13 100644
--- a/doc/ru/weechat.1.ru.adoc
+++ b/doc/ru/weechat.1.ru.adoc
@@ -20,12 +20,18 @@ weechat - расширяемый чат-клиент
*weechat* [-l|--license]
*weechat* [-v|--version]
+*weechat-headless* [-a|--no-connect] [--daemon] [-d|--dir <path>] [-p|--no-plugin] [-r|--run-command <command>] [-s|--no-script] [--upgrade] [plugin:option...]
+
== ОПИСАНИЕ
WeeChat (Wee Enhanced Environment for Chat) это свободный чат-клиент - быстрый и легкий,
он подходит для большинства операционных систем.
Его легко настроить, кроме того, вы можете расширить его функицонал при помощи скриптов.
+// TRANSLATION MISSING
+The command *weechat-headless* runs WeeChat in a headless mode (no interface).
+It can be used for tests or to daemonize WeeChat with the option "--daemon".
+
== ПАРАМЕТРЫ
include::cmdline_options.ru.adoc[]
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 27665eb1e..4beddca3a 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -55,7 +55,8 @@
./src/gui/curses/gui-curses-main.c
./src/gui/curses/gui-curses-mouse.c
./src/gui/curses/gui-curses-window.c
-./src/gui/curses/main.c
+./src/gui/curses/normal/main.c
+./src/gui/curses/headless/main.c
./src/gui/gui-bar.c
./src/gui/gui-bar.h
./src/gui/gui-bar-item.c
diff --git a/po/cs.po b/po/cs.po
index d7851d5c6..3fb5966db 100644
--- a/po/cs.po
+++ b/po/cs.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 19:09+0100\n"
"PO-Revision-Date: 2018-02-05 21:30+0100\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -173,6 +173,19 @@ msgstr ""
" -v, --version\t\t\t\tzobraz verzi WeeChatu\n"
" plugin:option\t\t\t\tvolba pro plugin (viz: man weechat)\n"
+msgid "Extra options in headless mode:\n"
+msgstr ""
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+
#, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr "Chyba: chybí argument pro volbu \"%s\"\n"
@@ -194,6 +207,9 @@ msgstr "Chyba: domovský adresář (%s) není adresářem\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "Chyba: nemohu vytvořit adresář \"%s\"\n"
+msgid "WeeChat is running in headless mode."
+msgstr ""
+
#, fuzzy
msgid ""
"Welcome to WeeChat!\n"
@@ -4424,6 +4440,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', velikost: %dx%d"
#, c-format
+msgid "Running WeeChat in background..."
+msgstr ""
+
+#, fuzzy, c-format
+msgid "fork error"
+msgstr "chyba"
+
+#, c-format
+msgid "OK"
+msgstr "OK"
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -12069,9 +12097,6 @@ msgstr "poslán"
msgid "received from"
msgstr "obdržen od"
-msgid "OK"
-msgstr "OK"
-
msgid "FAILED"
msgstr "SELHALO"
diff --git a/po/de.po b/po/de.po
index 20fa0a686..3fdcb3c08 100644
--- a/po/de.po
+++ b/po/de.po
@@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 19:09+0100\n"
"PO-Revision-Date: 2018-02-22 20:54+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@@ -182,6 +182,19 @@ msgstr ""
" plugin:option Einstellungen für Erweiterungen (siehe man "
"weechat)\n"
+msgid "Extra options in headless mode:\n"
+msgstr ""
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+
#, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr "Fehler: fehlendes Argument für die Einstellung \"%s\"\n"
@@ -205,6 +218,9 @@ msgstr "Fehler: HOME (%s) ist kein Verzeichnis\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "Fehler: Das Verzeichnis \"%s\" kann nicht anlegt werden\n"
+msgid "WeeChat is running in headless mode."
+msgstr ""
+
msgid ""
"Welcome to WeeChat!\n"
"\n"
@@ -5284,6 +5300,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', Größe: %dx%d"
#, c-format
+msgid "Running WeeChat in background..."
+msgstr ""
+
+#, fuzzy, c-format
+msgid "fork error"
+msgstr "Fehler"
+
+#, c-format
+msgid "OK"
+msgstr "OK"
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -14111,9 +14139,6 @@ msgstr "gesendet an"
msgid "received from"
msgstr "empfangen von"
-msgid "OK"
-msgstr "OK"
-
msgid "FAILED"
msgstr "FEHLGESCHLAGEN"
diff --git a/po/es.po b/po/es.po
index 3843cdf1b..0425b9bf7 100644
--- a/po/es.po
+++ b/po/es.po
@@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 19:09+0100\n"
"PO-Revision-Date: 2018-02-05 21:30+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -184,6 +184,19 @@ msgstr ""
" (ver la documentación del plugin para más información\n"
" sobre posibles opciones)\n"
+msgid "Extra options in headless mode:\n"
+msgstr ""
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+
#, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr "Error: falta un argumento para la opción \"%s\"\n"
@@ -206,6 +219,9 @@ msgstr "Error: home (%s) no es un directorio\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "Error: no es posible crear el directorio \"%s\"\n"
+msgid "WeeChat is running in headless mode."
+msgstr ""
+
msgid ""
"Welcome to WeeChat!\n"
"\n"
@@ -4617,6 +4633,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', tamaño: %dx%d"
#, c-format
+msgid "Running WeeChat in background..."
+msgstr ""
+
+#, fuzzy, c-format
+msgid "fork error"
+msgstr "error"
+
+#, c-format
+msgid "OK"
+msgstr "OK"
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -12342,9 +12370,6 @@ msgstr "enviado a"
msgid "received from"
msgstr "recibido de"
-msgid "OK"
-msgstr "OK"
-
msgid "FAILED"
msgstr "FALLÓ"
diff --git a/po/fr.po b/po/fr.po
index 585c8f982..f944efb51 100644
--- a/po/fr.po
+++ b/po/fr.po
@@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
-"PO-Revision-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 12:03+0100\n"
+"PO-Revision-Date: 2018-03-10 12:06+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@@ -173,6 +173,23 @@ msgstr ""
" -v, --version afficher la version de WeeChat\n"
" extension:option option pour une extension (voir man weechat)\n"
+msgid "Extra options in headless mode:\n"
+msgstr "Options supplémentaires en mode sans interface (« headless ») :\n"
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+" --daemon lancer WeeChat comme un « daemon » (fork, nouveau "
+"groupe pour le processus, fermeture des descripteurs de fichiers);\n"
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+" (par défaut en mode sans interface WeeChat est "
+"bloquant et ne tourne pas en tâche de fond)\n"
+
#, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr "Erreur : paramètre manquant pour l'option \"%s\"\n"
@@ -196,6 +213,9 @@ msgstr "Erreur : la base (%s) n'est pas un répertoire\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "Erreur : impossible de créer le répertoire \"%s\"\n"
+msgid "WeeChat is running in headless mode."
+msgstr "WeeChat tourne sans interface (« headless »)."
+
msgid ""
"Welcome to WeeChat!\n"
"\n"
@@ -5160,6 +5180,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', taille : %dx%d"
#, c-format
+msgid "Running WeeChat in background..."
+msgstr "Lancement de WeeChat en tâche de fond..."
+
+#, c-format
+msgid "fork error"
+msgstr "erreur de fork"
+
+#, c-format
+msgid "OK"
+msgstr "OK"
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -13819,9 +13851,6 @@ msgstr "envoyé à"
msgid "received from"
msgstr "reçu de"
-msgid "OK"
-msgstr "OK"
-
msgid "FAILED"
msgstr "ÉCHOUÉ"
diff --git a/po/hu.po b/po/hu.po
index e665b5870..1b6d42d6d 100644
--- a/po/hu.po
+++ b/po/hu.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 19:09+0100\n"
"PO-Revision-Date: 2018-01-06 13:50+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -177,6 +177,19 @@ msgstr ""
" -v, --version WeeChat verziójának mutatása\n"
" -w, --weechat-commands WeeChat parancsok mutatása\n"
+msgid "Extra options in headless mode:\n"
+msgstr ""
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+
#, fuzzy, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr "%s hiányzó argumentum a(z) \"%s\" opciónak\n"
@@ -200,6 +213,9 @@ msgstr ""
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s nem sikerült a \"%s\" könyvtárat létrehozni\n"
+msgid "WeeChat is running in headless mode."
+msgstr ""
+
msgid ""
"Welcome to WeeChat!\n"
"\n"
@@ -3991,6 +4007,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr ""
#, c-format
+msgid "Running WeeChat in background..."
+msgstr ""
+
+#, fuzzy, c-format
+msgid "fork error"
+msgstr "%sSzerver: %s%s\n"
+
+#, c-format
+msgid "OK"
+msgstr "Rendben"
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -11365,9 +11393,6 @@ msgstr " fogadó fél: "
msgid "received from"
msgstr " küldő fél: "
-msgid "OK"
-msgstr "Rendben"
-
msgid "FAILED"
msgstr "SIKERTELEN"
diff --git a/po/it.po b/po/it.po
index d1973c1de..9a408633e 100644
--- a/po/it.po
+++ b/po/it.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 19:09+0100\n"
"PO-Revision-Date: 2018-02-05 21:30+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -176,6 +176,19 @@ msgstr ""
" -v. --version mostra la versione di WeeChat\n"
" plugin:opzione opzione per il plugin (consultare man weechat)\n"
+msgid "Extra options in headless mode:\n"
+msgstr ""
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+
#, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr "Errore: argomento mancante per l'opzione \"%s\"\n"
@@ -198,6 +211,9 @@ msgstr "Errore: home (%s) non è una directory\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "Errore: impossibile creare la directory \"%s\"\n"
+msgid "WeeChat is running in headless mode."
+msgstr ""
+
msgid ""
"Welcome to WeeChat!\n"
"\n"
@@ -4747,6 +4763,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', dimensione %dx%d"
#, c-format
+msgid "Running WeeChat in background..."
+msgstr ""
+
+#, fuzzy, c-format
+msgid "fork error"
+msgstr "errore"
+
+#, c-format
+msgid "OK"
+msgstr "OK"
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -12561,9 +12589,6 @@ msgstr "inviato a"
msgid "received from"
msgstr "ricevuto da"
-msgid "OK"
-msgstr "OK"
-
msgid "FAILED"
msgstr "FALLITO"
diff --git a/po/ja.po b/po/ja.po
index 87f9f5002..b3d6fd22c 100644
--- a/po/ja.po
+++ b/po/ja.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 19:09+0100\n"
"PO-Revision-Date: 2018-03-06 09:00+0900\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@@ -171,6 +171,19 @@ msgstr ""
" plugin:option プラグイン用オプション (man weechat を参照してくだ"
"さい)\n"
+msgid "Extra options in headless mode:\n"
+msgstr ""
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+
#, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr "エラー: \"%s\" オプションの引数がありません\n"
@@ -194,6 +207,9 @@ msgstr "エラー: ホーム (%s) はディレクトリではありません\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "エラー: ディレクトリ \"%s\" の作成に失敗しました\n"
+msgid "WeeChat is running in headless mode."
+msgstr ""
+
msgid ""
"Welcome to WeeChat!\n"
"\n"
@@ -4929,6 +4945,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s'、サイズ: %dx%d"
#, c-format
+msgid "Running WeeChat in background..."
+msgstr ""
+
+#, fuzzy, c-format
+msgid "fork error"
+msgstr "エラー"
+
+#, c-format
+msgid "OK"
+msgstr "成功"
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -13297,9 +13325,6 @@ msgstr "送信先"
msgid "received from"
msgstr "受信元"
-msgid "OK"
-msgstr "成功"
-
msgid "FAILED"
msgstr "失敗"
diff --git a/po/pl.po b/po/pl.po
index 27905e8a0..02d4e0d74 100644
--- a/po/pl.po
+++ b/po/pl.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 19:09+0100\n"
"PO-Revision-Date: 2018-02-05 21:30+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -173,6 +173,19 @@ msgstr ""
" -v, --version pokaż wersję WeeChat\n"
" wtyczka:opcje opcje dla wtyczki (zobacz man weechat)\n"
+msgid "Extra options in headless mode:\n"
+msgstr ""
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+
#, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr "Błąd: brak argumentu dla opcji \"%s\"\n"
@@ -195,6 +208,9 @@ msgstr "Błąd: %s nie jest katalogiem\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "Błąd: nie można utworzyć katalogu \"%s\"\n"
+msgid "WeeChat is running in headless mode."
+msgstr ""
+
msgid ""
"Welcome to WeeChat!\n"
"\n"
@@ -5041,6 +5057,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', rozmiar: %dx%d"
#, c-format
+msgid "Running WeeChat in background..."
+msgstr ""
+
+#, fuzzy, c-format
+msgid "fork error"
+msgstr "błąd"
+
+#, c-format
+msgid "OK"
+msgstr "OK"
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -10616,8 +10644,8 @@ msgid ""
"%s%s: invalid fingerprint for server \"%s\", it must contain only "
"hexadecimal digits (0-9, a-f)"
msgstr ""
-"%s%s: niepoprawny skrót dla serwera \"%s\", może on zawierać tylko "
-"znaki heksadecymalne (0-9, a-f)"
+"%s%s: niepoprawny skrót dla serwera \"%s\", może on zawierać tylko znaki "
+"heksadecymalne (0-9, a-f)"
#, c-format
msgid "%s%s: error when allocating new server"
@@ -13521,9 +13549,6 @@ msgstr "wysłano do"
msgid "received from"
msgstr "otrzymano od"
-msgid "OK"
-msgstr "OK"
-
msgid "FAILED"
msgstr "NIEUDANY"
diff --git a/po/pt.po b/po/pt.po
index 94a0a1887..a9de3327d 100644
--- a/po/pt.po
+++ b/po/pt.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 19:09+0100\n"
"PO-Revision-Date: 2018-02-05 21:30+0100\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@@ -174,6 +174,19 @@ msgstr ""
" -v, --version mostrar a versão do Weechat\n"
" plugin:opção opção de um plugin (ver man weechat)\n"
+msgid "Extra options in headless mode:\n"
+msgstr ""
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+
#, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr "Erro: falta o argumento da opção \"%s\"\n"
@@ -196,6 +209,9 @@ msgstr "Erro: a base (%s) não é um diretório\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "Erro: não é possível criar o diretório \"%s\"\n"
+msgid "WeeChat is running in headless mode."
+msgstr ""
+
#, fuzzy
msgid ""
"Welcome to WeeChat!\n"
@@ -5012,6 +5028,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', tamanho: %dx%d"
#, c-format
+msgid "Running WeeChat in background..."
+msgstr ""
+
+#, fuzzy, c-format
+msgid "fork error"
+msgstr "erro"
+
+#, c-format
+msgid "OK"
+msgstr "OK"
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -13204,9 +13232,6 @@ msgstr "enviado para"
msgid "received from"
msgstr "recebido de"
-msgid "OK"
-msgstr "OK"
-
msgid "FAILED"
msgstr "FALHOU"
diff --git a/po/pt_BR.po b/po/pt_BR.po
index e8834f4c7..218b45813 100644
--- a/po/pt_BR.po
+++ b/po/pt_BR.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 19:09+0100\n"
"PO-Revision-Date: 2018-02-05 21:30+0100\n"
"Last-Translator: Eduardo Elias <camponez@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -208,6 +208,19 @@ msgstr ""
" -v, --version mostra a versão do WeeChat\n"
" plugin:option opção para o plugin (veja o manual do WeeChat)\n"
+msgid "Extra options in headless mode:\n"
+msgstr ""
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+
#, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr "Erro: faltando argumento para opção \"%s\"\n"
@@ -230,6 +243,9 @@ msgstr "Erro: (%s) não é um diretório\n"
msgid "Error: cannot create directory \"%s\"\n"
msgstr "Erro: não foi possível criar o diretório \"%s\"\n"
+msgid "WeeChat is running in headless mode."
+msgstr ""
+
msgid ""
"Welcome to WeeChat!\n"
"\n"
@@ -4599,6 +4615,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr " TERM='%s', tamanho: %dx%d"
#, c-format
+msgid "Running WeeChat in background..."
+msgstr ""
+
+#, fuzzy, c-format
+msgid "fork error"
+msgstr "%s%s: erro: %s"
+
+#, c-format
+msgid "OK"
+msgstr "OK"
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -11818,9 +11846,6 @@ msgstr "enviado para"
msgid "received from"
msgstr "recebido de"
-msgid "OK"
-msgstr "OK"
-
msgid "FAILED"
msgstr "FALHOU"
diff --git a/po/ru.po b/po/ru.po
index 4bb631ce4..4e49535e4 100644
--- a/po/ru.po
+++ b/po/ru.po
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 19:09+0100\n"
"PO-Revision-Date: 2018-01-06 13:50+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -186,6 +186,19 @@ msgstr ""
" -v, --version отобразить версию WeeChat\n"
" -w, --weechat-commands отобразить команды WeeChat\n"
+msgid "Extra options in headless mode:\n"
+msgstr ""
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+
#, fuzzy, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr "%s нет аргумента для параметра \"%s\"\n"
@@ -209,6 +222,9 @@ msgstr "%s домашний каталог (%s) не является дирек
msgid "Error: cannot create directory \"%s\"\n"
msgstr "%s не могу создать директорию \"%s\"\n"
+msgid "WeeChat is running in headless mode."
+msgstr ""
+
msgid ""
"Welcome to WeeChat!\n"
"\n"
@@ -4024,6 +4040,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr ""
#, c-format
+msgid "Running WeeChat in background..."
+msgstr ""
+
+#, fuzzy, c-format
+msgid "fork error"
+msgstr "%sСервер: %s%s\n"
+
+#, c-format
+msgid "OK"
+msgstr "OK"
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -11400,9 +11428,6 @@ msgstr " отправлен "
msgid "received from"
msgstr " получен от "
-msgid "OK"
-msgstr "OK"
-
msgid "FAILED"
msgstr "НЕУДАЧА"
diff --git a/po/srcfiles.cmake b/po/srcfiles.cmake
index 14591cc76..d7cae9a4b 100644
--- a/po/srcfiles.cmake
+++ b/po/srcfiles.cmake
@@ -56,7 +56,8 @@ SET(WEECHAT_SOURCES
./src/gui/curses/gui-curses-main.c
./src/gui/curses/gui-curses-mouse.c
./src/gui/curses/gui-curses-window.c
-./src/gui/curses/main.c
+./src/gui/curses/normal/main.c
+./src/gui/curses/headless/main.c
./src/gui/gui-bar.c
./src/gui/gui-bar.h
./src/gui/gui-bar-item.c
diff --git a/po/tr.po b/po/tr.po
index 8d1b983c5..5361de74a 100644
--- a/po/tr.po
+++ b/po/tr.po
@@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 19:09+0100\n"
"PO-Revision-Date: 2017-06-26 23:33+0200\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -148,6 +148,19 @@ msgid ""
" plugin:option option for plugin (see man weechat)\n"
msgstr ""
+msgid "Extra options in headless mode:\n"
+msgstr ""
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+
#, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr ""
@@ -169,6 +182,9 @@ msgstr ""
msgid "Error: cannot create directory \"%s\"\n"
msgstr "Hata: \"%s\" dizini oluşturulamaz\n"
+msgid "WeeChat is running in headless mode."
+msgstr ""
+
msgid ""
"Welcome to WeeChat!\n"
"\n"
@@ -3628,6 +3644,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr ""
#, c-format
+msgid "Running WeeChat in background..."
+msgstr ""
+
+#, fuzzy, c-format
+msgid "fork error"
+msgstr "hata"
+
+#, c-format
+msgid "OK"
+msgstr "TAMAM"
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -10386,9 +10414,6 @@ msgstr ""
msgid "received from"
msgstr ""
-msgid "OK"
-msgstr "TAMAM"
-
msgid "FAILED"
msgstr "BAŞARISIZ"
diff --git a/po/weechat.pot b/po/weechat.pot
index 33e8c626e..a198ed66f 100644
--- a/po/weechat.pot
+++ b/po/weechat.pot
@@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
-"POT-Creation-Date: 2018-02-19 21:27+0100\n"
+"POT-Creation-Date: 2018-03-10 19:09+0100\n"
"PO-Revision-Date: 2014-08-16 10:27+0200\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@@ -146,6 +146,19 @@ msgid ""
" plugin:option option for plugin (see man weechat)\n"
msgstr ""
+msgid "Extra options in headless mode:\n"
+msgstr ""
+
+msgid ""
+" --daemon run WeeChat as a daemon (fork, new process group, "
+"file descriptors closed);\n"
+msgstr ""
+
+msgid ""
+" (by default in headless mode WeeChat is blocking "
+"and does not run in background)\n"
+msgstr ""
+
#, c-format
msgid "Error: missing argument for \"%s\" option\n"
msgstr ""
@@ -167,6 +180,9 @@ msgstr ""
msgid "Error: cannot create directory \"%s\"\n"
msgstr ""
+msgid "WeeChat is running in headless mode."
+msgstr ""
+
msgid ""
"Welcome to WeeChat!\n"
"\n"
@@ -3618,6 +3634,18 @@ msgid " TERM='%s', size: %dx%d"
msgstr ""
#, c-format
+msgid "Running WeeChat in background..."
+msgstr ""
+
+#, c-format
+msgid "fork error"
+msgstr ""
+
+#, c-format
+msgid "OK"
+msgstr ""
+
+#, c-format
msgid ""
"%sUnable to change bar type: you must delete bar and create another to do "
"that"
@@ -10240,9 +10268,6 @@ msgstr ""
msgid "received from"
msgstr ""
-msgid "OK"
-msgstr ""
-
msgid "FAILED"
msgstr ""
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt
index 2c840d003..8d84160d5 100644
--- a/src/core/CMakeLists.txt
+++ b/src/core/CMakeLists.txt
@@ -20,32 +20,33 @@
#
set(LIB_CORE_SRC
-weechat.c weechat.h
-wee-arraylist.c wee-arraylist.h
-wee-backtrace.c wee-backtrace.h
-wee-command.c wee-command.h
-wee-completion.c wee-completion.h
-wee-config.c wee-config.h
-wee-config-file.c wee-config-file.h
-wee-debug.c wee-debug.h
-wee-eval.c wee-eval.h
-wee-hashtable.c wee-hashtable.h
-wee-hdata.c wee-hdata.h
-wee-hook.c wee-hook.h
-wee-infolist.c wee-infolist.h
-wee-input.c wee-input.h
-wee-list.c wee-list.h
-wee-log.c wee-log.h
-wee-network.c wee-network.h
-wee-proxy.c wee-proxy.h
-wee-secure.c wee-secure.h
-wee-string.c wee-string.h
-wee-upgrade.c wee-upgrade.h
-wee-upgrade-file.c wee-upgrade-file.h
-wee-url.c wee-url.h
-wee-utf8.c wee-utf8.h
-wee-util.c wee-util.h
-wee-version.c wee-version.h)
+ weechat.c weechat.h
+ wee-arraylist.c wee-arraylist.h
+ wee-backtrace.c wee-backtrace.h
+ wee-command.c wee-command.h
+ wee-completion.c wee-completion.h
+ wee-config.c wee-config.h
+ wee-config-file.c wee-config-file.h
+ wee-debug.c wee-debug.h
+ wee-eval.c wee-eval.h
+ wee-hashtable.c wee-hashtable.h
+ wee-hdata.c wee-hdata.h
+ wee-hook.c wee-hook.h
+ wee-infolist.c wee-infolist.h
+ wee-input.c wee-input.h
+ wee-list.c wee-list.h
+ wee-log.c wee-log.h
+ wee-network.c wee-network.h
+ wee-proxy.c wee-proxy.h
+ wee-secure.c wee-secure.h
+ wee-string.c wee-string.h
+ wee-upgrade.c wee-upgrade.h
+ wee-upgrade-file.c wee-upgrade-file.h
+ wee-url.c wee-url.h
+ wee-utf8.c wee-utf8.h
+ wee-util.c wee-util.h
+ wee-version.c wee-version.h
+)
# Check for flock support
include(CheckSymbolExists)
diff --git a/src/core/weechat.c b/src/core/weechat.c
index 56347e956..7287b7fe9 100644
--- a/src/core/weechat.c
+++ b/src/core/weechat.c
@@ -79,6 +79,7 @@
#include "../plugins/plugin-api.h"
+int weechat_headless = 0; /* 1 if running headless (no GUI) */
int weechat_debug_core = 0; /* debug level for core */
char *weechat_argv0 = NULL; /* WeeChat binary file name (argv[0])*/
int weechat_upgrading = 0; /* =1 if WeeChat is upgrading */
@@ -160,6 +161,21 @@ weechat_display_usage ()
" -v, --version display WeeChat version\n"
" plugin:option option for plugin (see man weechat)\n"));
string_fprintf (stdout, "\n");
+
+ /* extra options in headless mode */
+ if (weechat_headless)
+ {
+ string_fprintf (stdout, _("Extra options in headless mode:\n"));
+ string_fprintf (
+ stdout,
+ _(" --daemon run WeeChat as a daemon (fork, "
+ "new process group, file descriptors closed);\n"));
+ string_fprintf (
+ stdout,
+ _(" (by default in headless mode "
+ "WeeChat is blocking and does not run in background)\n"));
+ string_fprintf (stdout, "\n");
+ }
}
/*
@@ -403,6 +419,12 @@ weechat_create_home_dir ()
void
weechat_startup_message ()
{
+ if (weechat_headless)
+ {
+ string_fprintf (stdout, _("WeeChat is running in headless mode."));
+ string_fprintf (stdout, "\n");
+ }
+
if (CONFIG_BOOLEAN(config_startup_display_logo))
{
gui_chat_printf (
@@ -600,15 +622,12 @@ weechat_shutdown (int return_code, int crash)
}
/*
- * Initializes WeeChat.
+ * Initializes gettext.
*/
void
-weechat_init (int argc, char *argv[], void (*gui_init_cb)())
+weechat_init_gettext ()
{
- weechat_first_start_time = time (NULL); /* initialize start time */
- gettimeofday (&weechat_current_start_timeval, NULL);
-
weechat_locale_ok = (setlocale (LC_ALL, "") != NULL); /* init gettext */
#ifdef ENABLE_NLS
bindtextdomain (PACKAGE, LOCALEDIR);
@@ -622,6 +641,17 @@ weechat_init (int argc, char *argv[], void (*gui_init_cb)())
weechat_local_charset = strdup ("");
#endif /* HAVE_LANGINFO_CODESET */
utf8_init ();
+}
+
+/*
+ * Initializes WeeChat.
+ */
+
+void
+weechat_init (int argc, char *argv[], void (*gui_init_cb)())
+{
+ weechat_first_start_time = time (NULL); /* initialize start time */
+ gettimeofday (&weechat_current_start_timeval, NULL);
/* catch signals */
util_catch_signal (SIGINT, SIG_IGN); /* signal ignored */
diff --git a/src/core/weechat.h b/src/core/weechat.h
index 0c061df25..66c82c1d7 100644
--- a/src/core/weechat.h
+++ b/src/core/weechat.h
@@ -97,6 +97,7 @@
#define WEECHAT_EXTRA_LIBDIR "WEECHAT_EXTRA_LIBDIR"
/* global variables and functions */
+extern int weechat_headless;
extern int weechat_debug_core;
extern char *weechat_argv0;
extern int weechat_upgrading;
@@ -115,6 +116,7 @@ extern char *weechat_startup_commands;
extern void weechat_term_check ();
extern void weechat_shutdown (int return_code, int crash);
+extern void weechat_init_gettext ();
extern void weechat_init (int argc, char *argv[], void (*gui_init_cb)());
extern void weechat_end (void (*gui_end_cb)(int clean_exit));
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 86f48af7c..d9d85cec5 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -18,32 +18,31 @@
#
set(LIB_GUI_COMMON_SRC
-gui-bar.c gui-bar.h
-gui-bar-item.c gui-bar-item.h
-gui-bar-window.c gui-bar-window.h
-gui-buffer.c gui-buffer.h
-gui-chat.c gui-chat.h
-gui-color.c gui-color.h
-gui-completion.c gui-completion.h
-gui-cursor.c gui-cursor.h
-gui-filter.c gui-filter.h
-gui-focus.c gui-focus.h
-gui-history.c gui-history.h
-gui-hotlist.c gui-hotlist.h
-gui-input.c gui-input.h
-gui-key.c gui-key.h
-gui-layout.c gui-layout.h
-gui-line.c gui-line.h
-gui-main.h
-gui-mouse.c gui-mouse.h
-gui-nick.c gui-nick.h
-gui-nicklist.c gui-nicklist.h
-gui-window.c gui-window.h)
+ gui-bar.c gui-bar.h
+ gui-bar-item.c gui-bar-item.h
+ gui-bar-window.c gui-bar-window.h
+ gui-buffer.c gui-buffer.h
+ gui-chat.c gui-chat.h
+ gui-color.c gui-color.h
+ gui-completion.c gui-completion.h
+ gui-cursor.c gui-cursor.h
+ gui-filter.c gui-filter.h
+ gui-focus.c gui-focus.h
+ gui-history.c gui-history.h
+ gui-hotlist.c gui-hotlist.h
+ gui-input.c gui-input.h
+ gui-key.c gui-key.h
+ gui-layout.c gui-layout.h
+ gui-line.c gui-line.h
+ gui-main.h
+ gui-mouse.c gui-mouse.h
+ gui-nick.c gui-nick.h
+ gui-nicklist.c gui-nicklist.h
+ gui-window.c gui-window.h
+)
include_directories(${CMAKE_BINARY_DIR})
add_library(weechat_gui_common STATIC ${LIB_GUI_COMMON_SRC})
list(APPEND STATIC_LIBS weechat_gui_common)
-if(ENABLE_NCURSES)
- subdirs(curses)
-endif()
+subdirs(curses)
diff --git a/src/gui/Makefile.am b/src/gui/Makefile.am
index 194525938..3709383b3 100644
--- a/src/gui/Makefile.am
+++ b/src/gui/Makefile.am
@@ -63,10 +63,6 @@ lib_weechat_gui_common_a_SOURCES = gui-bar.c \
gui-window.c \
gui-window.h
-if GUI_NCURSES
-curses_dir=curses
-endif
-
-SUBDIRS = . $(curses_dir)
+SUBDIRS = . curses
EXTRA_DIST = CMakeLists.txt
diff --git a/src/gui/curses/CMakeLists.txt b/src/gui/curses/CMakeLists.txt
index b65b72ecd..b2ef51417 100644
--- a/src/gui/curses/CMakeLists.txt
+++ b/src/gui/curses/CMakeLists.txt
@@ -19,40 +19,8 @@
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
#
-set(LIB_GUI_CURSES_SRC
-gui-curses.h
-gui-curses-bar-window.c
-gui-curses-chat.c
-gui-curses-color.c
-gui-curses-key.c
-gui-curses-main.c
-gui-curses-mouse.c
-gui-curses-term.c
-gui-curses-window.c)
-
-set(WEECHAT_CURSES_MAIN_SRC
-main.c)
-
-set(EXECUTABLE weechat)
-
-find_package(Ncurses)
-if(NCURSES_FOUND)
- check_include_files(ncursesw/ncurses.h NCURSESW_HEADERS)
- if(NCURSESW_HEADERS)
- add_definitions(-DHAVE_NCURSESW_CURSES_H)
- else()
- check_include_files(ncurses.h NCURSES_HEADERS)
- if(NCURSES_HEADERS)
- add_definitions(-DHAVE_NCURSES_H)
- endif()
- endif()
- list(APPEND EXTRA_LIBS ${NCURSES_LIBRARY})
-endif()
-
-if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
- if(HAVE_BACKTRACE)
- list(APPEND EXTRA_LIBS "execinfo")
- endif()
+if(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD" AND HAVE_BACKTRACE)
+ list(APPEND EXTRA_LIBS "execinfo")
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
@@ -78,34 +46,10 @@ if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
list(APPEND EXTRA_LIBS "resolv")
endif()
-include_directories(.. ../../core ../../plugins ${NCURSES_INCLUDE_PATH})
-
-add_library(weechat_gui_curses STATIC ${LIB_GUI_CURSES_SRC})
-
-add_executable(${EXECUTABLE} ${WEECHAT_CURSES_MAIN_SRC})
-
-add_dependencies(${EXECUTABLE} weechat_gui_curses)
-
-# Due to circular references, we must link two times with libweechat_core.a and libweechat_gui_common.a
-target_link_libraries(${EXECUTABLE} ${STATIC_LIBS} weechat_gui_curses ${EXTRA_LIBS} ${STATIC_LIBS})
-
-# Create a symbolic link weechat-curses -> weechat
-# This link is created for compatibility with old versions on /upgrade.
-# It may be removed in future.
-add_custom_command(
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}-curses${CMAKE_EXECUTABLE_SUFFIX}
- COMMAND ${CMAKE_COMMAND} -E remove -f "weechat-curses${CMAKE_EXECUTABLE_SUFFIX}"
- COMMAND ${CMAKE_COMMAND} -E create_symlink "weechat${CMAKE_EXECUTABLE_SUFFIX}" "weechat-curses${CMAKE_EXECUTABLE_SUFFIX}"
- DEPENDS ${EXECUTABLE}
- WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
- COMMENT "Creating symbolic link ${EXECUTABLE}-curses${CMAKE_EXECUTABLE_SUFFIX}"
- )
-add_custom_target(${EXECUTABLE}-curses${CMAKE_EXECUTABLE_SUFFIX} ALL
- DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}-curses${CMAKE_EXECUTABLE_SUFFIX}
-)
-add_dependencies(${EXECUTABLE}-curses${CMAKE_EXECUTABLE_SUFFIX} ${EXECUTABLE})
-list(APPEND CMAKE_INSTALL_MANIFEST_FILES "${CMAKE_INSTALL_PREFIX}/bin/weechat-curses${CMAKE_EXECUTABLE_SUFFIX}")
+if(ENABLE_NCURSES)
+ subdirs(normal)
+endif()
-# Install executable and symbolic link
-install(TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin)
-install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}-curses${CMAKE_EXECUTABLE_SUFFIX} DESTINATION bin)
+if(ENABLE_HEADLESS)
+ subdirs(headless)
+endif()
diff --git a/src/gui/curses/Makefile.am b/src/gui/curses/Makefile.am
index b3fde2552..88a8113fe 100644
--- a/src/gui/curses/Makefile.am
+++ b/src/gui/curses/Makefile.am
@@ -17,46 +17,14 @@
# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
#
-AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" $(NCURSES_CFLAGS)
+if GUI_NCURSES
+normal_dir=normal
+endif
-noinst_LIBRARIES = lib_weechat_gui_curses.a
+if HEADLESS
+headless_dir=headless
+endif
-lib_weechat_gui_curses_a_SOURCES = gui-curses-bar-window.c \
- gui-curses-chat.c \
- gui-curses-color.c \
- gui-curses-key.c \
- gui-curses-main.c \
- gui-curses-mouse.c \
- gui-curses-term.c \
- gui-curses-window.c \
- gui-curses.h
-
-bin_PROGRAMS = weechat
-
-# Due to circular references, we must link two times with libweechat_core.a
-# (and with two different path/names to be kept by linker)
-weechat_LDADD = ./../../core/lib_weechat_core.a \
- ../../plugins/lib_weechat_plugins.a \
- ../lib_weechat_gui_common.a \
- lib_weechat_gui_curses.a \
- ../../core/lib_weechat_core.a \
- $(PLUGINS_LFLAGS) \
- $(NCURSES_LFLAGS) \
- $(GCRYPT_LFLAGS) \
- $(GNUTLS_LFLAGS) \
- $(CURL_LFLAGS) \
- -lm
-
-weechat_SOURCES = main.c
+SUBDIRS = . $(normal_dir) $(headless_dir)
EXTRA_DIST = CMakeLists.txt
-
-# Create a symbolic link weechat-curses -> weechat
-# This link is created for compatibility with old versions on /upgrade.
-# It may be removed in future.
-install-exec-hook:
- (cd '$(DESTDIR)$(bindir)' && rm -f weechat-curses$(EXEEXT) && $(LN_S) weechat weechat-curses$(EXEEXT))
-
-# Remove symbolic link on uninstall
-uninstall-hook:
- (cd '$(DESTDIR)$(bindir)' && rm -f weechat-curses$(EXEEXT))
diff --git a/src/gui/curses/gui-curses-main.c b/src/gui/curses/gui-curses-main.c
index b319c11b0..faf358bdf 100644
--- a/src/gui/curses/gui-curses-main.c
+++ b/src/gui/curses/gui-curses-main.c
@@ -78,12 +78,20 @@ gui_main_get_password (const char **prompt, char *password, int size)
{
int line, i, ch;
+ memset (password, '\0', size);
+
+ if (weechat_headless)
+ {
+ password[0] = ' ';
+ return;
+ }
+
initscr ();
cbreak ();
noecho ();
raw ();
- clear();
+ clear ();
line = 0;
@@ -96,7 +104,6 @@ gui_main_get_password (const char **prompt, char *password, int size)
mvaddstr (line, 0, "=> ");
refresh ();
- memset (password, '\0', size);
i = 0;
while (i < size - 1)
{
@@ -432,11 +439,19 @@ gui_main_loop ()
send_signal_sigwinch = 0;
/* catch SIGWINCH signal: redraw screen */
- util_catch_signal (SIGWINCH, &gui_main_signal_sigwinch);
+ if (!weechat_headless)
+ util_catch_signal (SIGWINCH, &gui_main_signal_sigwinch);
/* hook stdin (read keyboard) */
- hook_fd_keyboard = hook_fd (NULL, STDIN_FILENO, 1, 0, 0,
- &gui_key_read_cb, NULL, NULL);
+ if (weechat_headless)
+ {
+ hook_fd_keyboard = NULL;
+ }
+ else
+ {
+ hook_fd_keyboard = hook_fd (NULL, STDIN_FILENO, 1, 0, 0,
+ &gui_key_read_cb, NULL, NULL);
+ }
gui_window_ask_refresh (1);
@@ -486,7 +501,8 @@ gui_main_loop ()
}
/* remove keyboard hook */
- unhook (hook_fd_keyboard);
+ if (hook_fd_keyboard)
+ unhook (hook_fd_keyboard);
}
/*
diff --git a/src/gui/curses/gui-curses.h b/src/gui/curses/gui-curses.h
index ed9df2533..7f7359d29 100644
--- a/src/gui/curses/gui-curses.h
+++ b/src/gui/curses/gui-curses.h
@@ -22,6 +22,9 @@
#include <time.h>
+#ifdef WEECHAT_HEADLESS
+#include "ncurses-fake.h"
+#else
#ifdef HAVE_NCURSESW_CURSES_H
#include <ncursesw/ncurses.h>
#elif HAVE_NCURSES_H
@@ -29,6 +32,7 @@
#else
#include <curses.h>
#endif /* HAVE_NCURSESW_CURSES_H */
+#endif /* WEECHAT_HEADLESS */
struct t_gui_buffer;
struct t_gui_line;
diff --git a/src/gui/curses/headless/CMakeLists.txt b/src/gui/curses/headless/CMakeLists.txt
new file mode 100644
index 000000000..3aa6b4448
--- /dev/null
+++ b/src/gui/curses/headless/CMakeLists.txt
@@ -0,0 +1,57 @@
+#
+# Copyright (C) 2003-2018 Sébastien Helleu <flashcode@flashtux.org>
+#
+# This file is part of WeeChat, the extensible chat client.
+#
+# WeeChat is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# WeeChat is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
+#
+
+add_definitions(-DWEECHAT_HEADLESS)
+
+# fake ncurses lib (for headless mode and tests)
+set(LIB_WEECHAT_NCURSES_FAKE_SRC
+ ncurses-fake.h
+ ncurses-fake.c
+)
+add_library(weechat_ncurses_fake STATIC ${LIB_WEECHAT_NCURSES_FAKE_SRC})
+
+set(LIB_GUI_CURSES_SRC
+ ../gui-curses.h
+ ../gui-curses-bar-window.c
+ ../gui-curses-chat.c
+ ../gui-curses-color.c
+ ../gui-curses-key.c
+ ../gui-curses-main.c
+ ../gui-curses-mouse.c
+ ../gui-curses-term.c
+ ../gui-curses-window.c
+)
+
+include_directories(. .. ../../core ../../plugins)
+
+add_library(weechat_gui_headless STATIC ${LIB_GUI_CURSES_SRC})
+
+set(WEECHAT_CURSES_MAIN_HEADLESS_SRC main.c)
+
+set(EXECUTABLE weechat-headless)
+
+add_executable(${EXECUTABLE} ${WEECHAT_CURSES_MAIN_HEADLESS_SRC})
+
+add_dependencies(${EXECUTABLE} weechat_gui_headless weechat_ncurses_fake)
+
+# Due to circular references, we must link two times with libweechat_core.a and libweechat_gui_common.a
+target_link_libraries(${EXECUTABLE} ${STATIC_LIBS} weechat_gui_headless weechat_ncurses_fake ${EXTRA_LIBS} ${STATIC_LIBS})
+
+# Install executable
+install(TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin)
diff --git a/src/gui/curses/headless/Makefile.am b/src/gui/curses/headless/Makefile.am
new file mode 100644
index 000000000..08c2d164e
--- /dev/null
+++ b/src/gui/curses/headless/Makefile.am
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2003-2018 Sébastien Helleu <flashcode@flashtux.org>
+#
+# This file is part of WeeChat, the extensible chat client.
+#
+# WeeChat is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# WeeChat is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
+#
+
+AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" -DWEECHAT_HEADLESS
+
+noinst_LIBRARIES = lib_weechat_ncurses_fake.a lib_weechat_gui_headless.a
+
+lib_weechat_ncurses_fake_a_SOURCES = ncurses-fake.c \
+ ncurses-fake.h
+
+lib_weechat_gui_headless_a_SOURCES = ../gui-curses-bar-window.c \
+ ../gui-curses-chat.c \
+ ../gui-curses-color.c \
+ ../gui-curses-key.c \
+ ../gui-curses-main.c \
+ ../gui-curses-mouse.c \
+ ../gui-curses-term.c \
+ ../gui-curses-window.c \
+ ../gui-curses.h
+
+bin_PROGRAMS = weechat-headless
+
+# Due to circular references, we must link two times with libweechat_core.a
+# (and with two different path/names to be kept by linker)
+weechat_headless_LDADD = ./../../../core/lib_weechat_core.a \
+ ../../../plugins/lib_weechat_plugins.a \
+ ../../lib_weechat_gui_common.a \
+ lib_weechat_gui_headless.a \
+ lib_weechat_ncurses_fake.a \
+ ../../../core/lib_weechat_core.a \
+ $(PLUGINS_LFLAGS) \
+ $(GCRYPT_LFLAGS) \
+ $(GNUTLS_LFLAGS) \
+ $(CURL_LFLAGS) \
+ -lm
+
+weechat_headless_SOURCES = main.c
+
+EXTRA_DIST = CMakeLists.txt
diff --git a/src/gui/curses/headless/main.c b/src/gui/curses/headless/main.c
new file mode 100644
index 000000000..481177020
--- /dev/null
+++ b/src/gui/curses/headless/main.c
@@ -0,0 +1,125 @@
+/*
+ * main.c - entry point for headless mode (no GUI)
+ *
+ * Copyright (C) 2003-2018 Sébastien Helleu <flashcode@flashtux.org>
+ *
+ * This file is part of WeeChat, the extensible chat client.
+ *
+ * WeeChat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * WeeChat is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include "config.h"
+#endif
+
+#include <stdlib.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <string.h>
+
+#include "../../../core/weechat.h"
+#include "../../gui-main.h"
+#include "../gui-curses.h"
+
+
+/*
+ * Daemonizes the process.
+ */
+
+void
+daemonize ()
+{
+ pid_t pid;
+ int fd, i;
+
+ printf (_("Running WeeChat in background..."));
+ printf (" ");
+
+ pid = fork();
+
+ if (pid < 0)
+ {
+ printf (_("fork error"));
+ printf ("\n");
+ exit (EXIT_FAILURE);
+ }
+
+ if (pid > 0)
+ {
+ /* parent process */
+ printf (_("OK"));
+ printf ("\n");
+ exit (EXIT_SUCCESS);
+ }
+
+ /* child process */
+
+ /* obtain a new process group */
+ setsid ();
+
+ /* close all file descriptors */
+ for (i = getdtablesize(); i >= 0; --i)
+ {
+ close (i);
+ }
+ fd = open ("/dev/null", O_RDWR);
+ dup (fd);
+ dup (fd);
+}
+
+/*
+ * Entry point for WeeChat in headless mode (no GUI).
+ */
+
+int
+main (int argc, char *argv[])
+{
+ int i, daemon;
+
+ weechat_init_gettext ();
+
+ /*
+ * Enable a special "headless" mode, where some things are slightly
+ * different, for example:
+ * - no read of stdin (keyboard/mouse)
+ * - don't catch any terminal related signal
+ */
+ weechat_headless = 1;
+
+ /*
+ * If "--daemon" is received in command line arguments,
+ * daemonize the process.
+ */
+ daemon = 0;
+ for (i = 1; i < argc; i++)
+ {
+ if (strcmp (argv[i], "--daemon") == 0)
+ {
+ daemon = 1;
+ break;
+ }
+ }
+ if (daemon)
+ daemonize ();
+
+ /* init, main loop and end */
+ weechat_init (argc, argv, &gui_main_init);
+ gui_main_loop ();
+ weechat_end (&gui_main_end);
+
+ return EXIT_SUCCESS;
+}
diff --git a/src/gui/curses/headless/ncurses-fake.c b/src/gui/curses/headless/ncurses-fake.c
new file mode 100644
index 000000000..da1e4ac8d
--- /dev/null
+++ b/src/gui/curses/headless/ncurses-fake.c
@@ -0,0 +1,433 @@
+/*
+ * ncurses-fake.c - fake ncurses lib (for headless mode and tests)
+ *
+ * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
+ *
+ * This file is part of WeeChat, the extensible chat client.
+ *
+ * WeeChat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * WeeChat is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include "ncurses-fake.h"
+
+
+/* simulate 80x25 terminal */
+WINDOW _stdscr = { 0, 0, 24, 79, 0, 0 };
+WINDOW *stdscr = &_stdscr;
+chtype acs_map[256];
+
+
+WINDOW *
+initscr ()
+{
+ return stdscr;
+}
+
+int
+endwin ()
+{
+ return OK;
+}
+
+WINDOW *
+newwin (int nlines, int ncols, int begin_y, int begin_x)
+{
+ (void) nlines;
+ (void) ncols;
+ (void) begin_y;
+ (void) begin_x;
+
+ return stdscr;
+}
+
+int
+delwin (WINDOW *win)
+{
+ (void) win;
+
+ return OK;
+}
+
+int
+move (int y, int x)
+{
+ (void) y;
+ (void) x;
+
+ return OK;
+}
+
+int
+wmove (WINDOW *win, int y, int x)
+{
+ (void) win;
+ (void) y;
+ (void) x;
+
+ return OK;
+}
+
+int
+wattr_on (WINDOW *win, attr_t attrs, void *opts)
+{
+ (void) win;
+ (void) attrs;
+ (void) opts;
+
+ return OK;
+}
+
+int
+wattr_off (WINDOW *win, attr_t attrs, void *opts)
+{
+ (void) win;
+ (void) attrs;
+ (void) opts;
+
+ return OK;
+}
+
+int
+wattr_get (WINDOW *win, attr_t *attrs, short *pair, void *opts)
+{
+ (void) win;
+ (void) attrs;
+ (void) pair;
+ (void) opts;
+
+ return OK;
+}
+
+int
+wattr_set (WINDOW *win, attr_t attrs, short pair, void *opts)
+{
+ (void) win;
+ (void) attrs;
+ (void) pair;
+ (void) opts;
+
+ return OK;
+}
+
+int
+wattron (WINDOW *win, int attrs)
+{
+ (void) win;
+ (void) attrs;
+
+ return OK;
+}
+
+int
+wattroff (WINDOW *win, int attrs)
+{
+ (void) win;
+ (void) attrs;
+
+ return OK;
+}
+
+int
+waddstr (WINDOW *win, const char *str)
+{
+ (void) win;
+ (void) str;
+
+ return OK;
+}
+
+int
+waddnstr (WINDOW *win, const char *str, int n)
+{
+ (void) win;
+ (void) str;
+ (void) n;
+
+ return OK;
+}
+
+int
+mvaddstr (int y, int x, const char *str)
+{
+ (void) y;
+ (void) x;
+ (void) str;
+
+ return OK;
+}
+
+int
+mvwaddstr (WINDOW *win, int y, int x, const char *str)
+{
+ (void) win;
+ (void) y;
+ (void) x;
+ (void) str;
+
+ return OK;
+}
+
+int
+wclrtobot (WINDOW *win)
+{
+ (void) win;
+
+ return OK;
+}
+
+int
+refresh ()
+{
+ return OK;
+}
+
+int
+wrefresh (WINDOW *win)
+{
+ (void) win;
+
+ return OK;
+}
+
+int
+wnoutrefresh (WINDOW *win)
+{
+ (void) win;
+
+ return OK;
+}
+
+int
+wclrtoeol (WINDOW *win)
+{
+ (void) win;
+
+ return OK;
+}
+
+int
+mvwprintw (WINDOW *win, int y, int x, const char *fmt, ...)
+{
+ (void) win;
+ (void) y;
+ (void) x;
+ (void) fmt;
+
+ return OK;
+}
+
+int
+init_pair (short pair, short f, short b)
+{
+ (void) pair;
+ (void) f;
+ (void) b;
+
+ return OK;
+}
+
+bool
+has_colors ()
+{
+ return TRUE;
+}
+
+int
+cbreak ()
+{
+ return OK;
+}
+
+int
+start_color ()
+{
+ return OK;
+}
+
+int
+noecho ()
+{
+ return OK;
+}
+
+int
+clear ()
+{
+ return OK;
+}
+
+int
+wclear (WINDOW *win)
+{
+ (void) win;
+
+ return OK;
+}
+
+bool
+can_change_color ()
+{
+ /* not supported in WeeChat anyway */
+ return FALSE;
+}
+
+int
+curs_set (int visibility)
+{
+ (void) visibility;
+
+ return 1; /* 0 == invisible, 1 == normal, 2 == very visible */
+}
+
+int
+nodelay (WINDOW *win, bool bf)
+{
+ (void) win;
+ (void) bf;
+
+ return OK;
+}
+
+int
+werase (WINDOW *win)
+{
+ (void) win;
+
+ return OK;
+}
+
+int
+wbkgdset (WINDOW *win, chtype ch)
+{
+ (void) win;
+ (void) ch;
+
+ return OK;
+}
+
+void
+wchgat (WINDOW *win, int n, attr_t attr, short color, const void *opts)
+{
+ (void) win;
+ (void) n;
+ (void) attr;
+ (void) color;
+ (void) opts;
+}
+
+int
+mvwchgat (WINDOW *win, int y, int x, int n, attr_t attr, short pair,
+ const void *opts)
+{
+ (void) win;
+ (void) y;
+ (void) x;
+ (void) n;
+ (void) attr;
+ (void) pair;
+ (void) opts;
+
+ return OK;
+}
+
+
+void
+whline (WINDOW *win, chtype ch, int n)
+{
+ (void) win;
+ (void) ch;
+ (void) n;
+}
+
+void
+wvline (WINDOW *win, chtype ch, int n)
+{
+ (void) win;
+ (void) ch;
+ (void) n;
+}
+
+int
+mvwhline (WINDOW *win, int y, int x, chtype ch, int n)
+{
+ (void) win;
+ (void) y;
+ (void) x;
+ (void) ch;
+ (void) n;
+
+ return OK;
+}
+
+int
+mvwvline (WINDOW *win, int y, int x, chtype ch, int n)
+{
+ (void) win;
+ (void) y;
+ (void) x;
+ (void) ch;
+ (void) n;
+
+ return OK;
+}
+
+int
+raw ()
+{
+ return OK;
+}
+
+int
+wcolor_set (WINDOW *win, short pair, void *opts)
+{
+ (void) win;
+ (void) pair;
+ (void) opts;
+
+ return OK;
+}
+
+void
+cur_term ()
+{
+}
+
+int
+use_default_colors ()
+{
+ return OK;
+}
+
+int
+resizeterm (int lines, int columns)
+{
+ (void) lines;
+ (void) columns;
+
+ return OK;
+}
+
+int
+getch ()
+{
+ return ERR;
+}
+
+int
+wgetch (WINDOW *win)
+{
+ (void) win;
+
+ return OK;
+}
diff --git a/src/gui/curses/headless/ncurses-fake.h b/src/gui/curses/headless/ncurses-fake.h
new file mode 100644
index 000000000..79ce6fc25
--- /dev/null
+++ b/src/gui/curses/headless/ncurses-fake.h
@@ -0,0 +1,126 @@
+/*
+ * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
+ *
+ * This file is part of WeeChat, the extensible chat client.
+ *
+ * WeeChat is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * WeeChat is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#ifndef WEECHAT_NCURSES_FAKE_H
+#define WEECHAT_NCURSES_FAKE_H
+
+#define ERR (-1)
+#define OK (0)
+
+#define TRUE 1
+#define FALSE 0
+
+#define COLS 80
+#define LINES 25
+#define COLORS 256
+#define COLOR_PAIRS 256
+
+#define COLOR_PAIR(x) x
+
+#define COLOR_BLACK 0
+#define COLOR_RED 1
+#define COLOR_GREEN 2
+#define COLOR_YELLOW 3
+#define COLOR_BLUE 4
+#define COLOR_MAGENTA 5
+#define COLOR_CYAN 6
+#define COLOR_WHITE 7
+
+#define A_BOLD 0
+#define A_UNDERLINE 0
+#define A_REVERSE 0
+#define A_ITALIC 0
+
+#define ACS_HLINE '-'
+#define ACS_VLINE '|'
+
+#define getyx(win, x, y) \
+ x = 0; \
+ y = 0;
+
+#define getmaxyx(win, x, y) \
+ x = 0; \
+ y = 0;
+
+struct _window
+{
+ int _cury, _curx;
+ int _maxy, _maxx;
+ int _begy, _begx;
+};
+typedef struct _window WINDOW;
+
+typedef unsigned char bool;
+typedef int attr_t;
+typedef unsigned chtype;
+
+extern WINDOW *stdscr;
+extern chtype acs_map[];
+
+extern WINDOW *initscr ();
+extern int endwin ();
+extern WINDOW *newwin (int nlines, int ncols, int begin_y, int begin_x);
+extern int delwin (WINDOW *win);
+extern int move (int y, int x);
+extern int wmove (WINDOW *win, int y, int x);
+extern int wattr_on (WINDOW *win, attr_t attrs, void *opts);
+extern int wattr_off (WINDOW *win, attr_t attrs, void *opts);
+extern int wattr_get (WINDOW *win, attr_t *attrs, short *pair, void *opts);
+extern int wattr_set (WINDOW *win, attr_t attrs, short pair, void *opts);
+extern int wattron (WINDOW *win, int attrs);
+extern int wattroff (WINDOW *win, int attrs);
+extern int waddstr (WINDOW *win, const char *str);
+extern int waddnstr (WINDOW *win, const char *str, int n);
+extern int mvaddstr (int y, int x, const char *str);
+extern int mvwaddstr (WINDOW *win, int y, int x, const char *str);
+extern int wclrtobot (WINDOW *win);
+extern int refresh ();
+extern int wrefresh (WINDOW *win);
+extern int wnoutrefresh (WINDOW *win);
+extern int wclrtoeol (WINDOW *win);
+extern int mvwprintw (WINDOW *win, int y, int x, const char *fmt, ...);
+extern int init_pair (short pair, short f, short b);
+extern bool has_colors ();
+extern int cbreak ();
+extern int start_color ();
+extern int noecho ();
+extern int clear ();
+extern int wclear (WINDOW *win);
+extern bool can_change_color ();
+extern int curs_set (int visibility);
+extern int nodelay (WINDOW *win, bool bf);
+extern int werase (WINDOW *win);
+extern int wbkgdset (WINDOW *win, chtype ch);
+extern void wchgat (WINDOW *win, int n, attr_t attr, short color,
+ const void *opts);
+extern int mvwchgat (WINDOW *win, int y, int x, int n, attr_t attr, short pair,
+ const void *opts);
+extern void whline (WINDOW *win, chtype ch, int n);
+extern void wvline (WINDOW *win, chtype ch, int n);
+extern int mvwhline (WINDOW *win, int y, int x, chtype ch, int n);
+extern int mvwvline (WINDOW *win, int y, int x, chtype ch, int n);
+extern int raw ();
+extern int wcolor_set (WINDOW *win, short pair, void *opts);
+extern void cur_term ();
+extern int use_default_colors ();
+extern int resizeterm ();
+extern int getch ();
+extern int wgetch (WINDOW *win);
+
+#endif /* WEECHAT_NCURSES_FAKE_H */
diff --git a/src/gui/curses/normal/CMakeLists.txt b/src/gui/curses/normal/CMakeLists.txt
new file mode 100644
index 000000000..f44b2cfcf
--- /dev/null
+++ b/src/gui/curses/normal/CMakeLists.txt
@@ -0,0 +1,81 @@
+#
+# Copyright (C) 2003-2018 Sébastien Helleu <flashcode@flashtux.org>
+#
+# This file is part of WeeChat, the extensible chat client.
+#
+# WeeChat is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# WeeChat is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
+#
+
+set(LIB_GUI_CURSES_SRC
+ ../gui-curses.h
+ ../gui-curses-bar-window.c
+ ../gui-curses-chat.c
+ ../gui-curses-color.c
+ ../gui-curses-key.c
+ ../gui-curses-main.c
+ ../gui-curses-mouse.c
+ ../gui-curses-term.c
+ ../gui-curses-window.c
+)
+
+find_package(Ncurses)
+if(NCURSES_FOUND)
+ check_include_files(ncursesw/ncurses.h NCURSESW_HEADERS)
+ if(NCURSESW_HEADERS)
+ add_definitions(-DHAVE_NCURSESW_CURSES_H)
+ else()
+ check_include_files(ncurses.h NCURSES_HEADERS)
+ if(NCURSES_HEADERS)
+ add_definitions(-DHAVE_NCURSES_H)
+ endif()
+ endif()
+endif()
+
+include_directories(.. ../../core ../../plugins ${NCURSES_INCLUDE_PATH})
+
+add_library(weechat_gui_curses_normal STATIC ${LIB_GUI_CURSES_SRC})
+
+set(WEECHAT_CURSES_MAIN_SRC main.c)
+
+set(EXECUTABLE weechat)
+
+add_executable(${EXECUTABLE} ${WEECHAT_CURSES_MAIN_SRC})
+
+add_dependencies(${EXECUTABLE} weechat_gui_curses_normal)
+
+list(APPEND EXTRA_LIBS ${NCURSES_LIBRARY})
+
+# Due to circular references, we must link two times with libweechat_core.a and libweechat_gui_common.a
+target_link_libraries(${EXECUTABLE} ${STATIC_LIBS} weechat_gui_curses_normal ${EXTRA_LIBS} ${STATIC_LIBS})
+
+# Create a symbolic link weechat-curses -> weechat
+# This link is created for compatibility with old versions on /upgrade.
+# It may be removed in future.
+add_custom_command(
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}-curses${CMAKE_EXECUTABLE_SUFFIX}
+ COMMAND ${CMAKE_COMMAND} -E remove -f "weechat-curses${CMAKE_EXECUTABLE_SUFFIX}"
+ COMMAND ${CMAKE_COMMAND} -E create_symlink "weechat${CMAKE_EXECUTABLE_SUFFIX}" "weechat-curses${CMAKE_EXECUTABLE_SUFFIX}"
+ DEPENDS ${EXECUTABLE}
+ WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
+ COMMENT "Creating symbolic link ${EXECUTABLE}-curses${CMAKE_EXECUTABLE_SUFFIX}"
+)
+add_custom_target(${EXECUTABLE}-curses${CMAKE_EXECUTABLE_SUFFIX} ALL
+ DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}-curses${CMAKE_EXECUTABLE_SUFFIX}
+)
+add_dependencies(${EXECUTABLE}-curses${CMAKE_EXECUTABLE_SUFFIX} ${EXECUTABLE})
+list(APPEND CMAKE_INSTALL_MANIFEST_FILES "${CMAKE_INSTALL_PREFIX}/bin/weechat-curses${CMAKE_EXECUTABLE_SUFFIX}")
+
+# Install executable and symbolic link
+install(TARGETS ${EXECUTABLE} RUNTIME DESTINATION bin)
+install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${EXECUTABLE}-curses${CMAKE_EXECUTABLE_SUFFIX} DESTINATION bin)
diff --git a/src/gui/curses/normal/Makefile.am b/src/gui/curses/normal/Makefile.am
new file mode 100644
index 000000000..a6a13b231
--- /dev/null
+++ b/src/gui/curses/normal/Makefile.am
@@ -0,0 +1,62 @@
+#
+# Copyright (C) 2003-2018 Sébastien Helleu <flashcode@flashtux.org>
+#
+# This file is part of WeeChat, the extensible chat client.
+#
+# WeeChat is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# WeeChat is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
+#
+
+AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" $(NCURSES_CFLAGS)
+
+noinst_LIBRARIES = lib_weechat_gui_curses.a
+
+lib_weechat_gui_curses_a_SOURCES = ../gui-curses-bar-window.c \
+ ../gui-curses-chat.c \
+ ../gui-curses-color.c \
+ ../gui-curses-key.c \
+ ../gui-curses-main.c \
+ ../gui-curses-mouse.c \
+ ../gui-curses-term.c \
+ ../gui-curses-window.c \
+ ../gui-curses.h
+
+bin_PROGRAMS = weechat
+
+# Due to circular references, we must link two times with libweechat_core.a
+# (and with two different path/names to be kept by linker)
+weechat_LDADD = ./../../../core/lib_weechat_core.a \
+ ../../../plugins/lib_weechat_plugins.a \
+ ../../lib_weechat_gui_common.a \
+ lib_weechat_gui_curses.a \
+ ../../../core/lib_weechat_core.a \
+ $(PLUGINS_LFLAGS) \
+ $(NCURSES_LFLAGS) \
+ $(GCRYPT_LFLAGS) \
+ $(GNUTLS_LFLAGS) \
+ $(CURL_LFLAGS) \
+ -lm
+
+weechat_SOURCES = main.c
+
+EXTRA_DIST = CMakeLists.txt
+
+# Create a symbolic link weechat-curses -> weechat
+# This link is created for compatibility with old versions on /upgrade.
+# It may be removed in future.
+install-exec-hook:
+ (cd '$(DESTDIR)$(bindir)' && rm -f weechat-curses$(EXEEXT) && $(LN_S) weechat weechat-curses$(EXEEXT))
+
+# Remove symbolic link on uninstall
+uninstall-hook:
+ (cd '$(DESTDIR)$(bindir)' && rm -f weechat-curses$(EXEEXT))
diff --git a/src/gui/curses/main.c b/src/gui/curses/normal/main.c
index 1a9076268..b3e57e99b 100644
--- a/src/gui/curses/main.c
+++ b/src/gui/curses/normal/main.c
@@ -25,9 +25,9 @@
#include <stdlib.h>
-#include "../../core/weechat.h"
-#include "../gui-main.h"
-#include "gui-curses.h"
+#include "../../../core/weechat.h"
+#include "../../gui-main.h"
+#include "../gui-curses.h"
/*
@@ -37,6 +37,8 @@
int
main (int argc, char *argv[])
{
+ /* init, main loop and end */
+ weechat_init_gettext ();
weechat_init (argc, argv, &gui_main_init);
gui_main_loop ();
weechat_end (&gui_main_end);
diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt
index 0abd7e6eb..e4e06e262 100644
--- a/src/plugins/CMakeLists.txt
+++ b/src/plugins/CMakeLists.txt
@@ -19,15 +19,17 @@
#
set(LIB_PLUGINS_SRC
-weechat-plugin.h
-plugin.c plugin.h
-plugin-api.c plugin-api.h
-plugin-config.h plugin-config.c)
+ weechat-plugin.h
+ plugin.c plugin.h
+ plugin-api.c plugin-api.h
+ plugin-config.h plugin-config.c
+)
set(LIB_PLUGINS_SCRIPTS_SRC
-plugin-script.c plugin-script.h
-plugin-script-api.c plugin-script-api.h
-plugin-script-config.c plugin-script-config.h)
+ plugin-script.c plugin-script.h
+ plugin-script-api.c plugin-script-api.h
+ plugin-script-config.c plugin-script-config.h
+)
include_directories(${CMAKE_BINARY_DIR})
add_library(weechat_plugins STATIC ${LIB_PLUGINS_SRC})
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 0011ac5db..40d5e8ee6 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -19,10 +19,6 @@
enable_language(CXX)
-# fake ncurses lib (it does nothing)
-set(LIB_WEECHAT_NCURSES_FAKE_SRC ncurses-fake.c)
-add_library(weechat_ncurses_fake STATIC ${LIB_WEECHAT_NCURSES_FAKE_SRC})
-
remove_definitions(-DHAVE_CONFIG_H)
include_directories(${CPPUTEST_INCLUDE_DIRS} ${PROJECT_BINARY_DIR} ${PROJECT_SOURCE_DIR})
@@ -58,8 +54,8 @@ set(LIBS
${PROJECT_BINARY_DIR}/src/core/libweechat_core.a
${PROJECT_BINARY_DIR}/src/plugins/libweechat_plugins.a
${PROJECT_BINARY_DIR}/src/gui/libweechat_gui_common.a
- ${PROJECT_BINARY_DIR}/src/gui/curses/libweechat_gui_curses.a
- ${CMAKE_CURRENT_BINARY_DIR}/libweechat_ncurses_fake.a
+ ${PROJECT_BINARY_DIR}/src/gui/curses/headless/libweechat_gui_headless.a
+ ${PROJECT_BINARY_DIR}/src/gui/curses/headless/libweechat_ncurses_fake.a
${CMAKE_CURRENT_BINARY_DIR}/libweechat_unit_tests.a
# due to circular references, we must link two times with libweechat_core.a
${PROJECT_BINARY_DIR}/src/core/libweechat_core.a
diff --git a/tests/Makefile.am b/tests/Makefile.am
index a180774d0..a1cc51044 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -19,9 +19,7 @@
AM_CPPFLAGS = -DLOCALEDIR=\"$(datadir)/locale\" $(CPPUTEST_CFLAGS) -I$(abs_top_srcdir)
-noinst_LIBRARIES = lib_ncurses_fake.a lib_weechat_unit_tests.a
-
-lib_ncurses_fake_a_SOURCES = ncurses-fake.c
+noinst_LIBRARIES = lib_weechat_unit_tests.a
lib_weechat_unit_tests_a_SOURCES = unit/test-plugins.cpp \
unit/core/test-arraylist.cpp \
@@ -43,8 +41,8 @@ noinst_PROGRAMS = tests
tests_LDADD = ./../src/core/lib_weechat_core.a \
../src/plugins/lib_weechat_plugins.a \
../src/gui/lib_weechat_gui_common.a \
- ../src/gui/curses/lib_weechat_gui_curses.a \
- lib_ncurses_fake.a \
+ ../src/gui/curses/headless/lib_weechat_gui_headless.a \
+ ../src/gui/curses/headless/lib_weechat_ncurses_fake.a \
lib_weechat_unit_tests.a \
../src/core/lib_weechat_core.a \
$(PLUGINS_LFLAGS) \
diff --git a/tests/ncurses-fake.c b/tests/ncurses-fake.c
deleted file mode 100644
index 51f4a3303..000000000
--- a/tests/ncurses-fake.c
+++ /dev/null
@@ -1,315 +0,0 @@
-/*
- * ncurses-fake.c - fake ncurses lib used for tests
- *
- * Copyright (C) 2014-2018 Sébastien Helleu <flashcode@flashtux.org>
- *
- * This file is part of WeeChat, the extensible chat client.
- *
- * WeeChat is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 3 of the License, or
- * (at your option) any later version.
- *
- * WeeChat is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with WeeChat. If not, see <http://www.gnu.org/licenses/>.
- */
-
-#define ERR (-1)
-#define OK (0)
-
-struct _window
-{
- int _cury, _curx;
- int _maxy, _maxx;
- int _begy, _begx;
-};
-typedef struct _window WINDOW;
-
-typedef unsigned char bool;
-typedef int attr_t;
-typedef unsigned chtype;
-
-/* simulate 80x25 terminal */
-WINDOW stdscr = { 0, 0, 24, 79, 0, 0 };
-chtype acs_map[256];
-
-
-WINDOW
-*initscr ()
-{
- return &stdscr;
-}
-
-int
-endwin ()
-{
- return OK;
-}
-
-WINDOW
-*newwin ()
-{
- return &stdscr;
-}
-
-int
-delwin ()
-{
- return OK;
-}
-
-int
-wmove (WINDOW *win, int y, int x)
-{
- (void)win;
- (void)y;
- (void)x;
- return OK;
-}
-
-int
-wattr_on (WINDOW *win, attr_t attrs, void *opts)
-{
- (void) win;
- (void) attrs;
- (void) opts;
- return OK;
-}
-
-int
-wattr_off (WINDOW *win, attr_t attrs, void *opts)
-{
- (void) win;
- (void) attrs;
- (void) opts;
- return OK;
-}
-
-int
-wattr_get (WINDOW *win, attr_t *attrs, short *pair, void *opts)
-{
- (void) win;
- (void) attrs;
- (void) pair;
- (void) opts;
- return OK;
-}
-
-int
-wattr_set (WINDOW *win, attr_t *attrs, short *pair, void *opts)
-{
- (void) win;
- (void) attrs;
- (void) pair;
- (void) opts;
- return OK;
-}
-
-int
-waddnstr(WINDOW *win, const char *str, int n)
-{
- (void) win;
- (void) str;
- (void) n;
- return OK;
-}
-
-int
-wclrtobot(WINDOW *win)
-{
- (void) win;
- return OK;
-}
-
-int
-wrefresh(WINDOW *win)
-{
- (void) win;
- return OK;
-}
-
-int
-wnoutrefresh(WINDOW *win)
-{
- (void) win;
- return OK;
-}
-
-int
-wclrtoeol(WINDOW *win)
-{
- (void) win;
- return OK;
-}
-
-int
-mvwprintw(WINDOW *win, int y, int x, const char *fmt, ...)
-{
- (void) win;
- (void) y;
- (void) x;
- (void) fmt;
- return OK;
-}
-
-int
-init_pair(short pair, short f, short b)
-{
- (void) pair;
- (void) f;
- (void) b;
- return OK;
-}
-
-int
-has_colors()
-{
- return 1;
-}
-
-int
-cbreak()
-{
- return OK;
-}
-
-int
-start_color()
-{
- return OK;
-}
-
-int
-noecho()
-{
- return OK;
-}
-
-int
-wclear(WINDOW *win)
-{
- (void) win;
- return OK;
-}
-
-int
-wgetch(WINDOW *win)
-{
- (void) win;
- return OK;
-}
-
-int
-can_change_color()
-{
- /* not supported in WeeChat anyway */
- return 0;
-}
-
-int
-curs_set(int visibility)
-{
- (void) visibility;
- return 1; /* 0 == invisible, 1 == normal, 2 == very visible */
-}
-
-int
-nodelay(WINDOW *win, bool bf)
-{
- (void) win;
- (void) bf;
- return OK;
-}
-
-int
-werase(WINDOW *win)
-{
- (void) win;
- return OK;
-}
-
-int
-wbkgdset(WINDOW *win, chtype ch)
-{
- (void) win;
- (void) ch;
- return OK;
-}
-
-void
-wchgat(WINDOW *win, int n, attr_t attr, short color, const void *opts)
-{
- (void) win;
- (void) n;
- (void) attr;
- (void) color;
- (void) opts;
-}
-
-void
-whline()
-{
-}
-
-void
-wvline()
-{
-}
-
-void
-raw()
-{
-}
-
-void
-wcolor_set()
-{
-}
-
-void
-cur_term()
-{
-}
-
-void
-use_default_colors()
-{
-}
-
-void
-resizeterm()
-{
-}
-
-int
-COLS()
-{
- /* simulate 80x25 terminal */
- return 80;
-}
-
-int
-LINES()
-{
- /* simulate 80x25 terminal */
- return 25;
-}
-
-int
-COLORS()
-{
- /* simulate 256-color terminal */
- return 256;
-}
-
-int
-COLOR_PAIRS()
-{
- /* simulate 256-color terminal */
- return 256;
-}
diff --git a/tests/tests.cpp b/tests/tests.cpp
index 1dc4ded7b..8a6e7cc5c 100644
--- a/tests/tests.cpp
+++ b/tests/tests.cpp
@@ -197,6 +197,7 @@ main (int argc, char *argv[])
/* init WeeChat */
printf ("------------------------------------------------------------\n");
+ weechat_init_gettext ();
weechat_init (weechat_argc, weechat_argv, &test_gui_init);
if (weechat_argv)
string_free_split (weechat_argv);