All of lore.kernel.org
 help / color / mirror / Atom feed
From: Karel Zak <kzak@redhat.com>
To: Isaac Dunham <ibid.ag@gmail.com>
Cc: Bruce Dubbs <bruce.dubbs@gmail.com>, util-linux@vger.kernel.org
Subject: Re: fdisk
Date: Wed, 2 Sep 2015 10:01:57 +0200	[thread overview]
Message-ID: <20150902080157.GL2726@ws.net.home> (raw)
In-Reply-To: <20150902020733.GB1910@newbook>

On Tue, Sep 01, 2015 at 07:07:34PM -0700, Isaac Dunham wrote:
> Thus, I'm thinking that the following prototypes would be better:
> 
> /* create a pipe, spawn a temporary pager,
>  * dup()s fd 1 and possibly fd 2 before redirecting to the pipe
>  * if an fd is not dup()'d, set the corresponding duplicate to -1
>  */
> pid_t setup_temporary_pager(int *dupout, int *duperr);
> 
> /* close the pipe, dup2() the saved fds back over fds 1/2,
>  * close the duplicates, and wait for the temporary pager to exit
>  * if either fd is -1, skip it.
>  */
> void close_pager(pid, int dupout, int duperr);
> 
> 
> setup_temporary_pager will return -1 if it does not spawn the pager
> (whether by failure or by PAGER=cat), or if there are problems during
> the redirection dance.
> It will refuse to spawn a pager if (!isatty(STDOUT_FILENO)).

Yes, on non-tty stdout the both functions have to do nothing.

> Does this sound sensible?

Yes, go ahead.


    Karel

-- 
 Karel Zak  <kzak@redhat.com>
 http://karelzak.blogspot.com

  reply	other threads:[~2015-09-02  8:01 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-31  2:04 fdisk Bruce Dubbs
2015-08-31  6:56 ` fdisk Bernhard Voelker
2015-08-31 16:20   ` fdisk Bruce Dubbs
2015-09-02  1:29     ` fdisk Isaac Dunham
2015-08-31 10:06 ` fdisk Karel Zak
2015-09-02  2:07   ` fdisk Isaac Dunham
2015-09-02  8:01     ` Karel Zak [this message]
  -- strict thread matches above, loose matches on Subject: below --
2011-06-24 18:25 fdisk Bruce Dubbs
2011-06-27 14:21 ` fdisk Karel Zak
2011-06-27 19:27   ` fdisk Mike Frysinger
2002-07-17  3:36 fdisk azie
2002-07-17  4:29 ` fdisk Ray Olszewski
2002-07-17  9:44 ` fdisk Elias Athanasopoulos
2002-07-17 18:25 ` fdisk Bryan Whitehead
2002-07-18  8:14   ` fdisk azie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150902080157.GL2726@ws.net.home \
    --to=kzak@redhat.com \
    --cc=bruce.dubbs@gmail.com \
    --cc=ibid.ag@gmail.com \
    --cc=util-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.