Go to the documentation of this file.00001 #include "f2c.h"
00002 #include "fio.h"
00003 #ifdef __cplusplus
00004 extern "C" {
00005 #endif
00006 uiolen f__reclen;
00007
00008 int
00009 #ifdef KR_headers
00010 do_us(number,ptr,len) ftnint *number; char *ptr; ftnlen len;
00011 #else
00012 do_us(ftnint *number, char *ptr, ftnlen len)
00013 #endif
00014 {
00015 if(f__reading)
00016 {
00017 f__recpos += (int)(*number * len);
00018 if(f__recpos>f__reclen)
00019 err(f__elist->cierr, 110, "do_us");
00020 if (fread(ptr,(int)len,(int)(*number),f__cf) != *number)
00021 err(f__elist->ciend, EOF, "do_us");
00022 return(0);
00023 }
00024 else
00025 {
00026 f__reclen += *number * len;
00027 (void) fwrite(ptr,(int)len,(int)(*number),f__cf);
00028 return(0);
00029 }
00030 }
00031 #ifdef KR_headers
00032 integer do_ud(number,ptr,len) ftnint *number; char *ptr; ftnlen len;
00033 #else
00034 integer do_ud(ftnint *number, char *ptr, ftnlen len)
00035 #endif
00036 {
00037 f__recpos += (int)(*number * len);
00038 if(f__recpos > f__curunit->url && f__curunit->url!=1)
00039 err(f__elist->cierr,110,"do_ud");
00040 if(f__reading)
00041 {
00042 #ifdef Pad_UDread
00043 #ifdef KR_headers
00044 int i;
00045 #else
00046 size_t i;
00047 #endif
00048 if (!(i = fread(ptr,(int)len,(int)(*number),f__cf))
00049 && !(f__recpos - *number*len))
00050 err(f__elist->cierr,EOF,"do_ud")
00051 if (i < *number)
00052 memset(ptr + i*len, 0, (*number - i)*len);
00053 return 0;
00054 #else
00055 if(fread(ptr,(int)len,(int)(*number),f__cf) != *number)
00056 err(f__elist->cierr,EOF,"do_ud")
00057 else return(0);
00058 #endif
00059 }
00060 (void) fwrite(ptr,(int)len,(int)(*number),f__cf);
00061 return(0);
00062 }
00063 #ifdef KR_headers
00064 integer do_uio(number,ptr,len) ftnint *number; char *ptr; ftnlen len;
00065 #else
00066 integer do_uio(ftnint *number, char *ptr, ftnlen len)
00067 #endif
00068 {
00069 if(f__sequential)
00070 return(do_us(number,ptr,len));
00071 else return(do_ud(number,ptr,len));
00072 }
00073 #ifdef __cplusplus
00074 }
00075 #endif