Subversion Repositories tendra.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 7u83 1
/*
2
    		 Crown Copyright (c) 1997
3
 
4
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
6
    acting through the Defence Evaluation and Research Agency
7
    (DERA).  It is made available to Recipients with a
8
    royalty-free licence for its use, reproduction, transfer
9
    to other parties and amendment for any purpose not excluding
10
    product development provided that any such use et cetera
11
    shall be deemed to be acceptance of the following conditions:-
12
 
13
        (1) Its Recipients shall ensure that this Notice is
14
        reproduced upon any copies or amended versions of it;
15
 
16
        (2) Any amended version of it shall be clearly marked to
17
        show both the nature of and the organisation responsible
18
        for the relevant amendment or amendments;
19
 
20
        (3) Its onward transfer from a recipient to another
21
        party shall be deemed to be that party's acceptance of
22
        these conditions;
23
 
24
        (4) DERA gives no warranty or assurance as to its
25
        quality or suitability for any purpose and DERA accepts
26
        no liability whatsoever in relation to any use to which
27
        it may be put.
28
*/
29
 
30
 
31
/**********************************************************************
32
$Author: release $
33
$Date: 1998/01/17 15:57:24 $
34
$Revision: 1.1.1.1 $
35
$Log: errors.c,v $
36
 * Revision 1.1.1.1  1998/01/17  15:57:24  release
37
 * First version to be checked into rolling release.
38
 *
39
 * Revision 1.1  1995/04/07  14:29:07  currie
40
 * Initial revision
41
 *
42
 * Revision 1.3  1994/12/05  10:12:57  currie
43
 * Extended size of input buffer
44
 *
45
 * Revision 1.2  1994/07/21  10:35:59  currie
46
 * Added banner
47
 *
48
***********************************************************************/
49
#include "config.h"
50
#if FS_STDARG
51
#include <stdarg.h>
52
#else
53
#include <varargs.h>
54
#endif
55
#include "util.h"
56
#include "streams.h"
57
#include "errors.h"
58
#include "defs.h"
59
 
60
 
61
void fail
62
    PROTO_V ( ( char *s, ... ) )
63
    /*VARARGS*/
64
{
65
    char c ;
66
    va_list args ;
67
    FILE *f = stderr ;
68
#if FS_STDARG
69
    va_start ( args, s ) ;
70
#else
71
    char *s ;
72
    va_start ( args ) ;
73
    s = va_arg ( args, char * ) ;
74
#endif
75
    IGNORE fprintf ( f, "Error: " ) ;
76
    IGNORE vfprintf ( f, s, args ) ;
77
    c = buff [ bind ] ;
78
    buff [ bind ] = 0 ;
79
    IGNORE fprintf ( f, ", %s, line %ld.\n", file_name, cLINE ) ;
80
    IGNORE fprintf ( f, "    %s!!!!", buff ) ;
81
    buff [ bind ] = c ;
82
    IGNORE fprintf ( f, "%s\n", buff + bind ) ;
83
    va_end ( args ) ;
84
    exit ( EXIT_FAILURE ) ;
85
}
86
 
87
void assert_sort
88
    PROTO_N ( ( x ) )
89
    PROTO_T ( unsigned x )
90
{
91
    unsigned y = current_TDF->sort ;
92
    if ( y != x ) {
93
	fail ( "Sort error: req = %u, curr = %u", x, y ) ;
94
    }
95
    return ;
96
}
97
 
98
 
99
void assert_sort_or_empty
100
    PROTO_N ( ( x ) )
101
    PROTO_T ( unsigned x )
102
{
103
    unsigned y = current_TDF->sort ;
104
    if ( current_TDF->no != 0 && y != x ) {
105
	fail ( "Sort/list error: req = %u, curr = %u", x, y ) ;
106
    }
107
    return ;
108
}