Subject: more on longjmp()
To: None <port-hp300@sun-lamp.cs.berkeley.edu>
From: jason downs <downsj@CSOS.ORST.EDU>
List: port-hp300
Date: 07/26/1994 14:40:13
since a type-o in my first letter will no doubt confuse people, here is
a demonstration of the problem:

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

main()
{
  jmp_buf me;
  int ret;

  ret = setjmp(me);
  switch(ret) {
  case 0:
    fputs("Initial setjmp() succeeded.\n", stdout);
    break;
  case 1:
    fputs("longjmp() succeeded.\n", stdout);
    exit(0);
  default:
    printf("longjmp() returned %d.\n", ret);
    exit(-1);
  }
  longjmp(me, 1);
}
--------

everywhere else, this code works as it should, sending output that both
setjmp() and longjmp() succeeded, including NetBSD/i386.

sample output from hp300:

2:31pm (nemesis) 33% a.out
Initial setjmp() succeeded.
longjmp() returned 67338628.
2:31pm (nemesis) 34% a.out
Initial setjmp() succeeded.
longjmp() returned 67338628.
2:31pm (nemesis) 35%

the value that longjmp() causes setjmp() to return varies between reboots,
but seems to remain constant otherwise.

--
                    ----------------------------------------
-------------------// jason downs // downsj@CSOS.ORST.EDU //------------------
                   ----------------------------------------      JD105
		  http://www.CSOS.ORST.EDU/downsj/index.html
		       have you fed your sysadmin today?

------------------------------------------------------------------------------