diff options
-rw-r--r-- | ChangeLog.adoc | 1 | ||||
-rw-r--r-- | doc/de/autogen/user/exec_commands.adoc | 93 | ||||
-rw-r--r-- | doc/en/autogen/user/exec_commands.adoc | 3 | ||||
-rw-r--r-- | doc/fr/autogen/user/exec_commands.adoc | 3 | ||||
-rw-r--r-- | doc/it/autogen/user/exec_commands.adoc | 3 | ||||
-rw-r--r-- | doc/ja/autogen/user/exec_commands.adoc | 93 | ||||
-rw-r--r-- | doc/pl/autogen/user/exec_commands.adoc | 93 | ||||
-rw-r--r-- | po/cs.po | 9 | ||||
-rw-r--r-- | po/de.po | 10 | ||||
-rw-r--r-- | po/es.po | 9 | ||||
-rw-r--r-- | po/fr.po | 18 | ||||
-rw-r--r-- | po/hu.po | 9 | ||||
-rw-r--r-- | po/it.po | 9 | ||||
-rw-r--r-- | po/ja.po | 10 | ||||
-rw-r--r-- | po/pl.po | 10 | ||||
-rw-r--r-- | po/pt.po | 10 | ||||
-rw-r--r-- | po/pt_BR.po | 9 | ||||
-rw-r--r-- | po/ru.po | 9 | ||||
-rw-r--r-- | po/tr.po | 9 | ||||
-rw-r--r-- | po/weechat.pot | 9 | ||||
-rw-r--r-- | src/plugins/exec/exec-command.c | 23 | ||||
-rw-r--r-- | src/plugins/exec/exec-command.h | 1 | ||||
-rw-r--r-- | src/plugins/exec/exec.c | 77 | ||||
-rw-r--r-- | src/plugins/exec/exec.h | 1 |
24 files changed, 311 insertions, 210 deletions
diff --git a/ChangeLog.adoc b/ChangeLog.adoc index 593b0d819..d54590a64 100644 --- a/ChangeLog.adoc +++ b/ChangeLog.adoc @@ -26,6 +26,7 @@ New features:: * core: add option "time" in command /debug * api: add info "uptime" (WeeChat uptime) * api: add info "pid" (WeeChat PID) (issue #850) + * exec: add option "-oc" in command /exec to execute commands in process output, don't execute commands by default with "-o" (issue #877) * fifo: add file fifo.conf and option fifo.file.path to customize FIFO pipe path/filename (issue #850) * irc: add server option "usermode" (issue #377, issue #820) * irc: add tag "self_msg" on self messages (issue #840) diff --git a/doc/de/autogen/user/exec_commands.adoc b/doc/de/autogen/user/exec_commands.adoc index b2c06eba5..8274508ea 100644 --- a/doc/de/autogen/user/exec_commands.adoc +++ b/doc/de/autogen/user/exec_commands.adoc @@ -16,54 +16,55 @@ -set <id> <property> <value> -del <id>|-all [<id>...] - -list: zeigt laufende Befehle an - -sh: es wird die shell verwendet um Befehle auszuführen (WARNUNG: Dieses Argument sollte nur verwendet werden, falls alle Argumente unbedenklich sind, siehe Argument -nosh) - -nosh: die shell wird nicht verwendet um Befehle auszuführen (wird benötigt, falls der Befehl mit sensiblen Daten hantiert. Zum Beispiel der Inhalt einer Nachricht eines anderen Users) - -bg: führt Prozess im Hintergrund aus: gibt weder eine Prozessausgabe noch einen Rückgabewert aus (nicht kompatibel mit Argumenten -o/-n) - -nobg: gibt Prozessausgabe und Rückgabewert aus (Standardverhalten) - -stdin: erstellt eine PIPE um Daten zu dem Prozess zu senden (mittels /exec -in/-inclose) --nostdin: es wird keine PIPE für stdin erstellt (Standardverhalten) - -buffer: zeigt/sendet Ausgabe des Befehls an diesen Buffer (wird der angegebene Buffer nicht gefunden wird ein neuer Buffer mit dem Namen "exec.exec.xxx" erstellt) - -l: gibt die Ausgabe des Befehls lokal im Buffer aus (Standardverhalten) - -o: gibt die Ausgabe des Befehls im Buffer aus (nicht kompatibel mit Argument -bg) - -n: gibt die Ausgabe des Befehls in einem neuen Buffer aus (nicht kompatibel mit Argument -bg) - -nf: gibt die Ausgabe des Befehls in einem neuen Buffer, mit einem freien Inhalt (kein Zeilenumbruch, keine Limitierung in der Anzahl der Zeilen), aus (nicht kompatibel mit Argument -bg) - -cl: der neue Buffer wird vor einer Ausgabe gelöscht - -nocl: Ausgabe wird an neuen Buffer angehangen, ohne diesen vorher zu löschen (Standardverhalten) - -sw: es wird zum Ausgabebuffer gewechselt (Standardverhalten) - -nosw: es wird nicht zum Ausgabebuffer gewechselt - -ln: legt eine Zeilennummerierung an (Standardverhalten, nur für neue Buffer) - -noln: es wird keine Zeilennummerierung angezeigt - -flush: die Ausgabe des Befehls findet in Echtzeit statt (Standardwert) --noflush: die Ausgabe des Befehls wird am Ende der Ausführung ausgegeben - -color: es wird eine der folgenden Aktionen bei ANSI Zeichenkodierungen in der Ausgabe durchgeführt: - ansi: ANSI-Kodierung wird beibehalten - auto: konvertiert ANSI-Farben nach WeeChat/IRC (Standardverhalten) - irc: konvertiert ANSI-Farben nach IRC Farben - weechat: konvertiert ANSI-Farben nach WeeChat-Farben - strip: ANSI-Farben werden entfernt - -rc: der Rückgabewert wird ausgegeben (Standardverhalten) - -norc: der Rückgabewert wird unterdrückt --timeout: gibt eine Zeitbeschränkung für den auszuführenden Befehl an (in Sekunden) - -name: dem Befehl wird ein Name zugewiesen (um den Befehl später mittels /exec zu nutzen) - -pipe: sendet die Ausgabe an einen Befehl von WeeChat/Erweiterung (Zeile für Zeile); sollen Leerzeichen im Befehl/Argument verwendet werden, müssen diese mit Anführungszeichen eingeschlossen werden; Variable $line wird durch die entsprechende Zeile ersetzt (standardmäßig wird die Zeile, getrennt durch ein Leerzeichen, dem Befehl nachgestellt (nicht kompatibel mit den Argumenten -bg/-o/-n) - -hsignal: sendet die Ausgabe als hsignal (um es z.B. mittels /trigger zu verwenden) (nicht kompatibel mit den Argumenten -bg/-o/-n) - command: Befehl der ausgeführt werden soll; beginnt der Befehl mit "url:", wird die shell deaktiviert und der Inhalt der URL wird heruntergeladen und im Buffer ausgegeben - id: identifiziert eindeutig einen Befehl: entweder durch eine Nummer oder einen Namen (sofern ein Name mittels "-name xxx" zugewiesen wurde) - -in: sendet Text an die Standardeingabe des Prozesses --inclose: wie -in aber stdin wird danach geschlossen (und der Text ist optional: ohne Text wird stdin umgehend geschlossen - -signal: schickt ein Signal an den Prozess; das Signal kann entweder ein Integerwert oder eines der folgenden Schlüsselworte sein: hup, int, quit, kill, term, usr1, usr2 - -kill: Alias für "-signal <id> kill" --killall: beendet alle laufenden Prozesse - -set: nutzt eine Hook-Fähigkeit (siehe Funktion hook_set in Anleitung für API Erweiterung) -property: Hook-Fähigkeit - value: neuer Wert für Hook-Fähigkeit - -del: entfernt einen beendeten Befehl - -all: entfernt alle beendeten Befehle + -list: list commands + -sh: use the shell to execute the command (WARNING: use this option ONLY if all arguments are safe, see option -nosh) + -nosh: do not use the shell to execute the command (required if the command has some unsafe data, for example the content of a message from another user) (default) + -bg: run process in background: do not display process output neither return code (not compatible with options -o/-n) + -nobg: catch process output and display return code (default) + -stdin: create a pipe for sending data to the process (with /exec -in/-inclose) +-nostdin: do not create a pipe for stdin (default) + -buffer: display/send output of command on this buffer (if the buffer is not found, a new buffer with name "exec.exec.xxx" is created) + -l: display locally output of command on buffer (default) + -o: send output of command to the buffer without executing commands (not compatible with option -bg) + -oc: send output of command to the buffer and execute commands (lines starting with "/" or another custom command char) (not compatible with option -bg) + -n: display output of command in a new buffer (not compatible with option -bg) + -nf: display output of command in a new buffer with free content (no word-wrap, no limit on number of lines) (not compatible with option -bg) + -cl: clear the new buffer before displaying output + -nocl: append to the new buffer without clear (default) + -sw: switch to the output buffer (default) + -nosw: don't switch to the output buffer + -ln: display line numbers (default in new buffer only) + -noln: don't display line numbers + -flush: display output of command in real time (default) +-noflush: display output of command after its end + -color: action on ANSI colors in output: + ansi: keep ANSI codes as-is + auto: convert ANSI colors to WeeChat/IRC (default) + irc: convert ANSI colors to IRC colors + weechat: convert ANSI colors to WeeChat colors + strip: remove ANSI colors + -rc: display return code (default) + -norc: don't display return code +-timeout: set a timeout for the command (in seconds) + -name: set a name for the command (to name it later with /exec) + -pipe: send the output to a WeeChat/plugin command (line by line); if there are spaces in command/arguments, enclose them with double quotes; variable $line is replaced by the line (by default the line is added after the command, separated by a space) (not compatible with options -bg/-o/-n) +-hsignal: send the output as a hsignal (to be used for example in a trigger) (not compatible with options -bg/-o/-n) + command: the command to execute; if beginning with "url:", the shell is disabled and the content of URL is downloaded and sent as output + id: command identifier: either its number or name (if set with "-name xxx") + -in: send text on standard input of process +-inclose: same as -in, but stdin is closed after (and text is optional: without text, the stdin is just closed) + -signal: send a signal to the process; the signal can be an integer or one of these names: hup, int, quit, kill, term, usr1, usr2 + -kill: alias of "-signal <id> kill" +-killall: kill all running processes + -set: set a hook property (see function hook_set in plugin API reference) +property: hook property + value: new value for hook property + -del: delete a terminated command + -all: delete all terminated commands -Standardoptionen können in der Einstellung exec.command.default_options bestimmt werden. +Default options can be set in the option exec.command.default_options. -Beispiele: +Examples: /exec -n ls -l /tmp /exec -sh -n ps xu | grep weechat /exec -n -norc url:http://pastebin.com/raw.php?i=xxxxxxxx diff --git a/doc/en/autogen/user/exec_commands.adoc b/doc/en/autogen/user/exec_commands.adoc index 58379f69c..95cd28808 100644 --- a/doc/en/autogen/user/exec_commands.adoc +++ b/doc/en/autogen/user/exec_commands.adoc @@ -25,7 +25,8 @@ -nostdin: do not create a pipe for stdin (default) -buffer: display/send output of command on this buffer (if the buffer is not found, a new buffer with name "exec.exec.xxx" is created) -l: display locally output of command on buffer (default) - -o: send output of command to the buffer (not compatible with option -bg) + -o: send output of command to the buffer without executing commands (not compatible with option -bg) + -oc: send output of command to the buffer and execute commands (lines starting with "/" or another custom command char) (not compatible with option -bg) -n: display output of command in a new buffer (not compatible with option -bg) -nf: display output of command in a new buffer with free content (no word-wrap, no limit on number of lines) (not compatible with option -bg) -cl: clear the new buffer before displaying output diff --git a/doc/fr/autogen/user/exec_commands.adoc b/doc/fr/autogen/user/exec_commands.adoc index 957310568..7982cacea 100644 --- a/doc/fr/autogen/user/exec_commands.adoc +++ b/doc/fr/autogen/user/exec_commands.adoc @@ -25,7 +25,8 @@ -nostdin : ne pas créer de tuyau pour l'entrée standard (par défaut) -buffer : afficher/envoyer la sortie de la commande sur ce tampon (si le tampon n'est pas trouvé, un nouveau tampon avec le nom "exec.exec.xxx" est créé) -l : afficher localement la sortie de la commande sur le tampon (par défaut) - -o : envoyer la sortie de la commande au tampon (non compatible avec l'option -bg) + -o : envoyer la sortie de la commande au tampon sans exécuter les commandes (non compatible avec l'option -bg) + -oc : envoyer la sortie de la commande au tampon et exécuter les commandes (lignes commençant par "/" ou un caractère personnalisé de commande) (non compatible avec l'option -bg) -n : afficher la sortie de la commande dans un nouveau tampon (non compatible avec l'option -bg) -nf : afficher la sortie de la commande dans un nouveau tampon avec contenu libre (pas de coupure des mots, pas de limite sur le nombre de lignes) (non compatible avec l'option -bg) -cl : effacer le nouveau tampon avant d'afficher la sortie diff --git a/doc/it/autogen/user/exec_commands.adoc b/doc/it/autogen/user/exec_commands.adoc index 58379f69c..95cd28808 100644 --- a/doc/it/autogen/user/exec_commands.adoc +++ b/doc/it/autogen/user/exec_commands.adoc @@ -25,7 +25,8 @@ -nostdin: do not create a pipe for stdin (default) -buffer: display/send output of command on this buffer (if the buffer is not found, a new buffer with name "exec.exec.xxx" is created) -l: display locally output of command on buffer (default) - -o: send output of command to the buffer (not compatible with option -bg) + -o: send output of command to the buffer without executing commands (not compatible with option -bg) + -oc: send output of command to the buffer and execute commands (lines starting with "/" or another custom command char) (not compatible with option -bg) -n: display output of command in a new buffer (not compatible with option -bg) -nf: display output of command in a new buffer with free content (no word-wrap, no limit on number of lines) (not compatible with option -bg) -cl: clear the new buffer before displaying output diff --git a/doc/ja/autogen/user/exec_commands.adoc b/doc/ja/autogen/user/exec_commands.adoc index a5015fa53..e20e80b77 100644 --- a/doc/ja/autogen/user/exec_commands.adoc +++ b/doc/ja/autogen/user/exec_commands.adoc @@ -16,54 +16,55 @@ -set <id> <property> <value> -del <id>|-all [<id>...] - -list: コマンドをリストアップ - -sh: コマンドを実行する際にシェルを使う (警告: このオプションを使えるのは、全ての引数が安全な場合だけです、オプション -nosh を参照) - -nosh: コマンドを実行する際にシェルを使わない (コマンドに安全でないデータが含まれる場合に必要、例えば他のユーザからのメッセージの内容) (デフォルト) - -bg: プロセスをバックグラウンド実行: プロセスの出力およびリターンコードを表示しない (オプション -o/-n と互換性はありません) - -nobg: プロセスの出力を受け取り、リターンコードを表示する (デフォルト) - -stdin: プロセスにデータを送信するパイプを作成する (/exec -in/-inclose を使う) --nostdin: 標準入力用にパイプを作成しない (デフォルト) - -buffer: コマンドの出力をこのバッファに表示 / 送信する (バッファが見つからない場合、新しいバッファ "exec.exec.xxx" が作られます) - -l: コマンドの出力をカレントバッファに表示 (デフォルト) - -o: コマンドの出力をカレントバッファに送信 (オプション -bg と互換性はありません) - -n: コマンドの出力を新しいバッファに表示 (オプション -bg と互換性はありません) - -nf: コマンドの出力を自由内容 (禁則処理なし、行数制限なし) の新しいバッファに表示 (オプション -bg と互換性はありません) - -cl: 出力を表示する前に新しいバッファをクリア - -nocl: 新しいバッファをクリアせずに追加 (デフォルト) - -sw: 出力バッファに移動 (デフォルト) - -nosw: 出力バッファに移動しない - -ln: 行数を表示 (新しいバッファに表示する場合はデフォルト) - -noln: 行数を表示しない - -flush: コマンドの出力をすぐに表示 (デフォルト) --noflush: コマンドの出力をコマンドの終了後に表示 - -color: 出力に含まれる ANSI 色に対する挙動: - ansi: ANSI 色をそのままにする - auto: ANSI 色を WeeChat/IRC 色に変換 (デフォルト) - irc: ANSI 色を IRC 色に変換 - weechat: ANSI 色を WeeChat 色に変換 - strip: ANSI 色を削除 - -rc: リターンコードを表示 (デフォルト) - -norc: リターンコードを表示しない --timeout: コマンドのタイムアウトを設定 (秒単位) - -name: コマンドの名前を設定 (後から名前を付けるには /exec を使う) - -pipe: WeeChat およびプラグインコマンドに出力を送信 (1 行ごと); コマンドおよび引数に空白が含まれる場合、2 重引用符で囲ってください; 引数 $line はその行で置換されます (デフォルトではコマンドの後ろに空白を付けてから行を追加します) (オプション -bg/-o/-n と互換性はありません) --hsignal: hsignal として出力を送信 (例えばトリガで使われます) (オプション -bg/-o/-n と互換性はありません) - command: 実行するコマンド; "url:" で始まる場合、シェルは無効化され、URL の内容がダウンロードされ、出力として送信されます - id: コマンド識別子: 番号か名前 ("-name xxx" で設定した場合) のどちらか一方 - -in: プロセスの標準入力にテキストを送信 --inclose: -in と同じ、ただし使用後に標準入力を閉じる (テキストは任意: テキストが無い場合、標準入力をすぐに閉じる) - -signal: プロセスにシグナルを送信; シグナルは整数値または次の名前の 1 つ: hup、int、quit、kill、term、usr1、usr2 - -kill: "-signal <id> kill" のエイリアス --killall: 全ての実行中プロセスを kill する - -set: フックプロパティを設定 (プラグイン API リファレンスの hook_set 関数を参照) -property: フックプロパティ - value: フックプロパティの新しい値 - -del: 中断されたコマンドを削除 - -all: 全ての中断されたコマンドを削除 + -list: list commands + -sh: use the shell to execute the command (WARNING: use this option ONLY if all arguments are safe, see option -nosh) + -nosh: do not use the shell to execute the command (required if the command has some unsafe data, for example the content of a message from another user) (default) + -bg: run process in background: do not display process output neither return code (not compatible with options -o/-n) + -nobg: catch process output and display return code (default) + -stdin: create a pipe for sending data to the process (with /exec -in/-inclose) +-nostdin: do not create a pipe for stdin (default) + -buffer: display/send output of command on this buffer (if the buffer is not found, a new buffer with name "exec.exec.xxx" is created) + -l: display locally output of command on buffer (default) + -o: send output of command to the buffer without executing commands (not compatible with option -bg) + -oc: send output of command to the buffer and execute commands (lines starting with "/" or another custom command char) (not compatible with option -bg) + -n: display output of command in a new buffer (not compatible with option -bg) + -nf: display output of command in a new buffer with free content (no word-wrap, no limit on number of lines) (not compatible with option -bg) + -cl: clear the new buffer before displaying output + -nocl: append to the new buffer without clear (default) + -sw: switch to the output buffer (default) + -nosw: don't switch to the output buffer + -ln: display line numbers (default in new buffer only) + -noln: don't display line numbers + -flush: display output of command in real time (default) +-noflush: display output of command after its end + -color: action on ANSI colors in output: + ansi: keep ANSI codes as-is + auto: convert ANSI colors to WeeChat/IRC (default) + irc: convert ANSI colors to IRC colors + weechat: convert ANSI colors to WeeChat colors + strip: remove ANSI colors + -rc: display return code (default) + -norc: don't display return code +-timeout: set a timeout for the command (in seconds) + -name: set a name for the command (to name it later with /exec) + -pipe: send the output to a WeeChat/plugin command (line by line); if there are spaces in command/arguments, enclose them with double quotes; variable $line is replaced by the line (by default the line is added after the command, separated by a space) (not compatible with options -bg/-o/-n) +-hsignal: send the output as a hsignal (to be used for example in a trigger) (not compatible with options -bg/-o/-n) + command: the command to execute; if beginning with "url:", the shell is disabled and the content of URL is downloaded and sent as output + id: command identifier: either its number or name (if set with "-name xxx") + -in: send text on standard input of process +-inclose: same as -in, but stdin is closed after (and text is optional: without text, the stdin is just closed) + -signal: send a signal to the process; the signal can be an integer or one of these names: hup, int, quit, kill, term, usr1, usr2 + -kill: alias of "-signal <id> kill" +-killall: kill all running processes + -set: set a hook property (see function hook_set in plugin API reference) +property: hook property + value: new value for hook property + -del: delete a terminated command + -all: delete all terminated commands -オプション exec.command.default_options でデフォルトオプションの設定が可能です。 +Default options can be set in the option exec.command.default_options. -例: +Examples: /exec -n ls -l /tmp /exec -sh -n ps xu | grep weechat /exec -n -norc url:http://pastebin.com/raw.php?i=xxxxxxxx diff --git a/doc/pl/autogen/user/exec_commands.adoc b/doc/pl/autogen/user/exec_commands.adoc index 1990fd63a..c6115263a 100644 --- a/doc/pl/autogen/user/exec_commands.adoc +++ b/doc/pl/autogen/user/exec_commands.adoc @@ -16,54 +16,55 @@ -set <id> <właściwość> <wartość> -del <id>|-all [<id>...] - -list: lista komend - -sh: użyj powłoki do wykonania komendy (UWAGA: użyj tej opcji TYLKO jeśli wszystkie argumenty są bezpieczne, zobacz opcję -nosh) - -nosh: nie używaj powłoki do wykonania komendy (wymagane jeśli komenda posiada niebezpieczne dane, na przykład zawartość wiadomości od innego użytkownika) (domyślne) - -bg: uruchom proces w tle: nie wyświetlaj wyjścia z procesu ani zwracanego kodu (nie kompatybilne z opcjami -o/-n) - -nobg: przechwyć całość wyjścia z procesu i wyświetl kod wyjścia (domyślne) - -stdin: tworzy strumień do wysyłania danych do procesu (za pomocą /exec -in/-inclose) --nostdin: nie twórz strumienia dla stdin (domyślne) - -buffer: wyświetl/wyślij wyjście komendy do tego bufora (jeśli bufor nie zostanie znaleziony zostanie utworzony nowy bufor o nazwie "exec.exec.xxx") - -l: wyświetl lokalnie wyście z komendy w buforze (domyślne) - -o: wyślij wyjście z komendy do bufora (nie kompatybilne z opcją -bg) - -n: wyświetl wyjście komendy w nowym buforze (nie kompatybilne z opcją -bg) - -nf: wyświetl wyjście komendy w nowym buforze z wolna zawartością (brak zawijania słów, bez limitu ilości linii) (nie kompatybilne z opcją -bg) - -cl: wyczyść nowy bufor przed wyświetleniem wyjścia - -nocl: dodaj do nowego bufora bez czyszczenia zawartości (domyślne) - -sw: przełącz na bufor wyjściowy (domyślne) - -nosw: nie przełączaj na bufor wyjściowy - -ln: wyświetl numery linii (domyślne tylko w nowym buforze) - -noln: nie wyświetlaj numerów linii - -flush: wyświetl wyjście z komendy w czasie rzeczywistym (domyślne) --noflush: wyświetl wyjście z komendy po jej zakończeniu - -color: akcja na kolorach ANSI w wyjściu: - ansi: zachowaj kody ANSI - auto: konwertuj kolory ANSI na WeeChat/IRC (domyślne) - irc: konwertuj kolory ANSI na kolory IRC - weechat: konwertuj kolory ANSI na kolory WeeChat - strip: usuń kolory ANSI - -rc: wyświetl kod wyjścia (domyślne) - -norc: nie wyświetlaj kodu wyjścia --timeout: ustaw timeout dla komendy (w sekundach) - -name: ustaw nazwę dla komendy (do wywołania później za pomocą /exec) - -pipe: wyślij wyjście do WeeChat/wtyczki (linia po linii); jeśli występują spacje w komendzie/argumentach, otocz je cudzysłowem; zmienna $line jest zastępowana przez linie (domyślnie linia jest dodawana za komendą, oddzielona spacją) (nie kompatybilne z opcjami -bg/-o/-n) --hsignal: wyślij wyjście jako hsignal (w celu użycia na przykład w triggerze) (nie kompatybilne z opcjami -bg/-o/-n) - komenda: komenda do wykonania; jeśli zaczyna się od "url:", powłoka jest wyłączana i zawartość URLa jest pobierana i wysyłana jako wyjście - id: identyfikator komendy: numer lub nazwa (jeśli ustawiona przez "-name xxx") - -in: wyślij tekst na standardowe wejście procesu --inclose: to samo co -in, ale stdin jest zamykane (tekst jest opcjonalny: bez niego stdin jest po prostu zamykane) - -signal: wysyła sygnał do procesu; sygnał może być liczbą całkowitą lub jedna z nazw: hup, int, quit, kill, term, usr1, usr2 - -kill: alias dla "-signal <id> kill" --killall: zabija wszystkie działające procesy - -set: ustawia przypisaną właściwość (zobacz funkcję hook_set w opisie API wtyczek) -właściwość: przypisana właściwość - wartość: nowa wartość - -del: usuń zakończoną komendę - -all: usuń wszystkie zakończone komendy + -list: list commands + -sh: use the shell to execute the command (WARNING: use this option ONLY if all arguments are safe, see option -nosh) + -nosh: do not use the shell to execute the command (required if the command has some unsafe data, for example the content of a message from another user) (default) + -bg: run process in background: do not display process output neither return code (not compatible with options -o/-n) + -nobg: catch process output and display return code (default) + -stdin: create a pipe for sending data to the process (with /exec -in/-inclose) +-nostdin: do not create a pipe for stdin (default) + -buffer: display/send output of command on this buffer (if the buffer is not found, a new buffer with name "exec.exec.xxx" is created) + -l: display locally output of command on buffer (default) + -o: send output of command to the buffer without executing commands (not compatible with option -bg) + -oc: send output of command to the buffer and execute commands (lines starting with "/" or another custom command char) (not compatible with option -bg) + -n: display output of command in a new buffer (not compatible with option -bg) + -nf: display output of command in a new buffer with free content (no word-wrap, no limit on number of lines) (not compatible with option -bg) + -cl: clear the new buffer before displaying output + -nocl: append to the new buffer without clear (default) + -sw: switch to the output buffer (default) + -nosw: don't switch to the output buffer + -ln: display line numbers (default in new buffer only) + -noln: don't display line numbers + -flush: display output of command in real time (default) +-noflush: display output of command after its end + -color: action on ANSI colors in output: + ansi: keep ANSI codes as-is + auto: convert ANSI colors to WeeChat/IRC (default) + irc: convert ANSI colors to IRC colors + weechat: convert ANSI colors to WeeChat colors + strip: remove ANSI colors + -rc: display return code (default) + -norc: don't display return code +-timeout: set a timeout for the command (in seconds) + -name: set a name for the command (to name it later with /exec) + -pipe: send the output to a WeeChat/plugin command (line by line); if there are spaces in command/arguments, enclose them with double quotes; variable $line is replaced by the line (by default the line is added after the command, separated by a space) (not compatible with options -bg/-o/-n) +-hsignal: send the output as a hsignal (to be used for example in a trigger) (not compatible with options -bg/-o/-n) + command: the command to execute; if beginning with "url:", the shell is disabled and the content of URL is downloaded and sent as output + id: command identifier: either its number or name (if set with "-name xxx") + -in: send text on standard input of process +-inclose: same as -in, but stdin is closed after (and text is optional: without text, the stdin is just closed) + -signal: send a signal to the process; the signal can be an integer or one of these names: hup, int, quit, kill, term, usr1, usr2 + -kill: alias of "-signal <id> kill" +-killall: kill all running processes + -set: set a hook property (see function hook_set in plugin API reference) +property: hook property + value: new value for hook property + -del: delete a terminated command + -all: delete all terminated commands -Domyślne opcje moga być ustawione za pomocą opcji exec.command.default_options. +Default options can be set in the option exec.command.default_options. -Przykłady: +Examples: /exec -n ls -l /tmp /exec -sh -n ps xu | grep weechat /exec -n -norc url:http://pastebin.com/raw.php?i=xxxxxxxx @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+0100\n" "PO-Revision-Date: 2016-09-03 08:23+0200\n" "Last-Translator: Ondřej Súkup <mimi.vx@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5013,8 +5013,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " @@ -19,7 +19,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+0100\n" "PO-Revision-Date: 2017-01-01 12:29+0100\n" "Last-Translator: Nils Görs <weechatter@arcor.de>\n" "Language-Team: German <kde-i18n-de@kde.org>\n" @@ -5869,6 +5869,7 @@ msgstr "" "<id> [<text>] || -signal <id> <signal> || -kill <id> || -killall || -set " "<id> <property> <value> || -del <id>|-all [<id>...]" +#, fuzzy msgid "" " -list: list commands\n" " -sh: use the shell to execute the command (WARNING: use this option " @@ -5885,8 +5886,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " @@ -22,7 +22,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+0100\n" "PO-Revision-Date: 2016-09-03 08:23+0200\n" "Last-Translator: Elián Hanisch <lambdae2@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5227,8 +5227,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " @@ -21,8 +21,8 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-12-31 18:22+0100\n" -"PO-Revision-Date: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+0100\n" +"PO-Revision-Date: 2017-01-06 19:21+0100\n" "Last-Translator: Sébastien Helleu <flashcode@flashtux.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" "Language: fr\n" @@ -5758,8 +5758,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " @@ -5838,8 +5841,11 @@ msgstr "" "créé)\n" " -l : afficher localement la sortie de la commande sur le tampon (par " "défaut)\n" -" -o : envoyer la sortie de la commande au tampon (non compatible avec " -"l'option -bg)\n" +" -o : envoyer la sortie de la commande au tampon sans exécuter les " +"commandes (non compatible avec l'option -bg)\n" +" -oc : envoyer la sortie de la commande au tampon et exécuter les " +"commandes (lignes commençant par \"/\" ou un caractère personnalisé de " +"commande) (non compatible avec l'option -bg)\n" " -n : afficher la sortie de la commande dans un nouveau tampon (non " "compatible avec l'option -bg)\n" " -nf : afficher la sortie de la commande dans un nouveau tampon avec " @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+0100\n" "PO-Revision-Date: 2016-09-03 08:23+0200\n" "Last-Translator: Andras Voroskoi <voroskoi@frugalware.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4550,8 +4550,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+0100\n" "PO-Revision-Date: 2016-09-03 08:24+0200\n" "Last-Translator: Esteban I. Ruiz Moreno <exio4.com@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5370,8 +5370,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+0100\n" "PO-Revision-Date: 2016-12-24 09:00+0900\n" "Last-Translator: AYANOKOUZI, Ryuunosuke <i38w7i3@yahoo.co.jp>\n" "Language-Team: Japanese <https://github.com/l/weechat/tree/master/" @@ -5485,6 +5485,7 @@ msgstr "" "<id> [<text>] || -signal <id> <signal> || -kill <id> || -killall || -set " "<id> <property> <value> || -del <id>|-all [<id>...]" +#, fuzzy msgid "" " -list: list commands\n" " -sh: use the shell to execute the command (WARNING: use this option " @@ -5501,8 +5502,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+0100\n" "PO-Revision-Date: 2016-12-31 12:37+0100\n" "Last-Translator: Krzysztof Korościk <soltys@soltys.info>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5612,6 +5612,7 @@ msgstr "" "[<tekst>] || -signal <id> <sygnał> || -kill <id> || -killall || -set <id> " "<właściwość> <wartość> || -del <id>|-all [<id>...]" +#, fuzzy msgid "" " -list: list commands\n" " -sh: use the shell to execute the command (WARNING: use this option " @@ -5628,8 +5629,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+0100\n" "PO-Revision-Date: 2016-09-27 12:29+0000\n" "Last-Translator: Vasco Almeida <vascomalmeida@sapo.pt>\n" "Language-Team: Portuguese <>\n" @@ -5601,6 +5601,7 @@ msgstr "" "<id> [<texto>] || -signal <id> <sinal> || -kill <id> || -killall || -set " "<id> <propriedade> <valor> || -del <id>|-all [<id>...]" +#, fuzzy msgid "" " -list: list commands\n" " -sh: use the shell to execute the command (WARNING: use this option " @@ -5617,8 +5618,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " diff --git a/po/pt_BR.po b/po/pt_BR.po index d3358cf22..ed95d01ea 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: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+0100\n" "PO-Revision-Date: 2016-09-03 08:24+0200\n" "Last-Translator: Eduardo Elias <camponez@gmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -5165,8 +5165,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " @@ -21,7 +21,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+0100\n" "PO-Revision-Date: 2016-09-03 08:24+0200\n" "Last-Translator: Aleksey V Zapparov AKA ixti <ixti@member.fsf.org>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4588,8 +4588,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " @@ -20,7 +20,7 @@ msgid "" msgstr "" "Project-Id-Version: WeeChat\n" "Report-Msgid-Bugs-To: flashcode@flashtux.org\n" -"POT-Creation-Date: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+0100\n" "PO-Revision-Date: 2016-05-18 07:43+0200\n" "Last-Translator: Hasan Kiran <sunder67@hotmail.com>\n" "Language-Team: weechat-dev <weechat-dev@nongnu.org>\n" @@ -4151,8 +4151,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " diff --git a/po/weechat.pot b/po/weechat.pot index 5c4593993..3a9ee060c 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: 2016-12-31 18:22+0100\n" +"POT-Creation-Date: 2017-01-06 19:19+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" @@ -4135,8 +4135,11 @@ msgid "" " -buffer: display/send output of command on this buffer (if the buffer is " "not found, a new buffer with name \"exec.exec.xxx\" is created)\n" " -l: display locally output of command on buffer (default)\n" -" -o: send output of command to the buffer (not compatible with option -" -"bg)\n" +" -o: send output of command to the buffer without executing commands " +"(not compatible with option -bg)\n" +" -oc: send output of command to the buffer and execute commands (lines " +"starting with \"/\" or another custom command char) (not compatible with " +"option -bg)\n" " -n: display output of command in a new buffer (not compatible with " "option -bg)\n" " -nf: display output of command in a new buffer with free content (no " diff --git a/src/plugins/exec/exec-command.c b/src/plugins/exec/exec-command.c index 7cc9c2cbf..cbae927c9 100644 --- a/src/plugins/exec/exec-command.c +++ b/src/plugins/exec/exec-command.c @@ -227,21 +227,31 @@ exec_command_parse_options (struct t_exec_cmd_options *cmd_options, else if (weechat_strcasecmp (argv[i], "-l") == 0) { cmd_options->output_to_buffer = 0; + cmd_options->output_to_buffer_exec_cmd = 0; cmd_options->new_buffer = 0; } else if (weechat_strcasecmp (argv[i], "-o") == 0) { cmd_options->output_to_buffer = 1; + cmd_options->output_to_buffer_exec_cmd = 0; + cmd_options->new_buffer = 0; + } + else if (weechat_strcasecmp (argv[i], "-oc") == 0) + { + cmd_options->output_to_buffer = 1; + cmd_options->output_to_buffer_exec_cmd = 1; cmd_options->new_buffer = 0; } else if (weechat_strcasecmp (argv[i], "-n") == 0) { cmd_options->output_to_buffer = 0; + cmd_options->output_to_buffer_exec_cmd = 0; cmd_options->new_buffer = 1; } else if (weechat_strcasecmp (argv[i], "-nf") == 0) { cmd_options->output_to_buffer = 0; + cmd_options->output_to_buffer_exec_cmd = 0; cmd_options->new_buffer = 2; } else if (weechat_strcasecmp (argv[i], "-cl") == 0) @@ -409,6 +419,7 @@ exec_command_run (struct t_gui_buffer *buffer, cmd_options.ptr_buffer_name = NULL; cmd_options.ptr_buffer = buffer; cmd_options.output_to_buffer = 0; + cmd_options.output_to_buffer_exec_cmd = 0; cmd_options.new_buffer = 0; cmd_options.new_buffer_clear = 0; cmd_options.switch_to_buffer = 1; @@ -435,12 +446,12 @@ exec_command_run (struct t_gui_buffer *buffer, if (!exec_command_parse_options (&cmd_options, argc, argv, start_arg, 1)) return WEECHAT_RC_ERROR; - /* options "-bg" and "-o"/"-n" are incompatible */ + /* options "-bg" and "-o"/"-oc"/"-n" are incompatible */ if (cmd_options.detached && (cmd_options.output_to_buffer || cmd_options.new_buffer)) return WEECHAT_RC_ERROR; - /* options "-pipe" and "-bg"/"-o"/"-n" are incompatible */ + /* options "-pipe" and "-bg"/"-o"/"-oc"/"-n" are incompatible */ if (cmd_options.pipe_command && (cmd_options.detached || cmd_options.output_to_buffer || cmd_options.new_buffer)) @@ -494,6 +505,7 @@ exec_command_run (struct t_gui_buffer *buffer, { /* output in a new buffer using given name */ new_exec_cmd->output_to_buffer = 0; + new_exec_cmd->output_to_buffer_exec_cmd = 0; snprintf (str_buffer, sizeof (str_buffer), "exec.%s", cmd_options.ptr_buffer_name); ptr_new_buffer = exec_buffer_new (str_buffer, @@ -544,10 +556,12 @@ exec_command_run (struct t_gui_buffer *buffer, EXEC_PLUGIN_NAME) == 0)) { cmd_options.output_to_buffer = 0; + cmd_options.output_to_buffer_exec_cmd = 0; cmd_options.new_buffer = 1; } } new_exec_cmd->output_to_buffer = cmd_options.output_to_buffer; + new_exec_cmd->output_to_buffer_exec_cmd = cmd_options.output_to_buffer_exec_cmd; new_exec_cmd->line_numbers = (cmd_options.line_numbers < 0) ? cmd_options.new_buffer : cmd_options.line_numbers; new_exec_cmd->color = cmd_options.color; @@ -808,7 +822,10 @@ exec_command_init () "buffer is not found, a new buffer with name \"exec.exec.xxx\" is " "created)\n" " -l: display locally output of command on buffer (default)\n" - " -o: send output of command to the buffer " + " -o: send output of command to the buffer without executing " + "commands (not compatible with option -bg)\n" + " -oc: send output of command to the buffer and execute commands " + "(lines starting with \"/\" or another custom command char) " "(not compatible with option -bg)\n" " -n: display output of command in a new buffer (not compatible " "with option -bg)\n" diff --git a/src/plugins/exec/exec-command.h b/src/plugins/exec/exec-command.h index d2506307c..06be3ae4a 100644 --- a/src/plugins/exec/exec-command.h +++ b/src/plugins/exec/exec-command.h @@ -30,6 +30,7 @@ struct t_exec_cmd_options const char *ptr_buffer_name; /* name of buffer */ struct t_gui_buffer *ptr_buffer; /* pointer to buffer */ int output_to_buffer; /* 1 if output is sent to buffer */ + int output_to_buffer_exec_cmd; /* execute commands found */ int new_buffer; /* 1=new buffer, 2=new buf. free cont*/ int new_buffer_clear; /* 1 to clear buffer before output */ int switch_to_buffer; /* switch to the output buffer */ diff --git a/src/plugins/exec/exec.c b/src/plugins/exec/exec.c index 05fb97ae4..1df680da9 100644 --- a/src/plugins/exec/exec.c +++ b/src/plugins/exec/exec.c @@ -152,6 +152,7 @@ exec_add () new_exec_cmd->start_time = time (NULL); new_exec_cmd->end_time = 0; new_exec_cmd->output_to_buffer = 0; + new_exec_cmd->output_to_buffer_exec_cmd = 0; new_exec_cmd->buffer_full_name = NULL; new_exec_cmd->line_numbers = 0; new_exec_cmd->display_rc = 0; @@ -204,6 +205,8 @@ exec_timer_delete_cb (const void *pointer, void *data, int remaining_calls) * Decodes colors in a string (from stdout/stderr). * * Returns string with colors as-is, decoded or removed. + * + * Note: result must be freed after use. */ char * @@ -249,7 +252,8 @@ void exec_display_line (struct t_exec_cmd *exec_cmd, struct t_gui_buffer *buffer, int out, const char *line) { - char *line_color, *line2, str_number[32], str_tags[1024]; + char *line_color, *line_color2, *line2, str_number[32], str_tags[1024]; + const char *ptr_line_color; int length; if (!exec_cmd || !line) @@ -311,7 +315,31 @@ exec_display_line (struct t_exec_cmd *exec_cmd, struct t_gui_buffer *buffer, } } else - weechat_command (buffer, (line_color[0]) ? line_color : " "); + { + if (exec_cmd->output_to_buffer_exec_cmd) + ptr_line_color = line_color; + else + ptr_line_color = weechat_string_input_for_buffer (line_color); + + if (ptr_line_color) + { + weechat_command (buffer, + (ptr_line_color[0]) ? ptr_line_color : " "); + } + else + { + length = 1 + strlen (line_color) + 1; + line_color2 = malloc (length); + if (line_color2) + { + snprintf (line_color2, length, "%c%s", + line_color[0], line_color); + weechat_command (buffer, + (line_color2[0]) ? line_color2 : " "); + free (line_color2); + } + } + } } else { @@ -657,28 +685,29 @@ exec_print_log () { weechat_log_printf (""); weechat_log_printf ("[exec command (addr:0x%lx)]", ptr_exec_cmd); - weechat_log_printf (" number. . . . . . . . . : %d", ptr_exec_cmd->number); - weechat_log_printf (" name. . . . . . . . . . : '%s'", ptr_exec_cmd->name); - weechat_log_printf (" hook. . . . . . . . . . : 0x%lx", ptr_exec_cmd->hook); - weechat_log_printf (" command . . . . . . . . : '%s'", ptr_exec_cmd->command); - weechat_log_printf (" pid . . . . . . . . . . : %d", ptr_exec_cmd->pid); - weechat_log_printf (" detached. . . . . . . . : %d", ptr_exec_cmd->detached); - weechat_log_printf (" start_time. . . . . . . : %ld", ptr_exec_cmd->start_time); - weechat_log_printf (" end_time. . . . . . . . : %ld", ptr_exec_cmd->end_time); - weechat_log_printf (" output_to_buffer. . . . : %d", ptr_exec_cmd->output_to_buffer); - weechat_log_printf (" buffer_full_name. . . . : '%s'", ptr_exec_cmd->buffer_full_name); - weechat_log_printf (" line_numbers. . . . . . : %d", ptr_exec_cmd->line_numbers); - weechat_log_printf (" display_rc. . . . . . . : %d", ptr_exec_cmd->display_rc); - weechat_log_printf (" output_line_nb. . . . . : %d", ptr_exec_cmd->output_line_nb); - weechat_log_printf (" output_size[stdout] . . : %d", ptr_exec_cmd->output_size[EXEC_STDOUT]); - weechat_log_printf (" output[stdout]. . . . . : '%s'", ptr_exec_cmd->output[EXEC_STDOUT]); - weechat_log_printf (" output_size[stderr] . . : %d", ptr_exec_cmd->output_size[EXEC_STDERR]); - weechat_log_printf (" output[stderr]. . . . . : '%s'", ptr_exec_cmd->output[EXEC_STDERR]); - weechat_log_printf (" return_code . . . . . . : %d", ptr_exec_cmd->return_code); - weechat_log_printf (" pipe_command. . . . . . : '%s'", ptr_exec_cmd->pipe_command); - weechat_log_printf (" hsignal . . . . . . . . : '%s'", ptr_exec_cmd->hsignal); - weechat_log_printf (" prev_cmd. . . . . . . . : 0x%lx", ptr_exec_cmd->prev_cmd); - weechat_log_printf (" next_cmd. . . . . . . . : 0x%lx", ptr_exec_cmd->next_cmd); + weechat_log_printf (" number. . . . . . . . . . : %d", ptr_exec_cmd->number); + weechat_log_printf (" name. . . . . . . . . . . : '%s'", ptr_exec_cmd->name); + weechat_log_printf (" hook. . . . . . . . . . . : 0x%lx", ptr_exec_cmd->hook); + weechat_log_printf (" command . . . . . . . . . : '%s'", ptr_exec_cmd->command); + weechat_log_printf (" pid . . . . . . . . . . . : %d", ptr_exec_cmd->pid); + weechat_log_printf (" detached. . . . . . . . . : %d", ptr_exec_cmd->detached); + weechat_log_printf (" start_time. . . . . . . . : %ld", ptr_exec_cmd->start_time); + weechat_log_printf (" end_time. . . . . . . . . : %ld", ptr_exec_cmd->end_time); + weechat_log_printf (" output_to_buffer. . . . . : %d", ptr_exec_cmd->output_to_buffer); + weechat_log_printf (" output_to_buffer_exec_cmd : %d", ptr_exec_cmd->output_to_buffer_exec_cmd); + weechat_log_printf (" buffer_full_name. . . . . : '%s'", ptr_exec_cmd->buffer_full_name); + weechat_log_printf (" line_numbers. . . . . . . : %d", ptr_exec_cmd->line_numbers); + weechat_log_printf (" display_rc. . . . . . . . : %d", ptr_exec_cmd->display_rc); + weechat_log_printf (" output_line_nb. . . . . . : %d", ptr_exec_cmd->output_line_nb); + weechat_log_printf (" output_size[stdout] . . . : %d", ptr_exec_cmd->output_size[EXEC_STDOUT]); + weechat_log_printf (" output[stdout]. . . . . . : '%s'", ptr_exec_cmd->output[EXEC_STDOUT]); + weechat_log_printf (" output_size[stderr] . . . : %d", ptr_exec_cmd->output_size[EXEC_STDERR]); + weechat_log_printf (" output[stderr]. . . . . . : '%s'", ptr_exec_cmd->output[EXEC_STDERR]); + weechat_log_printf (" return_code . . . . . . . : %d", ptr_exec_cmd->return_code); + weechat_log_printf (" pipe_command. . . . . . . : '%s'", ptr_exec_cmd->pipe_command); + weechat_log_printf (" hsignal . . . . . . . . . : '%s'", ptr_exec_cmd->hsignal); + weechat_log_printf (" prev_cmd. . . . . . . . . : 0x%lx", ptr_exec_cmd->prev_cmd); + weechat_log_printf (" next_cmd. . . . . . . . . : 0x%lx", ptr_exec_cmd->next_cmd); } } diff --git a/src/plugins/exec/exec.h b/src/plugins/exec/exec.h index f1c781991..d034befe4 100644 --- a/src/plugins/exec/exec.h +++ b/src/plugins/exec/exec.h @@ -53,6 +53,7 @@ struct t_exec_cmd /* display */ int output_to_buffer; /* 1 if output is sent to buffer */ + int output_to_buffer_exec_cmd; /* 1 if commands are executed */ char *buffer_full_name; /* buffer where output is displayed */ int line_numbers; /* 1 if lines numbers are displayed */ int color; /* what to do with ANSI colors */ |