On Sun, 31 Oct 2010, Wolfgang Schuster wrote:


Am 31.10.2010 um 01:27 schrieb Aditya Mahajan:

Hi,

I want to write a macro that checks for some settings and if the settings are 
wrong stop the current compilation and terminate with an error message. Right 
now I have

\def\ERROR
     {\writeline
      \showmessage\??externalfilter??{forbidden}\getexternalfilterdirectory
      \batchmode
      \normalend}

This prints the error message on the terminal and exits. However the exit 
status (the value of $?) is 0, if the tui file has changed the document is 
compiled a second time anyways.

How can I force context (the macro package) to exit with a status of 1 so that 
context (the program) does not attempt a second compilation?

\starttext

one

\scrollmode\undefined\forcequitjob{bye}

two

\stoptext

\forcequitjob is defined in the same manner as my definition

\def\forcequitjob#1%
  {\writestatus\m!systems{forcing quit: #1}%
   \batchmode
   \dorecurse\textlevel{\stoptext}
   \normalend}

and suffers from the same problem. It does not send the program's error code to 1. After compiling

\starttext
\forcequitjob{bye}
\stoptext

the output of `echo $?` is 0, so context thinks that the program compiled sucessfully.

Now add

\section{one}

on the first line and compile again. Context does two runs of the program (because no error signal is generated at the end of the first run). I want to avoid this second run.

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to