exit()

The exit() function does two things, closes all file descriptors
and then exits:

    exit(n)
    {
      _cleanup();
      _exit(n);
    }

make sure you get the _cleanup() in your Exit() routine.

    |Yesterday I was able to figure out a trick to overcome the exits
    |present in GRASS:
    |
    |I created my own function called exit() which does nothing, and
    |when the program is linked, this function is called, instead of
    |the "real" exit. In my program, I now use a call to another
    |function (Exit()) which merely calls _exit() when I want to get
    |out.
    |
    |This gets around the calls to exit in the GRASS library, and
    |still allows my program to exit when it wants.

Michael