groff
[Top][All Lists]
Advanced

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

Re: [Groff] option to set output file name


From: Mike Bianchi
Subject: Re: [Groff] option to set output file name
Date: Wed, 29 Apr 2009 09:02:36 -0400
User-agent: Mutt/1.5.17+20080114 (2008-01-14)

Woops.

        "file descriptor" 0 is the standard input.

        file descriptor 1 is the standard output
        file descriptor 2 is the standard error output

On Wed, Apr 29, 2009 at 09:15:06AM +0100, Ralph Corderoy wrote:
> 
> Hi Michail,
> 
> > may be I am missing something trivial, but I can not find a
> > command-line switch in groff to direct output to file.
> 
> No, I'm pretty certain there isn't one.
> 
> > Output redirection is no problem in shell scripts, but if groff is to
> > be spawned from another program it becomes a problem, either you spawn
> > a shell runing a script or spawn groff and have to bother with piping
> > output. You can not just fire off groff and forget about it. What a
> > miss :(
> 
> When you say "spawn a shell runing a script" I assume you know you can
> give the shell a command to execute with the -c option without a script
> file needing to exist on disc?  For example, in C,
> 
>     ret = system("groff foo.tr >foo.ps");
> 
> will cause sh(1) to be execve(2)'d with
> 
>     execve("/bin/sh", ["sh", "-c", "groff foo.tr >foo.ps"], [/* 55 vars */])
> 
> So yes, that does involve a shell being started just to run groff, but
> then you're wanting the shell's I/O redirection syntax to be
> interpreted.  As I think you're saying, you could avoid this by manually
> forking and setting up file descriptor 0 to be writing to foo.ps before
> execing groff but it's hassle and system() is just easier.
> 
> An option shouldn't be added to groff to do this.  By that logic, awk,
> sed, make, date, and wc should all grow an --output option too.
> 
> Cheers,
> 
> Ralph.

-- 
 Mike Bianchi




reply via email to

[Prev in Thread] Current Thread [Next in Thread]