Branch: Tag:

2004-01-11

2004-01-11 01:16:08 by Martin Nilsson <mani@lysator.liu.se>

Make it possible to write to stderr in an exit call. Very handy when writing scripts (as oppose to applications).

Rev: src/builtin_functions.c:1.524

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: builtin_functions.c,v 1.523 2003/12/18 21:22:23 marcus Exp $ + || $Id: builtin_functions.c,v 1.524 2004/01/11 01:16:08 nilsson Exp $   */      #include "global.h" - RCSID("$Id: builtin_functions.c,v 1.523 2003/12/18 21:22:23 marcus Exp $"); + RCSID("$Id: builtin_functions.c,v 1.524 2004/01/11 01:16:08 nilsson Exp $");   #include "interpret.h"   #include "svalue.h"   #include "pike_macros.h"
2138:    pike_throw();   }    - /*! @decl void exit(int returncode) + /*! @decl void exit(int returncode, void|stirng fmt, mixed ... extra)    *!    *! Exit the whole Pike program with the given @[returncode].    *!
2146:    *! that something went wrong during execution. See your system manuals    *! for more information about return codes.    *! +  *! The arguments after the @[returncode] will be used for a call to +  *! @[werror] to output a message on stderr. +  *!    *! @seealso    *! @[_exit()]    */
2163:    if(in_exit) Pike_error("exit already called!\n");    in_exit=1;    +  if(args>1) +  f_werror(args-1); +     assign_svalue(&throw_value, Pike_sp-args);    throw_severity=THROW_EXIT;    pike_throw();
8038:    tArr(tVar(0))), 0, OPT_TRY_OPTIMIZE);      /* function(int:void) */ -  ADD_EFUN("exit",f_exit,tFunc(tInt,tVoid),OPT_SIDE_EFFECT); +  ADD_EFUN("exit",f_exit,tFuncV(tInt tOr(tVoid,tStr),tOr(tVoid,tMix),tVoid), +  OPT_SIDE_EFFECT);      /* function(int:void) */    ADD_EFUN("_exit",f__exit,tFunc(tInt,tVoid),OPT_SIDE_EFFECT);