1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
|
/* -*-C-*- f20open.h */
/*-->f20open*/
/**********************************************************************/
/****************************** f20open *******************************/
/**********************************************************************/
#if OS_TOPS20
FILE*
f20open(filename,mode)
char *filename;
char *mode;
/***********************************************************************
Input files are opened in bytesize 8, since this is what is expected for
dvi files. Output files are opened in bytesize BYTE_SIZE, which will be
7 or 8, depending on the output device.
***********************************************************************/
{
int fp;
if (g_dolog && (g_logfp != (FILE *)NULL))
{
(void)fprintf(g_logfp,"%%Opening %d-bit file %s for mode %s",
((mode[0] == 'r') ? 8 : BYTE_SIZE),filename,mode);
NEWLINE(g_logfp);
}
/* Copy file in bytesize BYTE_SIZE with binary flag set to prevent
CRLF <--> LF mapping; the "rb" or "wb" flag is not sufficient for
this because PCC-20 maintains two places internally
where the binary flag is set, and both are used! */
if (mode[0] == 'r')
#if KCC_20
return(fopen(filename,RB_OPEN));
#endif /* KCC_20 */
#if PCC_20
if ((fp = open(filename,FATT_RDONLY | FATT_SETSIZE | FATT_BINARY,
8)) >= 0)
return(fdopen(fp,RB_OPEN));
else
return((FILE*)NULL);
#endif /* PCC_20 */
else if (mode[0] == 'w')
#if KCC_20
#if BYTE_SIZE == 7
return (fopen(filename,"wb7"));
#else
#if BYTE_SIZE == 8
return (fopen(filename,"wb8"));
#else
fatal("Illegal bytesize set for KCC-20 implementation");
#endif
#endif
#endif /* KCC_20 */
#if PCC_20
if ((fp = open(filename, FATT_WRONLY | FATT_SETSIZE | FATT_BINARY,
BYTE_SIZE)) >= 0)
return(fdopen(fp,WB_OPEN));
else
return((FILE*)NULL);
#endif /* PCC_20 */
else
{
(void)sprintf(message,
"f20open does not understand open mode %s for file %s",
mode,filename);
fatal(message);
}
}
#endif /* OS_TOPS20 */
|