core: add options to customize commands on system signals, quit by default on SIGHUP when not running headless (closes #1595)

New options to customize behavior on signals received, with the default
behavior:

- weechat.signal.sighup: quit in normal mode, reload config in headless
- weechat.signal.sigquit: quit
- weechat.signal.sigterm: quit
- weechat.signal.sigusr1: no command executed by default
- weechat.signal.sigusr2: no command executed by default

The signals SIGUSR1 and SIGUSR2 are introduced by this commit, so it's now
possible to run commands when they are received.

The SIGHUP signal makes now WeeChat quit, it was the behavior before version
2.9 of WeeChat (see commit de1e61f7cd50cbd1a99777fe6611642a51abf5f6).
This commit is contained in:
Sébastien Helleu 2021-03-16 18:47:31 +01:00
parent bb41de8c02
commit 0dc7fbcb0c
53 changed files with 988 additions and 441 deletions

View File

@ -20,6 +20,8 @@ https://weechat.org/files/releasenotes/ReleaseNotes-devel.html[release notes]
New features::
* core: add options to customize commands executed on system signals received (SIGHUP, SIGQUIT, SIGTERM, SIGUSR1, SIGUSR2) (issue #1595)
* core: quit WeeChat by default when signal SIGHUP is received in normal run, reload configuration in weechat-headless (issue #1595)
* api: add info "weechat_daemon"
Bug fixes::

View File

@ -1308,6 +1308,36 @@
** Werte: on, off
** Standardwert: `+on+`
* [[option_weechat.signal.sighup]] *weechat.signal.sighup*
** Beschreibung: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette
** Standardwert: `+"${if:${info:weechat_headless}?/reload:/quit -yes}"+`
* [[option_weechat.signal.sigquit]] *weechat.signal.sigquit*
** Beschreibung: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette
** Standardwert: `+"/quit -yes"+`
* [[option_weechat.signal.sigterm]] *weechat.signal.sigterm*
** Beschreibung: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette
** Standardwert: `+"/quit -yes"+`
* [[option_weechat.signal.sigusr1]] *weechat.signal.sigusr1*
** Beschreibung: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette
** Standardwert: `+""+`
* [[option_weechat.signal.sigusr2]] *weechat.signal.sigusr2*
** Beschreibung: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** Typ: Zeichenkette
** Werte: beliebige Zeichenkette
** Standardwert: `+""+`
* [[option_weechat.startup.command_after_plugins]] *weechat.startup.command_after_plugins*
** Beschreibung: pass:none[Nach dem Start von WeeChat wird dieser Befehl aufgerufen. Dies geschieht nachdem die Erweiterungen geladen worden sind (mehrere Befehle sind durch ";" zu trennen) (Hinweis: Inhalt wird evaluiert, siehe /help eval)]
** Typ: Zeichenkette

View File

@ -2453,6 +2453,8 @@ Sektion in Datei _weechat.conf_:
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Proxy Optionen.
| network | /set weechat.network.* | Netzwerk/SSL Optionen.
// TRANSLATION MISSING
| signal | /set weechat.signal.* | Signal options.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Optionen für die Bars.
| layout | <<command_weechat_layout,/layout>> | Layouts.

View File

@ -1308,6 +1308,36 @@
** values: on, off
** default value: `+on+`
* [[option_weechat.signal.sighup]] *weechat.signal.sighup*
** description: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** type: string
** values: any string
** default value: `+"${if:${info:weechat_headless}?/reload:/quit -yes}"+`
* [[option_weechat.signal.sigquit]] *weechat.signal.sigquit*
** description: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** type: string
** values: any string
** default value: `+"/quit -yes"+`
* [[option_weechat.signal.sigterm]] *weechat.signal.sigterm*
** description: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** type: string
** values: any string
** default value: `+"/quit -yes"+`
* [[option_weechat.signal.sigusr1]] *weechat.signal.sigusr1*
** description: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** type: string
** values: any string
** default value: `+""+`
* [[option_weechat.signal.sigusr2]] *weechat.signal.sigusr2*
** description: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** type: string
** values: any string
** default value: `+""+`
* [[option_weechat.startup.command_after_plugins]] *weechat.startup.command_after_plugins*
** description: pass:none[command executed when WeeChat starts, after loading plugins (note: content is evaluated, see /help eval)]
** type: string

View File

@ -140,6 +140,7 @@ WeeChat "core" is located in following directories:
|    wee-secure.c | Secured data functions.
|    wee-secure-buffer.c | Secured data buffer.
|    wee-secure-config.c | Secured data options (file sec.conf).
|    wee-signal.c | Signal functions.
|    wee-string.c | Functions on strings.
|    wee-upgrade-file.c | Internal upgrade system.
|    wee-upgrade.c | Upgrade for WeeChat core (buffers, lines, history, ...).
@ -401,6 +402,7 @@ WeeChat "core" is located in following directories:
|          test-core-infolist.cpp | Tests: infolists.
|          test-core-list.cpp | Tests: lists.
|          test-core-secure.cpp | Tests: secured data.
|          test-core-signal.cpp | Tests: signals.
|          test-core-string.cpp | Tests: strings.
|          test-core-url.cpp | Tests: URLs.
|          test-core-utf8.cpp | Tests: UTF-8.

View File

@ -2410,6 +2410,7 @@ Sections in file _weechat.conf_:
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Proxy options.
| network | /set weechat.network.* | Network/SSL options.
| signal | /set weechat.signal.* | Signal options.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Bar options.
| layout | <<command_weechat_layout,/layout>> | Layouts.

View File

@ -1308,6 +1308,36 @@
** valeurs: on, off
** valeur par défaut: `+on+`
* [[option_weechat.signal.sighup]] *weechat.signal.sighup*
** description: pass:none[commande à exécuter lorsque le signal est reçu, plusieurs commandes peuvent être séparées par des point-virgules (note : le contenu est évalué, voir /help eval)]
** type: chaîne
** valeurs: toute chaîne
** valeur par défaut: `+"${if:${info:weechat_headless}?/reload:/quit -yes}"+`
* [[option_weechat.signal.sigquit]] *weechat.signal.sigquit*
** description: pass:none[commande à exécuter lorsque le signal est reçu, plusieurs commandes peuvent être séparées par des point-virgules (note : le contenu est évalué, voir /help eval)]
** type: chaîne
** valeurs: toute chaîne
** valeur par défaut: `+"/quit -yes"+`
* [[option_weechat.signal.sigterm]] *weechat.signal.sigterm*
** description: pass:none[commande à exécuter lorsque le signal est reçu, plusieurs commandes peuvent être séparées par des point-virgules (note : le contenu est évalué, voir /help eval)]
** type: chaîne
** valeurs: toute chaîne
** valeur par défaut: `+"/quit -yes"+`
* [[option_weechat.signal.sigusr1]] *weechat.signal.sigusr1*
** description: pass:none[commande à exécuter lorsque le signal est reçu, plusieurs commandes peuvent être séparées par des point-virgules (note : le contenu est évalué, voir /help eval)]
** type: chaîne
** valeurs: toute chaîne
** valeur par défaut: `+""+`
* [[option_weechat.signal.sigusr2]] *weechat.signal.sigusr2*
** description: pass:none[commande à exécuter lorsque le signal est reçu, plusieurs commandes peuvent être séparées par des point-virgules (note : le contenu est évalué, voir /help eval)]
** type: chaîne
** valeurs: toute chaîne
** valeur par défaut: `+""+`
* [[option_weechat.startup.command_after_plugins]] *weechat.startup.command_after_plugins*
** description: pass:none[commande exécutée quand WeeChat démarre, après le chargement des extensions (note : le contenu est évalué, voir /help eval)]
** type: chaîne

View File

@ -142,6 +142,7 @@ Le cœur de WeeChat est situé dans les répertoires suivants :
|    wee-secure.c | Fonctions pour les données sécurisées.
|    wee-secure-buffer.c | Tampon pour les données sécurisées.
|    wee-secure-config.c | Options des données sécurisées (fichier sec.conf).
|    wee-signal.c | Fonctions sur les signaux.
|    wee-string.c | Fonctions sur les chaînes de caractères.
|    wee-upgrade-file.c | Système de mise à jour interne.
|    wee-upgrade.c | Mise à jour du cœur de WeeChat (tampons, lignes, historique, ...).
@ -403,6 +404,7 @@ Le cœur de WeeChat est situé dans les répertoires suivants :
|          test-core-infolist.cpp | Tests : infolists.
|          test-core-list.cpp | Tests : listes.
|          test-core-secure.cpp | Tests : données sécurisées.
|          test-core-signal.cpp | Tests : signaux.
|          test-core-string.cpp | Tests : chaînes.
|          test-core-url.cpp | Tests : URLs.
|          test-core-utf8.cpp | Tests : UTF-8.

View File

@ -2493,6 +2493,7 @@ Sections dans le fichier _weechat.conf_ :
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Options des proxies.
| network | /set weechat.network.* | Options réseau/SSL.
| signal | /set weechat.signal.* | Options sur les signaux.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Options des barres.
| layout | <<command_weechat_layout,/layout>> | Dispositions.

View File

@ -1308,6 +1308,36 @@
** valori: on, off
** valore predefinito: `+on+`
* [[option_weechat.signal.sighup]] *weechat.signal.sighup*
** descrizione: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** tipo: stringa
** valori: qualsiasi stringa
** valore predefinito: `+"${if:${info:weechat_headless}?/reload:/quit -yes}"+`
* [[option_weechat.signal.sigquit]] *weechat.signal.sigquit*
** descrizione: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** tipo: stringa
** valori: qualsiasi stringa
** valore predefinito: `+"/quit -yes"+`
* [[option_weechat.signal.sigterm]] *weechat.signal.sigterm*
** descrizione: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** tipo: stringa
** valori: qualsiasi stringa
** valore predefinito: `+"/quit -yes"+`
* [[option_weechat.signal.sigusr1]] *weechat.signal.sigusr1*
** descrizione: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** tipo: stringa
** valori: qualsiasi stringa
** valore predefinito: `+""+`
* [[option_weechat.signal.sigusr2]] *weechat.signal.sigusr2*
** descrizione: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** tipo: stringa
** valori: qualsiasi stringa
** valore predefinito: `+""+`
* [[option_weechat.startup.command_after_plugins]] *weechat.startup.command_after_plugins*
** descrizione: pass:none[comando eseguito all'avvio di WeeChat, dopo il caricamento dei plugin (nota: il contenuto viene valutato, consultare /help eval)]
** tipo: stringa

View File

@ -2585,6 +2585,8 @@ Sections in file _weechat.conf_:
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Proxy options.
| network | /set weechat.network.* | Network/SSL options.
// TRANSLATION MISSING
| signal | /set weechat.signal.* | Signal options.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Bar options.
| layout | <<command_weechat_layout,/layout>> | Layouts.

View File

@ -1308,6 +1308,36 @@
** 値: on, off
** デフォルト値: `+on+`
* [[option_weechat.signal.sighup]] *weechat.signal.sighup*
** 説明: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** タイプ: 文字列
** 値: 未制約文字列
** デフォルト値: `+"${if:${info:weechat_headless}?/reload:/quit -yes}"+`
* [[option_weechat.signal.sigquit]] *weechat.signal.sigquit*
** 説明: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** タイプ: 文字列
** 値: 未制約文字列
** デフォルト値: `+"/quit -yes"+`
* [[option_weechat.signal.sigterm]] *weechat.signal.sigterm*
** 説明: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** タイプ: 文字列
** 値: 未制約文字列
** デフォルト値: `+"/quit -yes"+`
* [[option_weechat.signal.sigusr1]] *weechat.signal.sigusr1*
** 説明: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** タイプ: 文字列
** 値: 未制約文字列
** デフォルト値: `+""+`
* [[option_weechat.signal.sigusr2]] *weechat.signal.sigusr2*
** 説明: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** タイプ: 文字列
** 値: 未制約文字列
** デフォルト値: `+""+`
* [[option_weechat.startup.command_after_plugins]] *weechat.startup.command_after_plugins*
** 説明: pass:none[WeeChat が実行され、プラグインのロード後に実行されるコマンド (注意: 値は評価されます、/help eval を参照してください)]
** タイプ: 文字列

View File

@ -148,6 +148,8 @@ WeeChat "core" は以下のディレクトリに配置されています:
|    wee-secure.c | データ保護用の関数
|    wee-secure-buffer.c | データ保護用のバッファ
|    wee-secure-config.c | 安全なデータオプション (sec.conf ファイル)
// TRANSLATION MISSING
|    wee-signal.c | Signal functions.
|    wee-string.c | 文字列関数
|    wee-upgrade-file.c | 内部アップグレードシステム
|    wee-upgrade.c | WeeChat コアのアップグレード (バッファ、行、履歴、...)
@ -413,6 +415,8 @@ WeeChat "core" は以下のディレクトリに配置されています:
|          test-core-infolist.cpp | テスト: インフォリスト
|          test-core-list.cpp | テスト: リスト
|          test-core-secure.cpp | テスト: データ保護
// TRANSLATION MISSING
|          test-core-signal.cpp | テスト: signals.
|          test-core-string.cpp | テスト: 文字列
|          test-core-url.cpp | テスト: URL
|          test-core-utf8.cpp | テスト: UTF-8

View File

@ -2471,6 +2471,8 @@ _weechat.conf_ ファイル内のセクション:
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | プロキシオプション
| network | /set weechat.network.* | ネットワーク/SSL オプション
// TRANSLATION MISSING
| signal | /set weechat.signal.* | Signal options.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | バーオプション
| layout | <<command_weechat_layout,/layout>> | レイアウト

View File

@ -1308,6 +1308,36 @@
** wartości: on, off
** domyślna wartość: `+on+`
* [[option_weechat.signal.sighup]] *weechat.signal.sighup*
** opis: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** typ: ciąg
** wartości: dowolny ciąg
** domyślna wartość: `+"${if:${info:weechat_headless}?/reload:/quit -yes}"+`
* [[option_weechat.signal.sigquit]] *weechat.signal.sigquit*
** opis: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** typ: ciąg
** wartości: dowolny ciąg
** domyślna wartość: `+"/quit -yes"+`
* [[option_weechat.signal.sigterm]] *weechat.signal.sigterm*
** opis: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** typ: ciąg
** wartości: dowolny ciąg
** domyślna wartość: `+"/quit -yes"+`
* [[option_weechat.signal.sigusr1]] *weechat.signal.sigusr1*
** opis: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** typ: ciąg
** wartości: dowolny ciąg
** domyślna wartość: `+""+`
* [[option_weechat.signal.sigusr2]] *weechat.signal.sigusr2*
** opis: pass:none[command to execute when the signal is received, multiple commands can be separated by semicolons (note: content is evaluated, see /help eval)]
** typ: ciąg
** wartości: dowolny ciąg
** domyślna wartość: `+""+`
* [[option_weechat.startup.command_after_plugins]] *weechat.startup.command_after_plugins*
** opis: pass:none[komenda wykonana kiedy WeeChat jest uruchamiany, po załadowaniu wtyczek (uwaga: zawartość jest przetwarzana, zobacz /help eval)]
** typ: ciąg

View File

@ -2426,6 +2426,8 @@ Sekcje w pliku _weechat.conf_:
| proxy | <<command_weechat_proxy,/proxy>> +
/set weechat.proxy.* | Opcje proxy.
| network | /set weechat.network.* | Opcje sieci/SSL.
// TRANSLATION MISSING
| signal | /set weechat.signal.* | Signal options.
| bar | <<command_weechat_bar,/bar>> +
/set weechat.bar.* | Opcje pasków.
| layout | <<command_weechat_layout,/layout>> | Układy.

View File

@ -77,6 +77,8 @@
./src/core/wee-secure-buffer.h
./src/core/wee-secure-config.c
./src/core/wee-secure-config.h
./src/core/wee-signal.c
./src/core/wee-signal.h
./src/core/wee-string.c
./src/core/wee-string.h
./src/core/wee-upgrade.c

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+0100\n"
"PO-Revision-Date: 2021-02-06 15:55+0100\n"
"Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4191,6 +4191,12 @@ msgstr ""
msgid "save configuration files when unloading plugins"
msgstr "uložit soubory s nastavením při ukončení pluginů"
#, fuzzy
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr "příkaz spuštěný při startu WeeChat, po načtení pluginů"
msgid "FATAL: error initializing configuration options"
msgstr "FATÁLNÍ: chyba při inicializaci konfiguračních nastavení"
@ -4612,14 +4618,6 @@ msgstr "Barvy WeeChat (použité: %d, zbývá: %d):"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Terminál ztracen, ukončuji WeeChat..."
#, fuzzy, c-format
msgid "Signal %s received, reloading configuration..."
msgstr "Obdržen signál %s, ukončuji WeeChat..."
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr "Obdržen signál %s, ukončuji WeeChat..."
msgid "Mouse is enabled"
msgstr "Myš je zapnuta"
@ -13241,6 +13239,14 @@ msgstr "%s%s: vypršel časový limit \"%s\" pro %s"
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: nemohu se připojit\" neočekávaná chyba (%d)"
#, fuzzy, c-format
#~ msgid "Signal %s received, reloading configuration..."
#~ msgstr "Obdržen signál %s, ukončuji WeeChat..."
#, c-format
#~ msgid "Signal %s received, exiting WeeChat..."
#~ msgstr "Obdržen signál %s, ukončuji WeeChat..."
#, fuzzy
#~ msgid "secured data: names and values"
#~ msgstr "Chráněná data \"%s\" smazána"

View File

@ -24,7 +24,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+0100\n"
"PO-Revision-Date: 2021-03-14 13:36+0100\n"
"Last-Translator: Nils Görs <weechatter@arcor.de>\n"
"Language-Team: German <kde-i18n-de@kde.org>\n"
@ -5110,6 +5110,15 @@ msgstr ""
msgid "save configuration files when unloading plugins"
msgstr "speichert Konfigurationen, falls Erweiterungen beendet werden"
#, fuzzy
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr ""
"Nach dem Start von WeeChat wird dieser Befehl aufgerufen. Dies geschieht "
"nachdem die Erweiterungen geladen worden sind (mehrere Befehle sind durch \";"
"\" zu trennen) (Hinweis: Inhalt wird evaluiert, siehe /help eval)"
msgid "FATAL: error initializing configuration options"
msgstr "FATAL: Fehler bei der Initialisierung der Konfigurationseinstellungen"
@ -5572,14 +5581,6 @@ msgstr "WeeChat Farben (in Benutzung: %d; noch frei verfügbar: %d):"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Terminal verloren, beende WeeChat..."
#, c-format
msgid "Signal %s received, reloading configuration..."
msgstr "Signal %s empfangen, Konfiguration neu laden..."
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr "Signal %s empfangen, beende WeeChat..."
msgid "Mouse is enabled"
msgstr "Maus ist aktiv"
@ -15555,6 +15556,14 @@ msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr ""
"%s%s: Verbindung konnte nicht hergestellt werden: unerwarteter Fehler (%d)"
#, c-format
#~ msgid "Signal %s received, reloading configuration..."
#~ msgstr "Signal %s empfangen, Konfiguration neu laden..."
#, c-format
#~ msgid "Signal %s received, exiting WeeChat..."
#~ msgstr "Signal %s empfangen, beende WeeChat..."
#, fuzzy
#~ msgid "secured data: names and values"
#~ msgstr "Schutzwürdige Information \"%s\" gelöscht"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+0100\n"
"PO-Revision-Date: 2021-02-06 15:55+0100\n"
"Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4384,6 +4384,12 @@ msgstr ""
msgid "save configuration files when unloading plugins"
msgstr "guardar archivos de configuración al descargar extensiones"
#, fuzzy
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr "comando ejecutado cuando WeeChat inicia, después de cargar los plugins"
msgid "FATAL: error initializing configuration options"
msgstr "FATAL: error al inicializar las opciones de configuración"
@ -4802,14 +4808,6 @@ msgstr "Colores de WeeChat (en uso: %d, disponibles: %d):"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Se perdió la terminal, cerrando WeeChat..."
#, fuzzy, c-format
msgid "Signal %s received, reloading configuration..."
msgstr "Señal %s recibida, cerrando WeeChat..."
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr "Señal %s recibida, cerrando WeeChat..."
msgid "Mouse is enabled"
msgstr "Ratón activado"
@ -13521,6 +13519,14 @@ msgstr "%s%s: tiempo de espera máximo para \"%s\" con %s"
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: no es posible conectarse al transmisor"
#, fuzzy, c-format
#~ msgid "Signal %s received, reloading configuration..."
#~ msgstr "Señal %s recibida, cerrando WeeChat..."
#, c-format
#~ msgid "Signal %s received, exiting WeeChat..."
#~ msgstr "Señal %s recibida, cerrando WeeChat..."
#, fuzzy
#~ msgid "secured data: names and values"
#~ msgstr "Barra eliminada"

View File

@ -21,8 +21,8 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"PO-Revision-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+0100\n"
"PO-Revision-Date: 2021-03-16 18:32+0100\n"
"Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
"Language: fr\n"
@ -4980,6 +4980,14 @@ msgid "save configuration files when unloading plugins"
msgstr ""
"sauvegarder les fichiers de configuration lors du déchargement des extensions"
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr ""
"commande à exécuter lorsque le signal est reçu, plusieurs commandes peuvent "
"être séparées par des point-virgules (note : le contenu est évalué, voir /"
"help eval)"
msgid "FATAL: error initializing configuration options"
msgstr "FATAL : erreur d'initialisation des options de configuration"
@ -5440,14 +5448,6 @@ msgstr "Couleurs WeeChat (en utilisation : %d, libres : %d) :"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Terminal perdu, sortie de WeeChat..."
#, c-format
msgid "Signal %s received, reloading configuration..."
msgstr "Signal %s reçu, rechargement de la configuration..."
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr "Signal %s reçu, sortie de WeeChat..."
msgid "Mouse is enabled"
msgstr "La souris est activée"
@ -15241,5 +15241,13 @@ msgstr "%s%s : délai d'attente dépassé pour \"%s\" avec %s"
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s : impossible de se connecter : erreur inattendue (%d)"
#, c-format
#~ msgid "Signal %s received, reloading configuration..."
#~ msgstr "Signal %s reçu, rechargement de la configuration..."
#, c-format
#~ msgid "Signal %s received, exiting WeeChat..."
#~ msgstr "Signal %s reçu, sortie de WeeChat..."
#~ msgid "secured data: names and values"
#~ msgstr "données sécurisées : noms et valeurs"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+0100\n"
"PO-Revision-Date: 2021-02-06 15:55+0100\n"
"Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3750,6 +3750,12 @@ msgstr ""
msgid "save configuration files when unloading plugins"
msgstr "beállítások mentése kilépéskor"
#, fuzzy
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr "felhasználónév az IRC szerveren"
#, fuzzy
msgid "FATAL: error initializing configuration options"
msgstr "szerver konfigurációs fájljának újraolvastatása"
@ -4166,14 +4172,6 @@ msgstr ""
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
#, c-format
msgid "Signal %s received, reloading configuration..."
msgstr ""
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr ""
#, fuzzy
msgid "Mouse is enabled"
msgstr "a felhasználók le lettek tiltva"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+0100\n"
"PO-Revision-Date: 2021-02-06 15:55+0100\n"
"Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4502,6 +4502,14 @@ msgstr ""
msgid "save configuration files when unloading plugins"
msgstr "salva i file di configurazione allo scaricamento dei plugin"
#, fuzzy
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr ""
"comando eseguito all'avvio di WeeChat, dopo il caricamento dei plugin (nota: "
"il contenuto viene valutato, consultare /help eval)"
msgid "FATAL: error initializing configuration options"
msgstr "FATALE: errore nell'inizializzazione delle opzioni di configurazione"
@ -4936,14 +4944,6 @@ msgstr "Colori di WeeChat (in uso: %d, rimaste: %d):"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Terminale perduto, chiusura di WeeChat..."
#, fuzzy, c-format
msgid "Signal %s received, reloading configuration..."
msgstr "Ricevuto segnale %s, chiusura di WeeChat..."
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr "Ricevuto segnale %s, chiusura di WeeChat..."
msgid "Mouse is enabled"
msgstr "Mouse abilitato"
@ -13744,6 +13744,14 @@ msgstr "%s%s: timeout per \"%s\" con %s"
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: impossibile connettersi al mittente"
#, fuzzy, c-format
#~ msgid "Signal %s received, reloading configuration..."
#~ msgstr "Ricevuto segnale %s, chiusura di WeeChat..."
#, c-format
#~ msgid "Signal %s received, exiting WeeChat..."
#~ msgstr "Ricevuto segnale %s, chiusura di WeeChat..."
#, fuzzy
#~ msgid "secured data: names and values"
#~ msgstr "Dati sicuri \"%s\" eliminati"

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+0100\n"
"PO-Revision-Date: 2021-02-06 15:55+0100\n"
"Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n"
"Language-Team: Japanese <https://github.com/l/weechat/tree/master/"
@ -4723,6 +4723,14 @@ msgstr ""
msgid "save configuration files when unloading plugins"
msgstr "プラグインをアンロードする際に設定ファイルをセーブ"
#, fuzzy
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr ""
"WeeChat が実行され、プラグインのロード後に実行されるコマンド (注意: 値は評価"
"されます、/help eval を参照してください)"
msgid "FATAL: error initializing configuration options"
msgstr "致命的: 設定オプションの初期化中にエラー"
@ -5161,14 +5169,6 @@ msgstr "WeeChat 色 (使用中: %d、残り: %d):"
msgid "Terminal lost, exiting WeeChat..."
msgstr "端末が見つかりません、WeeChat の終了中..."
#, fuzzy, c-format
msgid "Signal %s received, reloading configuration..."
msgstr "シグナル %s を受け取りました、WeeChat の終了中..."
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr "シグナル %s を受け取りました、WeeChat の終了中..."
msgid "Mouse is enabled"
msgstr "マウスを有効化しました"
@ -14541,6 +14541,14 @@ msgstr "%s%s: \"%s\" のタイムアウト %s"
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: 接続できません: 未定義のエラー (%d)"
#, fuzzy, c-format
#~ msgid "Signal %s received, reloading configuration..."
#~ msgstr "シグナル %s を受け取りました、WeeChat の終了中..."
#, c-format
#~ msgid "Signal %s received, exiting WeeChat..."
#~ msgstr "シグナル %s を受け取りました、WeeChat の終了中..."
#, fuzzy
#~ msgid "secured data: names and values"
#~ msgstr "保護データ \"%s\" を削除しました"

View File

@ -22,7 +22,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+0100\n"
"PO-Revision-Date: 2021-03-14 13:37+0100\n"
"Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n"
"Language-Team: Polish <kde-i18n-doc@kde.org>\n"
@ -4870,6 +4870,14 @@ msgstr ""
msgid "save configuration files when unloading plugins"
msgstr "zapisuj pliki konfiguracyjne przy wyładowywaniu wtyczek"
#, fuzzy
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr ""
"komenda wykonana kiedy WeeChat jest uruchamiany, po załadowaniu wtyczek "
"(uwaga: zawartość jest przetwarzana, zobacz /help eval)"
msgid "FATAL: error initializing configuration options"
msgstr "KRYTYCZNE: błąd podczas inicjacji zmiennych konfiguracyjnych"
@ -5315,14 +5323,6 @@ msgstr "Kolory WeeChat (w użyciu: %d, zostało: %d):"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Utracono terminal, wychodzę z WeeChat..."
#, c-format
msgid "Signal %s received, reloading configuration..."
msgstr "Otrzymano sygnał %s, przeładowywuje konfigurację..."
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr "Otrzymano sygnał %s, wychodzę z WeeChat..."
msgid "Mouse is enabled"
msgstr "Obsługa myszy włączona"
@ -14897,6 +14897,14 @@ msgstr "%s%s: przekroczono czas na \"%s\" z %s"
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: nie można połączyć: niespodziewany błąd (%d)"
#, c-format
#~ msgid "Signal %s received, reloading configuration..."
#~ msgstr "Otrzymano sygnał %s, przeładowywuje konfigurację..."
#, c-format
#~ msgid "Signal %s received, exiting WeeChat..."
#~ msgstr "Otrzymano sygnał %s, wychodzę z WeeChat..."
#, fuzzy
#~ msgid "secured data: names and values"
#~ msgstr "Usunięto zabezpieczone dane \"%s\""

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+0100\n"
"PO-Revision-Date: 2021-02-06 15:55+0100\n"
"Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n"
"Language-Team: Portuguese <>\n"
@ -4756,6 +4756,14 @@ msgstr ""
msgid "save configuration files when unloading plugins"
msgstr "guardar os ficheiros de configuração ao descarregar plugins"
#, fuzzy
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr ""
"comando executado ao iniciar o WeeChat, depois de recarregar os plugins "
"(nota: o conteúdo é avaliado, ver /help eval)"
msgid "FATAL: error initializing configuration options"
msgstr "FATAL: erro ao inicializar as opções de configuração"
@ -5204,14 +5212,6 @@ msgstr "Cores WeeChat (em uso: %d, livres: %d):"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Terminal perdido, a sair do WeeChat..."
#, fuzzy, c-format
msgid "Signal %s received, reloading configuration..."
msgstr "Sinal %s recebido, a sair do WeeChat..."
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr "Sinal %s recebido, a sair do WeeChat..."
msgid "Mouse is enabled"
msgstr "O rato está ativado"
@ -14398,6 +14398,14 @@ msgstr "%s%s: tempo limite de \"%s\" com %s"
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: não foi possível conectar: erro inesperado (%d)"
#, fuzzy, c-format
#~ msgid "Signal %s received, reloading configuration..."
#~ msgstr "Sinal %s recebido, a sair do WeeChat..."
#, c-format
#~ msgid "Signal %s received, exiting WeeChat..."
#~ msgstr "Sinal %s recebido, a sair do WeeChat..."
#, fuzzy
#~ msgid "secured data: names and values"
#~ msgstr "Dados protegidos \"%s\" eliminados"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+0100\n"
"PO-Revision-Date: 2021-03-05 20:43+0100\n"
"Last-Translator: Érico Nogueira <ericonr@disroot.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -4382,6 +4382,14 @@ msgstr ""
msgid "save configuration files when unloading plugins"
msgstr "salvar arquivos de configurações quando descarregar plugins"
#, fuzzy
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr ""
"comando executado quando o WeeChat inicia, após o carregamento dos plugins "
"(nota: o conteúdo é avaliado, veja /help eval)"
msgid "FATAL: error initializing configuration options"
msgstr "FATAL: erro inicializando opções de configuração"
@ -4783,14 +4791,6 @@ msgstr "Cores do WeeChat (em uso: %d, sobram: %d):"
msgid "Terminal lost, exiting WeeChat..."
msgstr "Terminal perdido, saindo do WeeChat..."
#, fuzzy, c-format
msgid "Signal %s received, reloading configuration..."
msgstr "Sinal %s recebido, saindo do WeeChat..."
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr "Sinal %s recebido, saindo do WeeChat..."
msgid "Mouse is enabled"
msgstr "Mouse está habilitado"
@ -12963,6 +12963,14 @@ msgstr "%s%s: tempo esgotado para \"%s\" com %s"
msgid "%s%s: unable to connect: unexpected error (%d)"
msgstr "%s%s: não foi possível conectar ao remetente"
#, fuzzy, c-format
#~ msgid "Signal %s received, reloading configuration..."
#~ msgstr "Sinal %s recebido, saindo do WeeChat..."
#, c-format
#~ msgid "Signal %s received, exiting WeeChat..."
#~ msgstr "Sinal %s recebido, saindo do WeeChat..."
#, fuzzy
#~ msgid "secured data: names and values"
#~ msgstr "Dados seguros \"%s\" deletados"

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+0100\n"
"PO-Revision-Date: 2021-02-06 15:55+0100\n"
"Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3779,6 +3779,12 @@ msgstr ""
msgid "save configuration files when unloading plugins"
msgstr "сохранять конфигурационный файл при выходе"
#, fuzzy
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr "ник, используемый на IRC сервере"
#, fuzzy
msgid "FATAL: error initializing configuration options"
msgstr "перезагрузить конфигурационный файл сервера"
@ -4199,14 +4205,6 @@ msgstr ""
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
#, c-format
msgid "Signal %s received, reloading configuration..."
msgstr ""
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr ""
#, fuzzy
msgid "Mouse is enabled"
msgstr "команда users отключена"

View File

@ -78,6 +78,8 @@ SET(WEECHAT_SOURCES
./src/core/wee-secure-buffer.h
./src/core/wee-secure-config.c
./src/core/wee-secure-config.h
./src/core/wee-signal.c
./src/core/wee-signal.h
./src/core/wee-string.c
./src/core/wee-string.h
./src/core/wee-upgrade.c

View File

@ -20,7 +20,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+0100\n"
"PO-Revision-Date: 2021-02-06 15:55+0100\n"
"Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n"
"Language-Team: weechat-dev <weechat-dev@nongnu.org>\n"
@ -3399,6 +3399,11 @@ msgstr ""
msgid "save configuration files when unloading plugins"
msgstr ""
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr ""
msgid "FATAL: error initializing configuration options"
msgstr ""
@ -3797,14 +3802,6 @@ msgstr ""
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
#, c-format
msgid "Signal %s received, reloading configuration..."
msgstr ""
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr ""
msgid "Mouse is enabled"
msgstr ""

View File

@ -21,7 +21,7 @@ msgid ""
msgstr ""
"Project-Id-Version: WeeChat\n"
"Report-Msgid-Bugs-To: flashcode@flashtux.org\n"
"POT-Creation-Date: 2021-03-14 14:00+0100\n"
"POT-Creation-Date: 2021-03-16 18:31+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"
@ -3388,6 +3388,11 @@ msgstr ""
msgid "save configuration files when unloading plugins"
msgstr ""
msgid ""
"command to execute when the signal is received, multiple commands can be "
"separated by semicolons (note: content is evaluated, see /help eval)"
msgstr ""
msgid "FATAL: error initializing configuration options"
msgstr ""
@ -3786,14 +3791,6 @@ msgstr ""
msgid "Terminal lost, exiting WeeChat..."
msgstr ""
#, c-format
msgid "Signal %s received, reloading configuration..."
msgstr ""
#, c-format
msgid "Signal %s received, exiting WeeChat..."
msgstr ""
msgid "Mouse is enabled"
msgstr ""

View File

@ -43,6 +43,7 @@ set(LIB_CORE_SRC
wee-secure.c wee-secure.h
wee-secure-buffer.c wee-secure-buffer.h
wee-secure-config.c wee-secure-config.h
wee-signal.c wee-signal.h
wee-string.c wee-string.h
wee-upgrade.c wee-upgrade.h
wee-upgrade-file.c wee-upgrade-file.h

View File

@ -67,6 +67,8 @@ lib_weechat_core_a_SOURCES = weechat.c \
wee-secure-buffer.h \
wee-secure-config.c \
wee-secure-config.h \
wee-signal.c \
wee-signal.h \
wee-string.c \
wee-string.h \
wee-upgrade.c \

View File

@ -32,7 +32,6 @@
#include "../wee-hook.h"
#include "../wee-infolist.h"
#include "../wee-log.h"
#include "../wee-util.h"
#include "../../gui/gui-chat.h"

View File

@ -5328,22 +5328,6 @@ command_reload_file (struct t_config_file *config_file)
}
}
/*
* Reloads all configuration files.
*/
void
command_reload_files ()
{
struct t_config_file *ptr_config_file;
for (ptr_config_file = config_files; ptr_config_file;
ptr_config_file = ptr_config_file->next_config)
{
command_reload_file (ptr_config_file);
}
}
/*
* Callback for command "/reload": reloads a configuration file.
*/
@ -5378,7 +5362,11 @@ COMMAND_CALLBACK(reload)
}
else
{
command_reload_files ();
for (ptr_config_file = config_files; ptr_config_file;
ptr_config_file = ptr_config_file->next_config)
{
command_reload_file (ptr_config_file);
}
}
return WEECHAT_RC_OK;

View File

@ -89,6 +89,5 @@ extern void command_version_display (struct t_gui_buffer *buffer,
int send_to_buffer_as_input,
int translated_string,
int display_git_version);
extern void command_reload_files ();
#endif /* WEECHAT_COMMAND_H */

View File

@ -303,6 +303,14 @@ struct t_config_option *config_plugin_extension;
struct t_config_option *config_plugin_path;
struct t_config_option *config_plugin_save_config_on_unload;
/* config, signal section */
struct t_config_option *config_signal_sighup;
struct t_config_option *config_signal_sigquit;
struct t_config_option *config_signal_sigterm;
struct t_config_option *config_signal_sigusr1;
struct t_config_option *config_signal_sigusr2;
/* other */
int config_length_nick_prefix_suffix = 0;
@ -4566,6 +4574,63 @@ config_weechat_init_options ()
NULL, 0, 0, "on", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* signal */
ptr_section = config_file_new_section (weechat_config_file, "signal",
0, 0,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL,
NULL, NULL, NULL);
if (!ptr_section)
{
config_file_free (weechat_config_file);
weechat_config_file = NULL;
return 0;
}
config_signal_sighup = config_file_new_option (
weechat_config_file, ptr_section,
"sighup", "string",
N_("command to execute when the signal is received, "
"multiple commands can be separated by semicolons "
"(note: content is evaluated, see /help eval)"),
NULL, 0, 0,
"${if:${info:weechat_headless}?/reload:/quit -yes}", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
config_signal_sigquit = config_file_new_option (
weechat_config_file, ptr_section,
"sigquit", "string",
N_("command to execute when the signal is received, "
"multiple commands can be separated by semicolons "
"(note: content is evaluated, see /help eval)"),
NULL, 0, 0, "/quit -yes", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
config_signal_sigterm = config_file_new_option (
weechat_config_file, ptr_section,
"sigterm", "string",
N_("command to execute when the signal is received, "
"multiple commands can be separated by semicolons "
"(note: content is evaluated, see /help eval)"),
NULL, 0, 0, "/quit -yes", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
config_signal_sigusr1 = config_file_new_option (
weechat_config_file, ptr_section,
"sigusr1", "string",
N_("command to execute when the signal is received, "
"multiple commands can be separated by semicolons "
"(note: content is evaluated, see /help eval)"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
config_signal_sigusr2 = config_file_new_option (
weechat_config_file, ptr_section,
"sigusr2", "string",
N_("command to execute when the signal is received, "
"multiple commands can be separated by semicolons "
"(note: content is evaluated, see /help eval)"),
NULL, 0, 0, "", NULL, 0,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
/* bars */
ptr_section = config_file_new_section (
weechat_config_file, "bar",

View File

@ -346,6 +346,12 @@ extern struct t_config_option *config_plugin_extension;
extern struct t_config_option *config_plugin_path;
extern struct t_config_option *config_plugin_save_config_on_unload;
extern struct t_config_option *config_signal_sighup;
extern struct t_config_option *config_signal_sigquit;
extern struct t_config_option *config_signal_sigterm;
extern struct t_config_option *config_signal_sigusr1;
extern struct t_config_option *config_signal_sigusr2;
extern int config_length_nick_prefix_suffix;
extern int config_length_prefix_same_nick;
extern int config_length_prefix_same_nick_middle;

View File

@ -147,7 +147,7 @@ debug_dump_cb (const void *pointer, void *data,
*/
void
debug_sigsegv ()
debug_sigsegv_cb ()
{
debug_dump (1);
unhook_all ();

View File

@ -24,7 +24,7 @@
struct t_gui_window_tree;
extern void debug_sigsegv ();
extern void debug_sigsegv_cb ();
extern void debug_windows_tree ();
extern void debug_memory ();
extern void debug_hdata ();

View File

@ -35,8 +35,8 @@
#include "wee-hashtable.h"
#include "wee-infolist.h"
#include "wee-log.h"
#include "wee-signal.h"
#include "wee-string.h"
#include "wee-util.h"
#include "../gui/gui-chat.h"
#include "../plugins/plugin.h"
@ -514,7 +514,7 @@ hook_set (struct t_hook *hook, const char *property, const char *value)
if (!error || error[0])
{
/* not a number? look for signal by name */
number = util_signal_search (value);
number = signal_search_name (value);
}
if (number >= 0)
{

314
src/core/wee-signal.c Normal file
View File

@ -0,0 +1,314 @@
/*
* wee-signal.c - signal functions
*
* Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include <stdlib.h>
#include <string.h>
#include "weechat.h"
#include "wee-signal.h"
#include "wee-config.h"
#include "wee-debug.h"
#include "wee-eval.h"
#include "wee-hook.h"
#include "wee-input.h"
#include "wee-log.h"
#include "wee-string.h"
#include "../gui/gui-buffer.h"
#include "../plugins/plugin.h"
struct t_signal signal_list[] =
{ { SIGHUP, "hup" },
{ SIGINT, "int" },
{ SIGQUIT, "quit" },
{ SIGKILL, "kill" },
{ SIGTERM, "term" },
{ SIGUSR1, "usr1" },
{ SIGUSR2, "usr2" },
{ 0, NULL },
};
volatile sig_atomic_t signal_sighup_count = 0;
volatile sig_atomic_t signal_sigquit_count = 0;
volatile sig_atomic_t signal_sigterm_count = 0;
volatile sig_atomic_t signal_sigusr1_count = 0;
volatile sig_atomic_t signal_sigusr2_count = 0;
/*
* Callback for system signal SIGHUP.
*/
void
signal_sighup_cb ()
{
signal_sighup_count++;
}
/*
* Callback for system signal SIGQUIT.
*/
void
signal_sigquit_cb ()
{
signal_sigquit_count++;
}
/*
* Callback for system signal SIGTERM.
*/
void
signal_sigterm_cb ()
{
signal_sigterm_count++;
}
/*
* Callback for system signal SIGUSR1.
*/
void
signal_sigusr1_cb ()
{
signal_sigusr1_count++;
}
/*
* Callback for system signal SIGUSR2.
*/
void
signal_sigusr2_cb ()
{
signal_sigusr2_count++;
}
/*
* Gets a signal index with a signal number; only some commonly used signal
* names are supported here (see declaration of signal_list[]).
*
* Returns the index of signal in structure string_signal, -1 if not found.
*/
int
signal_search_number (int signal_number)
{
int i;
for (i = 0; signal_list[i].name; i++)
{
if (signal_list[i].signal == signal_number)
return i;
}
/* signal not found */
return -1;
}
/*
* Gets a signal number with a name; only some commonly used signal names are
* supported here (see declaration of signal_list[]).
*
* Returns the signal number, -1 if not found.
*/
int
signal_search_name (const char *name)
{
int i;
if (!name)
return -1;
for (i = 0; signal_list[i].name; i++)
{
if (string_strcasecmp (signal_list[i].name, name) == 0)
return signal_list[i].signal;
}
/* signal not found */
return -1;
}
/*
* Catches a system signal.
*/
void
signal_catch (int signum, void (*handler)(int))
{
struct sigaction act;
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
act.sa_handler = handler;
sigaction (signum, &act, NULL);
}
/*
* Sends a WeeChat signal on a system signal received.
*
* Returns:
* WEECHAT_RC_OK: the WeeChat handler must be executed
* WEECHAT_RC_OK_EAT: signal eaten, the WeeChat handler must NOT be executed
*/
int
signal_send_to_weechat (int signal_index)
{
int rc;
char str_signal[32];
if (signal_index < 0)
return WEECHAT_RC_OK;
snprintf (str_signal, sizeof (str_signal),
"signal_sig%s", signal_list[signal_index].name);
rc = hook_signal_send (str_signal, WEECHAT_HOOK_SIGNAL_STRING, NULL);
return (rc == WEECHAT_RC_OK_EAT) ? WEECHAT_RC_OK_EAT : WEECHAT_RC_OK;
}
/*
* Evaluates and executes the command bound to a signal.
*/
void
signal_exec_command (int signal_index, const char *command)
{
char *command_eval, **commands, **ptr_cmd, str_signal[32];
struct t_gui_buffer *weechat_buffer;
if (!command || !command[0])
return;
command_eval = eval_expression (command, NULL, NULL, NULL);
if (!command_eval)
return;
if (command_eval[0])
{
snprintf (str_signal, sizeof (str_signal),
"sig%s", signal_list[signal_index].name);
string_toupper (str_signal);
log_printf ("Signal %s received, executing command: %s",
str_signal, command_eval);
commands = string_split_command (command_eval, ';');
if (commands)
{
weechat_buffer = gui_buffer_search_main ();
for (ptr_cmd = commands; *ptr_cmd; ptr_cmd++)
{
(void) input_data (weechat_buffer, *ptr_cmd, NULL);
}
string_free_split_command (commands);
}
}
free (command_eval);
}
/*
* Handles a specific signal received:
*/
void
signal_handle_number (int signal_number, int count, const char *command)
{
int i, signal_index, rc;
if (count == 0)
return;
signal_index = signal_search_number (signal_number);
if (signal_index < 0)
return;
for (i = 0; i < count; i++)
{
rc = signal_send_to_weechat (signal_index);
if (rc == WEECHAT_RC_OK_EAT)
continue;
signal_exec_command (signal_index, command);
}
}
/*
* Handles signals received: sends WeeChat signal and executes the configured
* command (is signal not eaten).
*/
void
signal_handle ()
{
/* SIGUSR1 */
signal_handle_number (SIGUSR1, signal_sigusr1_count,
CONFIG_STRING(config_signal_sigusr1));
signal_sigusr1_count = 0;
/* SIGUSR2 */
signal_handle_number (SIGUSR2, signal_sigusr2_count,
CONFIG_STRING(config_signal_sigusr2));
signal_sigusr2_count = 0;
/* SIGHUP */
signal_handle_number (SIGHUP, signal_sighup_count,
CONFIG_STRING(config_signal_sighup));
signal_sighup_count = 0;
/* SIGQUIT */
signal_handle_number (SIGQUIT, signal_sigquit_count,
CONFIG_STRING(config_signal_sigquit));
signal_sigquit_count = 0;
/* SIGTERM */
signal_handle_number (SIGTERM, signal_sigterm_count,
CONFIG_STRING(config_signal_sigterm));
signal_sigterm_count = 0;
}
/*
* Initializes signal.
*/
void
signal_init ()
{
/* ignore some signals */
signal_catch (SIGINT, SIG_IGN);
signal_catch (SIGPIPE, SIG_IGN);
/* catch signals that can be customized */
signal_catch (SIGHUP, &signal_sighup_cb);
signal_catch (SIGQUIT, &signal_sigquit_cb);
signal_catch (SIGTERM, &signal_sigterm_cb);
signal_catch (SIGUSR1, &signal_sigusr1_cb);
signal_catch (SIGUSR2, &signal_sigusr2_cb);
/* in case of crash (oh no!) */
signal_catch (SIGSEGV, &debug_sigsegv_cb);
}

37
src/core/wee-signal.h Normal file
View File

@ -0,0 +1,37 @@
/*
* Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
*/
#ifndef WEECHAT_SIGNAL_H
#define WEECHAT_SIGNAL_H
struct t_signal
{
int signal; /* signal number */
char *name; /* signal name, eg "hup" for SIGHUP */
};
extern struct t_signal signal_list[];
extern int signal_search_number (int signal_number);
extern int signal_search_name (const char *name);
extern void signal_catch (int signum, void (*handler)(int));
extern void signal_handle ();
extern void signal_init ();
#endif /* WEECHAT_SIGNAL_H */

View File

@ -115,16 +115,6 @@ struct t_rlimit_resource rlimit_resource[] =
};
#endif /* HAVE_SYS_RESOURCE_H */
struct t_util_signal util_signals[] =
{ { "hup", SIGHUP },
{ "int", SIGINT },
{ "quit", SIGQUIT },
{ "kill", SIGKILL },
{ "term", SIGTERM },
{ "usr1", SIGUSR1 },
{ "usr2", SIGUSR2 },
{ NULL, 0 },
};
/*
* Sets resource limit.
@ -439,68 +429,6 @@ util_parse_delay (const char *string_delay, long default_factor)
return delay * factor;
}
/*
* Gets a signal number with a name; only some commonly used signal names are
* supported here (see declaration of util_signals[]).
*
* Returns the signal number, -1 if not found.
*/
int
util_signal_search (const char *name)
{
int i;
if (!name)
return -1;
for (i = 0; util_signals[i].name; i++)
{
if (string_strcasecmp (util_signals[i].name, name) == 0)
return util_signals[i].signal;
}
/* signal not found */
return -1;
}
/*
* Gets a signal name with a signal number; only some commonly used signal
* names are supported here (see declaration of util_signals[]).
*
* Returns the pointer to the signal name, NULL if not found.
*/
const char *
util_signal_search_number (int signal_number)
{
int i;
for (i = 0; util_signals[i].name; i++)
{
if (util_signals[i].signal == signal_number)
return util_signals[i].name;
}
/* signal not found */
return NULL;
}
/*
* Catches a system signal.
*/
void
util_catch_signal (int signum, void (*handler)(int))
{
struct sigaction act;
sigemptyset (&act.sa_mask);
act.sa_flags = 0;
act.sa_handler = handler;
sigaction (signum, &act, NULL);
}
/*
* Returns the path to a temporary directory, the first valid directory in
* this list:

View File

@ -31,14 +31,6 @@ struct t_rlimit_resource
};
#endif /* HAVE_SYS_RESOURCE_H */
struct t_util_signal
{
char *name; /* name of signal */
int signal; /* signal number */
};
extern struct t_util_signal util_signals[];
/* limits */
extern void util_setrlimit ();
@ -58,11 +50,6 @@ extern void util_get_time_diff (time_t time1, time_t time2,
extern long util_parse_delay (const char *string_delay, long default_factor);
/* signal */
extern int util_signal_search (const char *name);
extern const char *util_signal_search_number (int signal_number);
extern void util_catch_signal (int signum, void (*handler)(int));
/* files/directories */
extern char *util_get_temp_dir();
extern int util_mkdir_home (const char *directory, int mode);

View File

@ -68,6 +68,7 @@
#include "wee-proxy.h"
#include "wee-secure.h"
#include "wee-secure-config.h"
#include "wee-signal.h"
#include "wee-string.h"
#include "wee-upgrade.h"
#include "wee-utf8.h"
@ -99,7 +100,7 @@ time_t weechat_first_start_time = 0; /* start time (used by /uptime cmd) */
int weechat_upgrade_count = 0; /* number of /upgrade done */
struct timeval weechat_current_start_timeval; /* start time used to display */
/* duration of /upgrade */
volatile sig_atomic_t weechat_quit = 0; /* = 1 if quit request from user */
int weechat_quit = 0; /* = 1 if quit request from user */
volatile sig_atomic_t weechat_quit_signal = 0; /* signal received, */
/* WeeChat must quit */
volatile sig_atomic_t weechat_reload_signal = 0; /* signal received, */
@ -688,36 +689,6 @@ weechat_locale_check ()
}
}
/*
* Callback for system signal SIGHUP: reloads configuration.
*/
void
weechat_sighup ()
{
weechat_reload_signal = SIGHUP;
}
/*
* Callback for system signal SIGQUIT: quits WeeChat.
*/
void
weechat_sigquit ()
{
weechat_quit_signal = SIGQUIT;
}
/*
* Callback for system signal SIGTERM: quits WeeChat.
*/
void
weechat_sigterm ()
{
weechat_quit_signal = SIGTERM;
}
/*
* Shutdowns WeeChat.
*/
@ -786,14 +757,7 @@ 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 */
util_catch_signal (SIGPIPE, SIG_IGN); /* signal ignored */
util_catch_signal (SIGSEGV, &debug_sigsegv); /* crash dump */
util_catch_signal (SIGHUP, &weechat_sighup); /* exit WeeChat */
util_catch_signal (SIGQUIT, &weechat_sigquit); /* exit WeeChat */
util_catch_signal (SIGTERM, &weechat_sigterm); /* exit WeeChat */
signal_init (); /* initialize signals */
hdata_init (); /* initialize hdata */
hook_init (); /* initialize hooks */
debug_init (); /* hook signals for debug */

View File

@ -109,7 +109,7 @@ extern int weechat_first_start;
extern time_t weechat_first_start_time;
extern struct timeval weechat_current_start_timeval;
extern int weechat_upgrade_count;
extern volatile sig_atomic_t weechat_quit;
extern int weechat_quit;
extern volatile sig_atomic_t weechat_quit_signal;
extern volatile sig_atomic_t weechat_reload_signal;
extern char *weechat_home;

View File

@ -35,9 +35,9 @@
#include "../../core/wee-config.h"
#include "../../core/wee-hook.h"
#include "../../core/wee-log.h"
#include "../../core/wee-signal.h"
#include "../../core/wee-string.h"
#include "../../core/wee-utf8.h"
#include "../../core/wee-util.h"
#include "../../core/wee-version.h"
#include "../../plugins/plugin.h"
#include "../gui-main.h"
@ -164,10 +164,9 @@ gui_main_init ()
struct t_gui_bar_window *ptr_bar_win;
char title[256];
#ifdef WEECHAT_HEADLESS
/* allow Ctrl-C to quit WeeChat in headless mode */
util_catch_signal (SIGINT, &gui_main_signal_sigint);
#endif /* WEECHAT_HEADLESS */
if (weechat_headless)
signal_catch (SIGINT, &gui_main_signal_sigint);
initscr ();
@ -264,30 +263,6 @@ gui_main_init ()
gui_window_set_bracketed_paste_mode (CONFIG_BOOLEAN(config_look_paste_bracketed));
}
/*
* Returns signal name with a signal number.
*
* Note: result must be freed after use.
*/
char *
gui_main_get_signal_name (int signal_number)
{
const char *signal_name;
char str_signal[32];
signal_name = util_signal_search_number (signal_number);
if (!signal_name)
return NULL;
snprintf (str_signal, sizeof (str_signal),
"SIG%s",
signal_name);
string_toupper (str_signal);
return strdup (str_signal);
}
/*
* Callback for system signal SIGWINCH: refreshes screen.
*/
@ -298,82 +273,6 @@ gui_main_signal_sigwinch ()
gui_signal_sigwinch_received = 1;
}
/*
* Sends a WeeChat signal on a system signal received.
*
* Returns:
* WEECHAT_RC_OK: the WeeChat handler must be executed
* WEECHAT_RC_OK_EAT: signal eaten, the WeeChat handler must NOT be executed
*/
int
gui_main_handle_signal (const char *signal_name)
{
int rc;
char str_signal[32];
if (!signal_name)
return WEECHAT_RC_OK;
snprintf (str_signal, sizeof (str_signal), "signal_%s", signal_name);
string_tolower (str_signal);
rc = hook_signal_send (str_signal, WEECHAT_HOOK_SIGNAL_STRING, NULL);
return (rc == WEECHAT_RC_OK_EAT) ? WEECHAT_RC_OK_EAT : WEECHAT_RC_OK;
}
/*
* Callback for signals received that will make WeeChat reload configuration.
*/
void
gui_main_handle_reload_signal ()
{
char *signal_name;
signal_name = gui_main_get_signal_name (weechat_reload_signal);
if (gui_main_handle_signal (signal_name) != WEECHAT_RC_OK_EAT)
{
log_printf (_("Signal %s received, reloading configuration..."),
signal_name);
command_reload_files ();
}
if (signal_name)
free (signal_name);
weechat_reload_signal = 0;
}
/*
* Callback for signals received that will make WeeChat quit.
*/
void
gui_main_handle_quit_signals ()
{
char *signal_name;
signal_name = gui_main_get_signal_name (weechat_quit_signal);
if (gui_main_handle_signal (signal_name) != WEECHAT_RC_OK_EAT)
{
if (!weechat_quit)
{
log_printf (_("Signal %s received, exiting WeeChat..."),
signal_name);
(void) hook_signal_send ("quit", WEECHAT_HOOK_SIGNAL_STRING, NULL);
weechat_quit = 1;
}
}
if (signal_name)
free (signal_name);
weechat_quit_signal = 0;
}
/*
* Displays infos about ncurses lib.
*/
@ -510,7 +409,7 @@ gui_main_loop ()
/* catch SIGWINCH signal: redraw screen */
if (!weechat_headless)
util_catch_signal (SIGWINCH, &gui_main_signal_sigwinch);
signal_catch (SIGWINCH, &gui_main_signal_sigwinch);
/* hook stdin (read keyboard) */
if (weechat_headless)
@ -566,10 +465,7 @@ gui_main_loop ()
hook_process_exec ();
/* handle signals received */
if (weechat_reload_signal > 0)
gui_main_handle_reload_signal ();
if (weechat_quit_signal > 0)
gui_main_handle_quit_signals ();
signal_handle ();
}
/* remove keyboard hook */

View File

@ -34,6 +34,7 @@ set(LIB_WEECHAT_UNIT_TESTS_CORE_SRC
unit/core/test-core-infolist.cpp
unit/core/test-core-list.cpp
unit/core/test-core-secure.cpp
unit/core/test-core-signal.cpp
unit/core/test-core-string.cpp
unit/core/test-core-url.cpp
unit/core/test-core-utf8.cpp

View File

@ -31,6 +31,7 @@ lib_weechat_unit_tests_core_a_SOURCES = unit/core/test-core-arraylist.cpp \
unit/core/test-core-infolist.cpp \
unit/core/test-core-list.cpp \
unit/core/test-core-secure.cpp \
unit/core/test-core-signal.cpp \
unit/core/test-core-string.cpp \
unit/core/test-core-url.cpp \
unit/core/test-core-utf8.cpp \

View File

@ -69,6 +69,7 @@ IMPORT_TEST_GROUP(CoreHook);
IMPORT_TEST_GROUP(CoreInfolist);
IMPORT_TEST_GROUP(CoreList);
IMPORT_TEST_GROUP(CoreSecure);
IMPORT_TEST_GROUP(CoreSignal);
IMPORT_TEST_GROUP(CoreString);
IMPORT_TEST_GROUP(CoreUrl);
IMPORT_TEST_GROUP(CoreUtf8);

View File

@ -0,0 +1,161 @@
/*
* test-core-signal.cpp - test util functions
*
* Copyright (C) 2021 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 <https://www.gnu.org/licenses/>.
*/
#include "CppUTest/TestHarness.h"
extern "C"
{
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include "tests/tests.h"
#include "src/core/wee-signal.h"
}
TEST_GROUP(CoreSignal)
{
};
/*
* Tests functions:
* signal_search_number
*/
TEST(CoreSignal, SearchNumber)
{
int count, index;
/* make tests fail if the signal_list structure is changed */
for (count = 0; signal_list[count].name; count++)
{
}
LONGS_EQUAL(7, count);
POINTERS_EQUAL(-1, signal_search_number (-1));
POINTERS_EQUAL(-1, signal_search_number (999999999));
index = signal_search_number (SIGHUP);
LONGS_EQUAL(SIGHUP, signal_list[index].signal);
STRCMP_EQUAL("hup", signal_list[index].name);
index = signal_search_number (SIGINT);
LONGS_EQUAL(SIGINT, signal_list[index].signal);
STRCMP_EQUAL("int", signal_list[index].name);
index = signal_search_number (SIGQUIT);
LONGS_EQUAL(SIGQUIT, signal_list[index].signal);
STRCMP_EQUAL("quit", signal_list[index].name);
index = signal_search_number (SIGKILL);
LONGS_EQUAL(SIGKILL, signal_list[index].signal);
STRCMP_EQUAL("kill", signal_list[index].name);
index = signal_search_number (SIGTERM);
LONGS_EQUAL(SIGTERM, signal_list[index].signal);
STRCMP_EQUAL("term", signal_list[index].name);
index = signal_search_number (SIGUSR1);
LONGS_EQUAL(SIGUSR1, signal_list[index].signal);
STRCMP_EQUAL("usr1", signal_list[index].name);
index = signal_search_number (SIGUSR2);
LONGS_EQUAL(SIGUSR2, signal_list[index].signal);
STRCMP_EQUAL("usr2", signal_list[index].name);
}
/*
* Tests functions:
* signal_search_name
*/
TEST(CoreSignal, SearchName)
{
LONGS_EQUAL(-1, signal_search_name (NULL));
LONGS_EQUAL(-1, signal_search_name (""));
LONGS_EQUAL(-1, signal_search_name ("signal_does_not_exist"));
LONGS_EQUAL(SIGHUP, signal_search_name ("hup"));
LONGS_EQUAL(SIGHUP, signal_search_name ("HUP"));
LONGS_EQUAL(SIGINT, signal_search_name ("int"));
LONGS_EQUAL(SIGINT, signal_search_name ("INT"));
LONGS_EQUAL(SIGQUIT, signal_search_name ("quit"));
LONGS_EQUAL(SIGQUIT, signal_search_name ("QUIT"));
LONGS_EQUAL(SIGKILL, signal_search_name ("kill"));
LONGS_EQUAL(SIGKILL, signal_search_name ("KILL"));
LONGS_EQUAL(SIGTERM, signal_search_name ("term"));
LONGS_EQUAL(SIGTERM, signal_search_name ("TERM"));
LONGS_EQUAL(SIGUSR1, signal_search_name ("usr1"));
LONGS_EQUAL(SIGUSR1, signal_search_name ("USR1"));
LONGS_EQUAL(SIGUSR2, signal_search_name ("usr2"));
LONGS_EQUAL(SIGUSR2, signal_search_name ("USR2"));
}
/*
* Tests functions:
* signal_catch
*/
TEST(CoreSignal, Catch)
{
/* TODO: write tests */
}
/*
* Tests functions:
* signal_send_to_weechat
*/
TEST(CoreSignal, SentToWeechat)
{
/* TODO: write tests */
}
/*
* Tests functions:
* signal_exec_command
*/
TEST(CoreSignal, ExecCommand)
{
/* TODO: write tests */
}
/*
* Tests functions:
* signal_handle_number
*/
TEST(CoreSignal, HandleNumber)
{
/* TODO: write tests */
}
/*
* Tests functions:
* signal_handle
*/
TEST(CoreSignal, Handle)
{
/* TODO: write tests */
}

View File

@ -26,7 +26,6 @@ extern "C"
#include <unistd.h>
#include <stdio.h>
#include <string.h>
#include <signal.h>
#include <sys/time.h>
#include "src/core/wee-string.h"
#include "src/core/wee-util.h"
@ -223,71 +222,6 @@ TEST(CoreUtil, ParseDelay)
LONGS_EQUAL(123 * 1000 * 60 * 60, util_parse_delay ("123h", 1000));
}
/*
* Tests functions:
* util_signal_search
*/
TEST(CoreUtil, SignalSearch)
{
int count;
/* make tests fail if the util_signals structure is changed */
for (count = 0; util_signals[count].name; count++)
{
}
LONGS_EQUAL(7, count);
LONGS_EQUAL(-1, util_signal_search (NULL));
LONGS_EQUAL(-1, util_signal_search (""));
LONGS_EQUAL(-1, util_signal_search ("signal_does_not_exist"));
LONGS_EQUAL(SIGHUP, util_signal_search ("hup"));
LONGS_EQUAL(SIGINT, util_signal_search ("int"));
LONGS_EQUAL(SIGQUIT, util_signal_search ("quit"));
LONGS_EQUAL(SIGKILL, util_signal_search ("kill"));
LONGS_EQUAL(SIGTERM, util_signal_search ("term"));
LONGS_EQUAL(SIGUSR1, util_signal_search ("usr1"));
LONGS_EQUAL(SIGUSR2, util_signal_search ("usr2"));
LONGS_EQUAL(SIGHUP, util_signal_search ("HUP"));
LONGS_EQUAL(SIGINT, util_signal_search ("INT"));
LONGS_EQUAL(SIGQUIT, util_signal_search ("QUIT"));
LONGS_EQUAL(SIGKILL, util_signal_search ("KILL"));
LONGS_EQUAL(SIGTERM, util_signal_search ("TERM"));
LONGS_EQUAL(SIGUSR1, util_signal_search ("USR1"));
LONGS_EQUAL(SIGUSR2, util_signal_search ("USR2"));
}
/*
* Tests functions:
* util_signal_search_number
*/
TEST(CoreUtil, SignalSearchNumber)
{
POINTERS_EQUAL(NULL, util_signal_search_number (-1));
POINTERS_EQUAL(NULL, util_signal_search_number (999999999));
STRCMP_EQUAL("hup", util_signal_search_number (SIGHUP));
STRCMP_EQUAL("int", util_signal_search_number (SIGINT));
STRCMP_EQUAL("quit", util_signal_search_number (SIGQUIT));
STRCMP_EQUAL("kill", util_signal_search_number (SIGKILL));
STRCMP_EQUAL("term", util_signal_search_number (SIGTERM));
STRCMP_EQUAL("usr1", util_signal_search_number (SIGUSR1));
STRCMP_EQUAL("usr2", util_signal_search_number (SIGUSR2));
}
/*
* Tests functions:
* util_catch_signal
*/
TEST(CoreUtil, CatchSignal)
{
/* TODO: write tests */
}
/*
* Tests functions:
* util_mkdir_home