#include "f2c.h"#include "fio.h"Include dependency graph for backspac.c:

Go to the source code of this file.
Functions | |
| integer | f_back (alist *a) |
Definition at line 9 of file backspac.c.
References a, b, err, errno, f(), f__curunit, f__nowreading(), f__units, fk_open(), FSEEK, FTELL, MXUNIT, n, NULL, OFF_T, SEEK_CUR, SEEK_SET, t_runc(), v, void(), w, x, y, and z.
00011 { unit *b; 00012 OFF_T v, w, x, y, z; 00013 uiolen n; 00014 FILE *f; 00015 00016 f__curunit = b = &f__units[a->aunit]; /* curunit for error messages */ 00017 if(a->aunit >= MXUNIT || a->aunit < 0) 00018 err(a->aerr,101,"backspace") 00019 if(b->useek==0) err(a->aerr,106,"backspace") 00020 if(b->ufd == NULL) { 00021 fk_open(1, 1, a->aunit); 00022 return(0); 00023 } 00024 if(b->uend==1) 00025 { b->uend=0; 00026 return(0); 00027 } 00028 if(b->uwrt) { 00029 t_runc(a); 00030 if (f__nowreading(b)) 00031 err(a->aerr,errno,"backspace") 00032 } 00033 f = b->ufd; /* may have changed in t_runc() */ 00034 if(b->url>0) 00035 { 00036 x=FTELL(f); 00037 y = x % b->url; 00038 if(y == 0) x--; 00039 x /= b->url; 00040 x *= b->url; 00041 (void) FSEEK(f,x,SEEK_SET); 00042 return(0); 00043 } 00044 00045 if(b->ufmt==0) 00046 { FSEEK(f,-(OFF_T)sizeof(uiolen),SEEK_CUR); 00047 fread((char *)&n,sizeof(uiolen),1,f); 00048 FSEEK(f,-(OFF_T)n-2*sizeof(uiolen),SEEK_CUR); 00049 return(0); 00050 } 00051 w = x = FTELL(f); 00052 z = 0; 00053 loop: 00054 while(x) { 00055 x -= x < 64 ? x : 64; 00056 FSEEK(f,x,SEEK_SET); 00057 for(y = x; y < w; y++) { 00058 if (getc(f) != '\n') 00059 continue; 00060 v = FTELL(f); 00061 if (v == w) { 00062 if (z) 00063 goto break2; 00064 goto loop; 00065 } 00066 z = v; 00067 } 00068 err(a->aerr,(EOF),"backspace") 00069 } 00070 break2: 00071 FSEEK(f, z, SEEK_SET); 00072 return 0; 00073 }
Here is the call graph for this function:

1.5.1