xsel

Program for manipulating the X clipboard
git clone https://git.sinitax.com/kfish/xsel
Log | Files | Refs | README | LICENSE | sfeed.txt

commit ffc81ec7a61c348abb21f131c9d40e0233eb2bcb
parent 1cfdc83c0d38b904daf5f024d023d63b31cd695c
Author: conrad <conrad@9c49b5d1-7df3-0310-bce2-b7278e68f44c>
Date:   Tue, 11 Dec 2007 11:31:08 +0000

merge patch from Rorzik, for the problem reported in Debian bug #444638:
"xsel clears buffer instead of outputting when backgrounded".

This commit applies Rorzik's logic only for the case where both stdin and
stdout are not ttys, eg. when it is being run from a script. However, the
previous logic remains for cases where one of stdin or stdout are not a
tty, eg. "xsel > file.txt" or "echo text | xsel".


git-svn-id: http://svn.kfish.org/xsel/trunk@195 9c49b5d1-7df3-0310-bce2-b7278e68f44c

Diffstat:
Mxsel.c | 6++++++
1 file changed, 6 insertions(+), 0 deletions(-)

diff --git a/xsel.c b/xsel.c @@ -1809,9 +1809,15 @@ main(int argc, char *argv[]) /* Specify default behaviour based on input and output file types */ if (isatty(0) && isatty(1)) { + /* Interactive mode: both stdin and stdout are ttys */ do_input = False; dont_input = True; do_output = False; dont_output = False; + } else if (!isatty(0) && !isatty(1)) { + /* Scripted: both stdin and stdout are NOT ttys */ + do_input = False; dont_input = True; + do_output = True; dont_output = False; } else { + /* Interactive, pipelined: one of stdin or stdout is a tty */ do_input = !isatty(0); dont_input = !do_input; do_output = !isatty(1); dont_output = !do_output; }