1: /*
2: char id_backspace[] = "@(#)backspace.c 1.6";
3: *
4: * Backspace records
5: */
6:
7: #include "fio.h"
8:
9: static char bksp[] = "backspace";
10: char last_char();
11:
12: f_back(a)
13: alist *a;
14: { unit *b;
15: int n,i;
16: long x,y;
17:
18: lfname = NULL;
19: elist = NO;
20: external = YES;
21: errflag = a->aerr;
22: lunit = a->aunit;
23: if (not_legal(lunit))
24: err(errflag, F_ERUNIT, bksp)
25: b= &units[lunit];
26: if(!b->ufd && (n = fk_open(READ, SEQ, FMT, (ftnint)lunit)) )
27: err(errflag, n, bksp)
28: lfname = b->ufnm;
29: if(b->uend)
30: { b->uend = NO;
31: clearerr(b->ufd);
32: return(OK);
33: }
34: if((x = ftell(b->ufd)) == 0)
35: return(OK);
36: if(!b->useek)
37: err(errflag, F_ERNOBKSP, bksp)
38: if(b->uwrt && (n = t_runc(b, errflag, bksp))) /* sets 'reading' */
39: return(n);
40: if(b->url) /* direct access, purely academic */
41: { y = x%(long)b->url;
42: x -= y?y:b->url;
43: fseek(b->ufd,x,0);
44: return(OK);
45: }
46: if(!b->ufmt) /* unformatted sequential */
47: { fseek(b->ufd,-(long)sizeof(int),1);
48: fread((char *)&n,sizeof(int),1,b->ufd);
49: fseek(b->ufd,-(long)n-2*sizeof(int),1);
50: return(OK);
51: }
52: if(x == 1) /* formatted sequential */
53: { rewind(b->ufd);
54: return(OK);
55: }
56: while (last_char(b->ufd) != '\n') /* slow but simple */
57: ;
58: return(OK);
59: }
Defined functions
Defined variables
bksp
defined in line
9; used 4 times