File:  [MW Coherent from dump] / coherent / a / usr / bob / uusrc / junk / segtrap.c
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Wed May 29 04:56:34 2019 UTC (7 years ago) by root
Branches: MarkWilliams, MAIN
CVS tags: relic, HEAD
coherent

#include <signal.h>
#include <setjmp.h>
jmp_buf helpme;
int	stop;
int	catchintr();
catchintr()
{
	char	*cot = "Caught the silly interrupt\n";
	signal(SIGSEGV, SIG_IGN);
	write(1, cot, strlen(cot));
	printf("Caught interrupt\n");
	stop++;
	signal(SIGSEGV, catchintr);
	longjmp(helpme, 3);
}

main()
{
	char	*cp;
	int	c;

	stop = 0;
	signal(SIGSEGV, catchintr);
	if(setjmp(helpme) == 0) {
		cp = (char *) 0x1A00;
		c = *cp;
	}

	printf("stop is %d\n", stop);
	exit (0);
}

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.