/* show LONGJMP, SETJMP */

#include <stdio.h>
#include <setjmp.h>

jmp_buf env;

void main()
  {
    int ret_val;

    ret_val = 293;
    if( 0 == ( ret_val = setjmp( env ) ) ) {
      printf( "after setjmp %d\n", ret_val );
      rtn();
      printf( "back from rtn %d\n", ret_val );
    } else {
      printf( "back from longjmp %d\n", ret_val );
    }
  }

rtn()
  {
    printf( "about to longjmp\n" );
    longjmp( env, 14 );
  }
//************ Sample program output ************
//after setjmp 0
//about to longjmp
//back from longjmp 14
