About Chandra Archive Proposer Instruments & Calibration Newsletters Data Analysis HelpDesk Calibration Database NASA Archives & Centers Chandra Science Links

Skip the navigation links
Last modified: December 2006

URL: http://cxc.harvard.edu/ciao3.4/__exit.html
Hardcopy (PDF): A4 | Letter
AHELP for CIAO 3.4 __exit Context: varmm

Synopsis

S-Lang function to abort applications.

Syntax

__exit( Integer_Type exitcode )

Description

This function provides a mechanism for aborting application from within S-Lang scope (ie, function, script, etc), and to return the given status code to the operating system. Since the POSIX standard only defines positive exit codes, the behavior is undefined for negative inputs.

Example 1

chips> __exit(3);
unix% echo $?
3

In this example we use the __exit() routine to exit ChIPS and return a non-zero status value (here the value 3).

Example 2

In general the routine is useful in scripts that are not run interactively, rather than from the ChIPS or Sherpa command lines. In the following piece of S-Lang code, we use the __exit() function to stop the code if the file img.fits can not be read in.

  require("varmm");
  variable dat = readfile("img.fits");
  if ( NULL == dat ) {
    () = fprintf( stderr, "ERROR: unable to read in img.fits\n" );
    __exit(1);
  }

Bugs

See the bugs page for the Varmm library on the CIAO website for an up-to-date listing of known bugs.

See Also

modules
varmm
varmm
username
Hardcopy (PDF): A4 | Letter
Last modified: December 2006



The Chandra X-Ray Center (CXC) is operated for NASA by the Smithsonian Astrophysical Observatory.
60 Garden Street, Cambridge, MA 02138 USA.    Email: cxcweb@head.cfa.harvard.edu
Smithsonian Institution, Copyright © 1998-2004. All rights reserved.