Subversion Repositories tendra.SVN

Rev

Rev 2 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2 Rev 7
Line -... Line 1...
-
 
1
/*
-
 
2
 * Copyright (c) 2002-2006 The TenDRA Project <http://www.tendra.org/>.
-
 
3
 * All rights reserved.
-
 
4
 *
-
 
5
 * Redistribution and use in source and binary forms, with or without
-
 
6
 * modification, are permitted provided that the following conditions are met:
-
 
7
 *
-
 
8
 * 1. Redistributions of source code must retain the above copyright notice,
-
 
9
 *    this list of conditions and the following disclaimer.
-
 
10
 * 2. Redistributions in binary form must reproduce the above copyright notice,
-
 
11
 *    this list of conditions and the following disclaimer in the documentation
-
 
12
 *    and/or other materials provided with the distribution.
-
 
13
 * 3. Neither the name of The TenDRA Project nor the names of its contributors
-
 
14
 *    may be used to endorse or promote products derived from this software
-
 
15
 *    without specific, prior written permission.
-
 
16
 *
-
 
17
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS ``AS
-
 
18
 * IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
-
 
19
 * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-
 
20
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR
-
 
21
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
-
 
22
 * EXEMPLARY OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-
 
23
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
-
 
24
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
-
 
25
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
-
 
26
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
-
 
27
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
 
28
 *
-
 
29
 * $Id$
-
 
30
 */
1
/*
31
/*
2
    		 Crown Copyright (c) 1996
32
    		 Crown Copyright (c) 1996
3
 
33
 
4
    This TenDRA(r) Computer Program is subject to Copyright
34
    This TenDRA(r) Computer Program is subject to Copyright
5
    owned by the United Kingdom Secretary of State for Defence
35
    owned by the United Kingdom Secretary of State for Defence
Line 34... Line 64...
34
$Header: /u/g/release/CVSROOT/Source/src/installers/680x0/common/input.c,v 1.1.1.1 1998/01/17 15:55:48 release Exp $
64
$Header: /u/g/release/CVSROOT/Source/src/installers/680x0/common/input.c,v 1.1.1.1 1998/01/17 15:55:48 release Exp $
35
--------------------------------------------------------------------------
65
--------------------------------------------------------------------------
36
$Log: input.c,v $
66
$Log: input.c,v $
37
 * Revision 1.1.1.1  1998/01/17  15:55:48  release
67
 * Revision 1.1.1.1  1998/01/17  15:55:48  release
38
 * First version to be checked into rolling release.
68
 * First version to be checked into rolling release.
39
 *
69
 *
40
Revision 1.1.1.1  1997/10/13 12:42:54  ma
70
Revision 1.1.1.1  1997/10/13 12:42:54  ma
41
First version.
71
First version.
42
 
72
 
43
Revision 1.1.1.1  1997/03/14 07:50:12  ma
73
Revision 1.1.1.1  1997/03/14 07:50:12  ma
44
Imported from DRA
74
Imported from DRA
45
 
75
 
46
 * Revision 1.1.1.1  1996/09/20  10:56:54  john
76
 * Revision 1.1.1.1  1996/09/20  10:56:54  john
47
 *
77
 *
48
 * Revision 1.1.1.1  1996/03/26  15:45:12  john
78
 * Revision 1.1.1.1  1996/03/26  15:45:12  john
49
 *
79
 *
50
 * Revision 1.3  94/02/21  15:58:54  15:58:54  ra (Robert Andrews)
80
 * Revision 1.3  94/02/21  15:58:54  15:58:54  ra (Robert Andrews)
51
 * Accomodate changes in basicread.c.
81
 * Accomodate changes in basicread.c.
52
 *
82
 *
53
 * Revision 1.2  93/11/19  16:21:20  16:21:20  ra (Robert Andrews)
83
 * Revision 1.2  93/11/19  16:21:20  16:21:20  ra (Robert Andrews)
54
 * Comment of bignat stuff (no longer used).
84
 * Comment of bignat stuff (no longer used).
Line 62... Line 92...
62
 
92
 
63
#include "config.h"
93
#include "config.h"
64
#include "utility.h"
94
#include "utility.h"
65
#define failer failer_reject
95
#define failer failer_reject
66
#include "basicread.c"
96
#include "basicread.c"
67
 
97
 
68
 
98
 
69
/*
99
/*
70
    OPEN INPUT FILE
100
    OPEN INPUT FILE
71
 
101
 
72
    This routine is intended to replace initreader in basicread.c.
102
    This routine is intended to replace initreader in basicread.c.
73
*/
103
*/
74
 
104
 
75
void open_input
105
void
76
    PROTO_N ( ( nm ) )
-
 
77
    PROTO_T ( char *nm )
106
open_input(char *nm)
78
{
107
{
79
    crt_dot_t = nm ;
108
	crt_dot_t = nm;
80
    crt_lno = -1 ;
109
	crt_lno = -1;
81
    failer_count = 0 ;
110
	failer_count = 0;
82
 
111
 
83
    if ( strcmp ( nm, "-" ) ) {
112
	if (strcmp(nm, "-")) {
84
	fpin = fopen ( nm, "r" ) ;
113
		fpin = fopen(nm, "r");
85
	if ( fpin == null ) {
114
		if (fpin == null) {
86
	    error ( "Can't open input file, %s", nm ) ;
115
			error("Can't open input file, %s", nm);
87
	    exit ( EXIT_FAILURE ) ;
116
			exit(EXIT_FAILURE);
88
	}
117
		}
89
    } else {
118
	} else {
90
	int c ;
119
		int c;
91
	fpin = tmpfile () ;
120
		fpin = tmpfile();
92
	if ( fpin == null ) {
121
		if (fpin == null) {
93
	    error ( "Can't open temporary file" ) ;
122
			error("Can't open temporary file");
94
	    exit ( EXIT_FAILURE ) ;
123
			exit(EXIT_FAILURE);
-
 
124
		}
-
 
125
		while (c = fgetc(stdin), c != EOF) {
-
 
126
			fputc(c, fpin);
-
 
127
		}
-
 
128
		rewind(fpin);
95
	}
129
	}
96
	while ( c = fgetc ( stdin ), c != EOF ) fputc ( c, fpin ) ;
-
 
97
	rewind ( fpin ) ;
-
 
98
    }
-
 
99
    pkt_index = -1 ;
130
	pkt_index = -1;
100
    file_pkt = -1 ;
131
	file_pkt = -1;
101
    table_flag = 0 ;
132
	table_flag = 0;
102
    getcode_bitposn = 0 ;
133
	getcode_bitposn = 0;
103
    read_line ( 1 ) ;
134
	read_line(1);
104
    crt_line = buff ;
135
	crt_line = buff;
105
    crt_ptr = crt_line ;
136
	crt_ptr = crt_line;
106
    end_ptr = crt_line + cppkt ;
137
	end_ptr = crt_line + cppkt;
107
 
138
 
108
#if 0
139
#if 0
109
    bignat_work = alloc_nof ( unsigned short, 2 ) ;
140
	bignat_work = alloc_nof(unsigned short, 2);
110
    bignat_work [0] = 0 ;
141
	bignat_work[0] = 0;
111
    bignat_work [1] = 0 ;
142
	bignat_work[1] = 0;
112
    bignat_len = 2 ;
143
	bignat_len = 2;
113
#endif
144
#endif
114
    return ;
145
	return;
115
}
146
}