/* catch.c
 *
 * Copyright Niels Möller <nisse@lysator.liu.se> 1995
 *
 * Freely distributable under the terms and conditions of the
 * GNU General Public License.
 */

#include <catch.h>
#include <stdio.h>
#include <stdlib.h>

struct frame_stack the_frame_stack;

static void
catch_on_exit(void)
{
  frstack_unwind(&the_frame_stack, NULL);
  frstack_free(&the_frame_stack, NULL);
}


void
init_catch(void)
{
  frstack_init(&the_frame_stack);
  if (atexit(catch_on_exit) != 0)
    {
      fprintf(stderr, "init_catch: atexit() failed!\n");
      exit(EXIT_FAILURE);
    }
}
