2 * error.c - error handling functions for cawf(1)
6 * Copyright (c) 1991 Purdue University Research Foundation,
7 * West Lafayette, Indiana 47907. All rights reserved.
9 * Written by Victor A. Abell <abe@mace.cc.purdue.edu>, Purdue
10 * University Computing Center. Not derived from licensed software;
11 * derived from awf(1) by Henry Spencer of the University of Toronto.
13 * Permission is granted to anyone to use this software for any
14 * purpose on any computer system, and to alter it and redistribute
15 * it freely, subject to the following restrictions:
17 * 1. The author is not responsible for any consequences of use of
18 * this software, even if they arise from flaws in it.
20 * 2. The origin of this software must not be misrepresented, either
21 * by explicit claim or by omission. Credits must appear in the
24 * 3. Altered versions must be plainly marked as such, and must not
25 * be misrepresented as being the original software. Credits must
26 * appear in the documentation.
28 * 4. This notice may not be removed or altered.
35 * Error(t, l, s1, s2) - issue error message
40 int t
; /* type: WARN or FATAL */
41 int l
; /* LINE: display Line[] */
42 char *s1
, *s2
; /* optional text */
44 char msg
[MAXLINE
]; /* message */
46 if (t
== WARN
&& !Dowarn
) return;
49 (void) fprintf(Efs
, "%s: (%s, %d):%s%s - %s\n",
53 (s1
== NULL
) ? "" : s1
,
54 (s2
== NULL
) ? "" : s2
,
57 (void) fprintf(Efs
, "%s:%s%s\n",
59 (s1
== NULL
) ? "" : s1
,
60 (s2
== NULL
) ? "" : s2
);
69 * Error3(len, word, sarg, narg) - process error in pass3
73 Error3(len
, word
, sarg
, narg
, msg
)
74 int len
; /* length (negative is special */
75 char *word
; /* word */
76 char *sarg
; /* string argument */
77 int narg
; /* numeric argument */
78 char *msg
; /* message */
81 (void) fprintf(Efs
, "%s: (%s, %d) %s\n",
83 (word
== NULL
) ? "<none>" : word
,
85 (sarg
== NULL
) ? "<none>" : sarg
);
89 "%s: pass3, len=%d, word=\"%s\", sarg=\"%s\", narg=%d%s%s\n",
91 (word
== NULL
) ? "" : word
,
92 (sarg
== NULL
) ? "" : sarg
,
94 (msg
== NULL
) ? "" : " - ",
95 (msg
== NULL
) ? "" : msg
);