summaryrefslogtreecommitdiff
path: root/systems/knuth/local/mfware-sparc/gftopk_ext.c
blob: 5301fc90be453acbd391abec85355f6e1a28afeb (plain)
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
#include "h00vars.h"		/* defines Pascal I/O structure */

#define namelength 100          /* should agree with gftopk.ch and gftype.ch */

bseek(filep,cnt)
	register struct iorec	*filep;
	int      	cnt;
{
	register FILE	*iop;	/* stdio-style FILE pointer */

	iop = filep->fbuf;
	fseek(iop,(long)cnt,0);
}

bool testreadaccess(fn)
	char  *fn;
{
	register char *p;

	fn[namelength-1] = ' ';
	p = fn;
	while (*p++ != ' ');
	p--;
	*p = '\0';
	if (access(fn,4)==0) {
	  *p = ' '; return(TRUE);}
	else {*p = ' '; return(FALSE);}
}

int flength(filep)
	register struct iorec	*filep;
{
	register FILE	*iop;	/* stdio-style FILE pointer */
	register long	pos;    /* current file position */
	register int	len;	/* the file length */

	iop = filep->fbuf;
	pos = ftell(iop);
	fseek(iop,0L,2);
	len = ftell(iop);
	fseek(iop,pos,0);
	return(len);
}