ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* \ifshellescape
@ 2006-12-26 13:35 Mojca Miklavec
  2006-12-26 17:48 ` \ifshellescape Aditya Mahajan
  2006-12-26 18:57 ` \ifshellescape Peter Münster
  0 siblings, 2 replies; 10+ messages in thread
From: Mojca Miklavec @ 2006-12-26 13:35 UTC (permalink / raw)


Hello,

is there any command to test for write18/shell escape available in ConTeXt?


In one of the LaTeX packages I saw:

\newif\ifShellEscape
...
\ifShellEscape
   \def\tmpfile{/tmp/w18-test-\the\year\the\month\the\day\the\time}
   \ifmiktex
      \immediate\write18{rem >"\tmpfile"}
   \else
      \immediate\write18{touch \tmpfile}
   \fi
   \ifmiktex
      \IfFileExists{\tmpfile.}{\ShellEscapetrue}{\ShellEscapefalse}
   \else
      \IfFileExists{\tmpfile}{\ShellEscapetrue}{\ShellEscapefalse}
   \fi
\fi

Thanks a lot,
    Mojca

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: \ifshellescape
  2006-12-26 13:35 \ifshellescape Mojca Miklavec
@ 2006-12-26 17:48 ` Aditya Mahajan
  2006-12-26 18:57 ` \ifshellescape Peter Münster
  1 sibling, 0 replies; 10+ messages in thread
From: Aditya Mahajan @ 2006-12-26 17:48 UTC (permalink / raw)


On Tue, 26 Dec 2006, Mojca Miklavec wrote:

> Hello,
> 
> is there any command to test for write18/shell escape available in ConTeXt?

\ifeof18 checks if write18 is disabled. I think that it is etex only.


The next method is error prone, for a lot of reasons, the directory 
/tmp may not exist (atleast in Windows). A bit safer option may be 
$TEMP. I do not know of \ifmiktex switch, but I am sure TeXLive on 
windows will not set it to true.

> In one of the LaTeX packages I saw:
> 
> \newif\ifShellEscape
> ...
> \ifShellEscape
>    \def\tmpfile{/tmp/w18-test-\the\year\the\month\the\day\the\time}
>    \ifmiktex
>       \immediate\write18{rem >"\tmpfile"}
>    \else
>       \immediate\write18{touch \tmpfile}
>    \fi
>    \ifmiktex
>       \IfFileExists{\tmpfile.}{\ShellEscapetrue}{\ShellEscapefalse}
>    \else
>       \IfFileExists{\tmpfile}{\ShellEscapetrue}{\ShellEscapefalse}
>    \fi
> \fi
>

HTH,
Aditya

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: \ifshellescape
  2006-12-26 13:35 \ifshellescape Mojca Miklavec
  2006-12-26 17:48 ` \ifshellescape Aditya Mahajan
@ 2006-12-26 18:57 ` Peter Münster
  2006-12-26 20:55   ` \ifshellescape Henning Hraban Ramm
                     ` (2 more replies)
  1 sibling, 3 replies; 10+ messages in thread
From: Peter Münster @ 2006-12-26 18:57 UTC (permalink / raw)


On Tue, 26 Dec 2006, Mojca Miklavec wrote:

> is there any command to test for write18/shell escape available in ConTeXt?

