Re: fdisk

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
 http://karelzak.blogspot.com
--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux