annotate libcruft/misc/dostop.c @ 280:7e60a6f52cd4

[project @ 1994-01-09 03:59:32 by jwe] Initial revision
author jwe
date Sun, 09 Jan 1994 03:59:32 +0000
parents
children 611d403c7f3d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
280
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
1 /* dostop.c -*- C -*- */
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
2 /*
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
3
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
4 Copyright (C) 1992, 1993 John W. Eaton
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
5
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
6 This file is part of Octave.
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
7
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
8 Octave is free software; you can redistribute it and/or modify it
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
9 under the terms of the GNU General Public License as published by the
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
10 Free Software Foundation; either version 2, or (at your option) any
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
11 later version.
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
12
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
13 Octave is distributed in the hope that it will be useful, but WITHOUT
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
14 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
15 FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
16 for more details.
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
17
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
18 You should have received a copy of the GNU General Public License
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
19 along with Octave; see the file COPYING. If not, write to the Free
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
20 Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
21
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
22 */
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
23
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
24 #ifdef HAVE_CONFIG_H
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
25 #include "config.h"
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
26 #endif
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
27
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
28 #include <sys/types.h>
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
29 #ifdef HAVE_UNISTD_H
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
30 #include <unistd.h>
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
31 #endif
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
32 #include <signal.h>
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
33 #include <stdlib.h>
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
34
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
35 /*
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
36 * All the STOP statements in the Fortran routines have been replaced
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
37 * with a call to XSTOPX, defined in the file libcruft/misc/xstopx.f.
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
38 *
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
39 * The XSTOPX function calls this function, which will send a SIGINT
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
40 * signal to the program that invoked it.
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
41 *
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
42 * Octave\'s SIGINT signal handler calls jump_to_top_level(), and the
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
43 * user will end up at the top level instead of the shell prompt.
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
44 *
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
45 * Programs that don\'t handle SIGINT will be interrupted.
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
46 */
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
47
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
48 volatile void
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
49 #if defined (F77_APPEND_UNDERSCORE)
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
50 dostop_ (void)
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
51 #else
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
52 dostop (void)
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
53 #endif
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
54 {
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
55 kill (getpid (), SIGINT);
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
56 abort ();
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
57 }
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
58
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
59 /*
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
60 ;;; Local Variables: ***
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
61 ;;; mode: C ***
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
62 ;;; page-delimiter: "^/\\*" ***
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
63 ;;; End: ***
7e60a6f52cd4 [project @ 1994-01-09 03:59:32 by jwe]
jwe
parents:
diff changeset
64 */