There is such a command in pdfTeX-1.40 but I don't remember the name
(I think it's "\ifshellescape").
Cheers, Peter

-- 
http://pmrb.free.fr/contact/

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: \ifshellescape
  2006-12-26 18:57 ` \ifshellescape Peter Münster
@ 2006-12-26 20:55   ` Henning Hraban Ramm
  2006-12-26 21:16   ` \ifshellescape Martin Schröder
  2006-12-26 22:19   ` \ifshellescape Hans Hagen
  2 siblings, 0 replies; 10+ messages in thread
From: Henning Hraban Ramm @ 2006-12-26 20:55 UTC (permalink / raw)


Am 2006-12-26 um 19:57 schrieb Peter Münster:

>> is there any command to test for write18/shell escape available in  
>> ConTeXt?
>
> There is such a command in pdfTeX-1.40 but I don't remember the name
> (I think it's "\ifshellescape").

\ifeof18

 From the t-lilypond sources:
%D If \type{\ifeof18} creates an error for you, your pdfetex is too old.
%D (\type{\ifeof18} checks whether \type{\write18} is disabled.)




Greetlings from Lake Constance!
Hraban
---
http://www.fiee.net/texnique/
http://contextgarden.net
http://www.cacert.org (I'm an assurer)

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: \ifshellescape
  2006-12-26 18:57 ` \ifshellescape Peter Münster
  2006-12-26 20:55   ` \ifshellescape Henning Hraban Ramm
@ 2006-12-26 21:16   ` Martin Schröder
  2006-12-26 22:19   ` \ifshellescape Hans Hagen
  2 siblings, 0 replies; 10+ messages in thread
From: Martin Schröder @ 2006-12-26 21:16 UTC (permalink / raw)


2006/12/26, Peter Münster <pmlists@free.fr>:
> There is such a command in pdfTeX-1.40 but I don't remember the name
> (I think it's "\ifshellescape").

It's new in 1.30:
  - \pdfshellescape is a read-only integer that is 1 if \write18 is enabled, 0
    otherwise.

Best
   Martin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: \ifshellescape
  2006-12-26 18:57 ` \ifshellescape Peter Münster
  2006-12-26 20:55   ` \ifshellescape Henning Hraban Ramm
  2006-12-26 21:16   ` \ifshellescape Martin Schröder
@ 2006-12-26 22:19   ` Hans Hagen
  2006-12-26 22:33     ` \ifshellescape Mojca Miklavec
  2006-12-26 23:08     ` \ifshellescape Mojca Miklavec
  2 siblings, 2 replies; 10+ messages in thread
From: Hans Hagen @ 2006-12-26 22:19 UTC (permalink / raw)


� wrote:
> On Tue, 26 Dec 2006, Mojca Miklavec wrote:
>
>   
>> is there any command to test for write18/shell escape available in ConTeXt?
>>     
>
> There is such a command in pdfTeX-1.40 but I don't remember the name
> (I think it's "\ifshellescape").
> Cheers, Peter
>
>   
 >grep shellescape *.tex
core-job.tex:\ifx\pdfshellescape\undefined \else
core-job.tex:    \chardef\systemcommandmode \ifcase\pdfshellescape 
\plusone \else \plustwo \fi

so \systemcommandmode is your friend

-- 

-----------------------------------------------------------------
                                          Hans Hagen | PRAGMA ADE
              Ridderstraat 27 | 8061 GH Hasselt | The Netherlands
     tel: 038 477 53 69 | fax: 038 477 53 74 | www.pragma-ade.com
                                             | www.pragma-pod.nl
-----------------------------------------------------------------

_______________________________________________
ntg-context mailing list
ntg-context@ntg.nl
http://www.ntg.nl/mailman/listinfo/ntg-context

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: \ifshellescape
  2006-12-26 22:19   ` \ifshellescape Hans Hagen
@ 2006-12-26 22:33     ` Mojca Miklavec
  2006-12-26 22:43       ` \ifshellescape Martin Schröder
  2006-12-26 23:08     ` \ifshellescape Mojca Miklavec
  1 sibling, 1 reply; 10+ messages in thread
From: Mojca Miklavec @ 2006-12-26 22:33 UTC (permalink / raw)


On 12/26/06, Hans Hagen wrote:
> Peter Münster wrote:
> > On Tue, 26 Dec 2006, Mojca Miklavec wrote:
> >
> >
> >> is there any command to test for write18/shell escape available in ConTeXt?
> >>
> > There is such a command in pdfTeX-1.40 but I don't remember the name
> > (I think it's "\ifshellescape").
> > Cheers, Peter
> >
> >
>  >grep shellescape *.tex
> core-job.tex:\ifx\pdfshellescape\undefined \else
> core-job.tex:    \chardef\systemcommandmode \ifcase\pdfshellescape
> \plusone \else \plustwo \fi
>
> so \systemcommandmode is your friend

Wait! So many alternatives that I'll have to create another function
to choose one of them randomly ;)

Thanks a lot, (I'll use \systemcommandmode then),
   Mojca

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: \ifshellescape
  2006-12-26 22:33     ` \ifshellescape Mojca Miklavec
@ 2006-12-26 22:43       ` Martin Schröder
  0 siblings, 0 replies; 10+ messages in thread
From: Martin Schröder @ 2006-12-26 22:43 UTC (permalink / raw)


2006/12/26, Mojca Miklavec <mojca.miklavec.lists@gmail.com>:
> Wait! So many alternatives that I'll have to create another function
> to choose one of them randomly ;)

pdftex 1.30 has functions for random numbers. :-)

Best
   Martin

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: \ifshellescape
  2006-12-26 22:19   ` \ifshellescape Hans Hagen
  2006-12-26 22:33     ` \ifshellescape Mojca Miklavec
@ 2006-12-26 23:08     ` Mojca Miklavec
  2006-12-27  8:22       ` \ifshellescape Hans Hagen
  1 sibling, 1 reply; 10+ messages in thread
From: Mojca Miklavec @ 2006-12-26 23:08 UTC (permalink / raw)


On 12/26/06, Hans Hagen wrote:
>
> core-job.tex:\ifx\pdfshellescape\undefined \else
> core-job.tex:    \chardef\systemcommandmode \ifcase\pdfshellescape
> \plusone \else \plustwo \fi
>
> so \systemcommandmode is your friend

What exactly is the advantage of using \pdfshellescape over \ifeof18
as the basis of \systemcommandmode? The second one works in XeTeX as
well while the first is only good for pdfTeX, but perhaps there are
other reasons for using it.

Thanks,
    Mojca

^ permalink raw reply	[flat|nested] 10+ messages in thread

* Re: \ifshellescape
  2006-12-26 23:08     ` \ifshellescape Mojca Miklavec
@ 2006-12-27  8:22       ` Hans Hagen
  0 siblings, 0 replies; 10+ messages in thread
From: Hans Hagen @ 2006-12-27  8:22 UTC (permalink / raw)


Mojca Miklavec wrote:
> On 12/26/06, Hans Hagen wrote:
>   
>> core-job.tex:\ifx\pdfshellescape\undefined \else
>> core-job.tex:    \chardef\systemcommandmode \ifcase\pdfshellescape
>> \plusone \else \plustwo \fi
>>
>> so \systemcommandmode is your friend
>>     
>
> What exactly is the advantage of using \pdfshellescape over \ifeof18
> as the basis of \systemcommandmode? The second one works in XeTeX as
> well while the first is only good for pdfTeX, but perhaps there are
> other reasons for using it.
>
>   
write 18 is a hack and pdfshellescape a sane replacement

in luatex it will probably be gone completely since there we have

\directlua 0 { os.execute("...") }

Hans

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-12-27  8:22 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-12-26 13:35 \ifshellescape Mojca Miklavec
2006-12-26 17:48 ` \ifshellescape Aditya Mahajan
2006-12-26 18:57 ` \ifshellescape Peter Münster
2006-12-26 20:55   ` \ifshellescape Henning Hraban Ramm
2006-12-26 21:16   ` \ifshellescape Martin Schröder
2006-12-26 22:19   ` \ifshellescape Hans Hagen
2006-12-26 22:33     ` \ifshellescape Mojca Miklavec
2006-12-26 22:43       ` \ifshellescape Martin Schröder
2006-12-26 23:08     ` \ifshellescape Mojca Miklavec
2006-12-27  8:22       ` \ifshellescape Hans Hagen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).