sue.c
Go to the documentation of this file.
00001 #include "f2c.h"
00002 #include "fio.h"
00003 #ifdef __cplusplus
00004 extern "C" {
00005 #endif
00006 extern uiolen f__reclen;
00007 OFF_T f__recloc;
00008 
00009  int
00010 #ifdef KR_headers
00011 c_sue(a) cilist *a;
00012 #else
00013 c_sue(cilist *a)
00014 #endif
00015 {
00016         f__external=f__sequential=1;
00017         f__formatted=0;
00018         f__curunit = &f__units[a->ciunit];
00019         if(a->ciunit >= MXUNIT || a->ciunit < 0)
00020                 err(a->cierr,101,"startio");
00021         f__elist=a;
00022         if(f__curunit->ufd==NULL && fk_open(SEQ,UNF,a->ciunit))
00023                 err(a->cierr,114,"sue");
00024         f__cf=f__curunit->ufd;
00025         if(f__curunit->ufmt) err(a->cierr,103,"sue")
00026         if(!f__curunit->useek) err(a->cierr,103,"sue")
00027         return(0);
00028 }
00029 #ifdef KR_headers
00030 integer s_rsue(a) cilist *a;
00031 #else
00032 integer s_rsue(cilist *a)
00033 #endif
00034 {
00035         int n;
00036         if(!f__init) f_init();
00037         f__reading=1;
00038         if(n=c_sue(a)) return(n);
00039         f__recpos=0;
00040         if(f__curunit->uwrt && f__nowreading(f__curunit))
00041                 err(a->cierr, errno, "read start");
00042         if(fread((char *)&f__reclen,sizeof(uiolen),1,f__cf)
00043                 != 1)
00044         {       if(feof(f__cf))
00045                 {       f__curunit->uend = 1;
00046                         err(a->ciend, EOF, "start");
00047                 }
00048                 clearerr(f__cf);
00049                 err(a->cierr, errno, "start");
00050         }
00051         return(0);
00052 }
00053 #ifdef KR_headers
00054 integer s_wsue(a) cilist *a;
00055 #else
00056 integer s_wsue(cilist *a)
00057 #endif
00058 {
00059         int n;
00060         if(!f__init) f_init();
00061         if(n=c_sue(a)) return(n);
00062         f__reading=0;
00063         f__reclen=0;
00064         if(f__curunit->uwrt != 1 && f__nowwriting(f__curunit))
00065                 err(a->cierr, errno, "write start");
00066         f__recloc=FTELL(f__cf);
00067         FSEEK(f__cf,(OFF_T)sizeof(uiolen),SEEK_CUR);
00068         return(0);
00069 }
00070 integer e_wsue(Void)
00071 {       OFF_T loc;
00072         fwrite((char *)&f__reclen,sizeof(uiolen),1,f__cf);
00073 #ifdef ALWAYS_FLUSH
00074         if (fflush(f__cf))
00075                 err(f__elist->cierr, errno, "write end");
00076 #endif
00077         loc=FTELL(f__cf);
00078         FSEEK(f__cf,f__recloc,SEEK_SET);
00079         fwrite((char *)&f__reclen,sizeof(uiolen),1,f__cf);
00080         FSEEK(f__cf,loc,SEEK_SET);
00081         return(0);
00082 }
00083 integer e_rsue(Void)
00084 {
00085         FSEEK(f__cf,(OFF_T)(f__reclen-f__recpos+sizeof(uiolen)),SEEK_CUR);
00086         return(0);
00087 }
00088 #ifdef __cplusplus
00089 }
00090 #endif


swiftnav
Author(s):
autogenerated on Sat Jun 8 2019 18:56:15