[NTG-pdftex] [ pdftex-Feature Requests-421 ] \pdf shell escape addition

noreply at sarovar.org noreply at sarovar.org
Thu Dec 28 18:55:28 CET 2006


Feature Requests item #421, was opened at 2005-08-26 20:32
You can respond by visiting: 
http://sarovar.org/tracker/?func=detail&atid=496&aid=421&group_id=106

>Category: web2c
Group: None
>Status: Closed
Resolution: Accepted
Priority: 5
Submitted By: ivo welch (iaw4)
Assigned to: Taco Hoekwater (taco)
Summary: \pdf shell escape addition

Initial Comment:

I would humbly request that in addition add to \write18
('--shell-escape'), you add a new command, say \input18
(or \pdftexshellinput18), which like \write18 executes
a system() command on its argument, but which then
pushes the stdout output from this shell command into
the stdin stream that TeX is processing.  (no, writing
to a file and then inputting it does not do the job.)

I cannot contribute to the code base of TeX, which
seems like black magic to me.  But I can offer $300 for
this facility.  If someone was planning to spend the
time to do this anyway, this may push him/her over the
margin.  However, it is important to me that this
enters the standard feature set of pdftex, so that it
will persist through future versions, so this would be
part of the bargain here.

regards,

/ivo welch

----------------------------------------------------------------------

Comment By: Taco Hoekwater (taco)
Date: 2006-06-12 20:11

Message:
Logged In: YES 
user_id=1608

> i.e. even \immediate\closeout doesn't make the file
> immediately visible and fully readable?
> isn't this a bug, if it is so?

it is a bug in certain operating systems, not in TeX ;-)

> btw, how will this work in case of non-immediate
> \openin and \openout? (in case they will end up executed
> during the \shipout?)

The pipes will be opened (and closed, hopefully) during
shipout, not before (just like normal '\openout' files).



----------------------------------------------------------------------

Comment By: Nobody (None)
Date: 2006-06-12 18:49

Message:
Logged In: NO 

> one of the reasons why intermediate files don't work
> is that it interferes with flushing of files
> [and the moment that files are seen]

i.e. even \immediate\closeout doesn't make the file
immediately visible and fully readable?
isn't this a bug, if it is so?

nevertheless, the Taco's implementation of this feature
is nice; btw, how will this work in case of non-immediate
\openin and \openout? (in case they will end up executed
during the \shipout?)


----------------------------------------------------------------------

Comment By: Hans Hagen (hagen)
Date: 2006-06-12 11:08

Message:
Logged In: YES 
user_id=927

it may interest you that taco, fabrice an i have been
playing with piping the last couple of weeks; we're still
struggling with decent ways to get around operating system
related problems; in order for such a feature (actually more
generic that you suggest) to work, it must be cross
platform; btw, one of the reasons why intermediate files
don't work is that it interferes with flushing of files [and
the moment that files are seen] 

Hans 

----------------------------------------------------------------------

Comment By: Taco Hoekwater (taco)
Date: 2006-06-11 15:36

Message:
Logged In: YES 
user_id=1608

Hi Ivo,

Sorry, I had completely forgotten about this. Attached is a
(preliminary?) patch for openclose.c (in the texk/web2c/lib
directory) that gives this functionality.

It is a really simple thing: if the first character of a
filename for \openin or \openout is a pipe symbol (|), the
filename is assumed to be a request for a pipe to a command
line that is given in the rest of the filename. 

Of course, you need "shell_escape = t" in your texmf.cnf
for this to work.

And whether or not this makes it to the distribution(s) is
not up to me, of course.


Have fun, Taco

-------------------
Two small examples:

\openin1= "|ls -l"
\loop \unless \ifeof1
  \read1 to \cs \message{\meaning\cs}
\repeat

\openout1= "|sort >alphabet.tex"
\write1{b}
\write1{a}
\write1{c}
\closeout1
\bye



----------------------------------------------------------------------

Comment By: Nobody (None)
Date: 2006-06-11 04:58

Message:
Logged In: NO 

could you please clarify why "no, writing to a file and then
inputting it does not do the job"?


----------------------------------------------------------------------

Comment By: ivo welch (iaw4)
Date: 2006-06-10 23:05

Message:
Logged In: YES 
user_id=2771


any chance this will happen, taco?  regards, /ivo


----------------------------------------------------------------------

Comment By: Taco Hoekwater (taco)
Date: 2005-08-27 09:01

Message:
Logged In: YES 
user_id=1608

I have an idea on how to do this, so I've assigned it to myself

----------------------------------------------------------------------

You can respond by visiting: 
http://sarovar.org/tracker/?func=detail&atid=496&aid=421&group_id=106


More information about the ntg-pdftex mailing list