Mercurial > repo
comparison interps/c-intercal/src/ick_lose.c @ 996:859f9b4339e6
<Gregor> tar xf egobot.tar.xz
author | HackBot |
---|---|
date | Sun, 09 Dec 2012 19:30:08 +0000 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
995:6883f5911eb7 | 996:859f9b4339e6 |
---|---|
1 /* | |
2 * | |
3 * NAME | |
4 * ick_lose.c -- report INTERCAL compile- or run-time error | |
5 * | |
6 LICENSE TERMS | |
7 Copyright (C) 1996 Eric S. Raymond | |
8 | |
9 This program is free software; you can redistribute it and/or modify | |
10 it under the terms of the GNU General Public License as published by | |
11 the Free Software Foundation; either version 2 of the License, or | |
12 (at your option) any later version. | |
13 | |
14 This program is distributed in the hope that it will be useful, | |
15 but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 GNU General Public License for more details. | |
18 | |
19 You should have received a copy of the GNU General Public License | |
20 along with this program; if not, write to the Free Software | |
21 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | |
22 */ | |
23 /*LINTLIBRARY*/ | |
24 #include "config.h" | |
25 #include <stdio.h> | |
26 #include <stdlib.h> | |
27 #include <signal.h> | |
28 #include "ick_lose.h" | |
29 | |
30 int ick_coreonerr = 0; /* AIS */ | |
31 | |
32 int ick_checkforbugs; /* AIS */ | |
33 | |
34 /*@-formatconst@*/ | |
35 void ick_lose(const char *m, int n, const char *s) | |
36 { | |
37 (void) fflush(stdout); /* AIS: To stop stdout getting muddled with stderr*/ | |
38 (void) fprintf(stderr, | |
39 "ICL%c%c%cI\t", | |
40 m[0], m[1], m[2]); | |
41 if (s) | |
42 (void) fprintf(stderr, m + 4, s, n); | |
43 else | |
44 (void) fprintf(stderr, m + 4, n); | |
45 (void) fprintf(stderr, " CORRECT SOURCE AND RESUBNIT\n"); | |
46 if(atoi(m)==778&&ick_coreonerr) /* AIS */ | |
47 { | |
48 /* AIS: Dump core. */ | |
49 (void) raise(SIGABRT); | |
50 } | |
51 exit(atoi(m)); | |
52 } | |
53 | |
54 /* AIS: This function reports potential bugs. It's paraphrased from ick_lose. */ | |
55 void ick_lwarn(const char *m, int n, const char *s) | |
56 { | |
57 if(!ick_checkforbugs) return; /* Don't report a potential bug without -l */ | |
58 (void) fflush(stdout); | |
59 (void) fprintf(stderr, | |
60 "ICL%c%c%cW\t", | |
61 m[0],m[1],m[2]); | |
62 if (s) | |
63 (void) fprintf(stderr, m + 4, s, n); | |
64 else if(m[0]!='2'||m[1]!='7'||m[2]!='8') | |
65 (void) fprintf(stderr, m + 4, n); | |
66 else | |
67 (void) fprintf(stderr, m + 4); | |
68 (void) fprintf(stderr, " RECONSIDER SOURCE AND RESUBNIT\n\n"); | |
69 /* Don't exit. This is not any error except one not causing immediate | |
70 termination of program execution. */ | |
71 } | |
72 /*@=formatconst@*/ | |
73 | |
74 /* ick_lose.c ends here */ |