# 2.11BSD#431 - /usr/src/usr.lib/libI77/sue.c

##### Functions

    c_sue             X
    e_rsue            X
    e_wsue            X
    s_rsue            X
    s_wsue            X

##### Variables

    recloc            X
    rsue              X
    wsue              X

       1: /*
       2:  * Copyright (c) 1980 Regents of the University of California.
       3:  * All rights reserved.  The Berkeley software License Agreement
       4:  * specifies the terms and conditions for redistribution.
       5:  *
       6:  *	@(#)sue.c	5.1	6/7/85
       7:  */
       8:
       9: /*
      10:  * sequential unformatted external read/write routines
      11:  */
      12:
      13: #include "fio.h"
      14:
      15: extern int reclen;
      16: LOCAL long recloc;
      17: LOCAL char rsue[] = "read sue";
      18: LOCAL char wsue[] = "write sue";
      19:
      20: s_rsue(a) cilist *a;
      21: {
      22:     int n;
      23:     reading = YES;
      24:     if(n=c_sue(a,READ)) return(n);
      25:     if(curunit->uwrt && ! nowreading(curunit)) err(errflag, errno, rsue)
      26:     recpos = 0;
      27:     if(fread(&reclen,sizeof(int),1,cf) == 1) return(OK);
      28:     if(feof(cf))
      29:     {   curunit->uend = YES;
      30:         err(endflag, EOF, rsue)
      31:     }
      32:     clearerr(cf);
      33:     err(errflag, errno, rsue)
      34: }
      35:
      36: s_wsue(a) cilist *a;
      37: {
      38:     int n;
      39:     reading = NO;
      40:     if(n=c_sue(a,WRITE)) return(n);
      41:     if(!curunit->uwrt && ! nowwriting(curunit)) err(errflag, errno, wsue)
      42:     reclen = 0;
      43:     recloc=ftell(cf);
      44:     fseek(cf,(long)sizeof(int),1);
      45:     curunit->uend = NO;
      46:     return(OK);
      47: }
      48:
      49: LOCAL
      50: c_sue(a,flag) cilist *a;
      51: {   int n;
      52:     external = sequential = YES;
      53:     formatted = NO;
      54:     lfname = NULL;
      55:     elist = NO;
      56:     errflag = a->cierr;
      57:     endflag = a->ciend;
      58:     lunit = a->ciunit;
      59:     if(not_legal(lunit)) err(errflag,F_ERUNIT,rsue+5)
      60:     curunit = &units[lunit];
      61:     if(!curunit->ufd && (n=fk_open(flag,SEQ,UNF,(ftnint)lunit)))
      62:         err(errflag,n,rsue+5)
      63:     cf = curunit->ufd;
      64:     elist = YES;
      65:     lfname = curunit->ufnm;
      66:     if(curunit->ufmt) err(errflag,F_ERNOUIO,rsue+5)
      67:     if(curunit->url) err(errflag,F_ERNOSIO,rsue+5)
      68:     if(!curunit->useek) err(errflag,F_ERSEEK,rsue+5)
      69:     return(OK);
      70: }
      71:
      72: e_wsue()
      73: {   long loc;
      74:     fwrite(&reclen,sizeof(int),1,cf);
      75:     loc=ftell(cf);
      76:     fseek(cf,recloc,0);
      77:     fwrite(&reclen,sizeof(int),1,cf);
      78:     fseek(cf,loc,0);
      79:     return(OK);
      80: }
      81:
      82: e_rsue()
      83: {
      84:     fseek(cf,(long)(reclen-recpos+sizeof(int)),1);
      85:     return(OK);
      86: }

#### Defined functions

c_sue defined in line 49; used 2 times

- in line 24, 40

e_rsue defined in line 82; used 1 times

- in /usr/src/usr.lib/libI77/douio.c line 26

e_wsue defined in line 72; never used
s_rsue defined in line 20; never used
s_wsue defined in line 36; never used

#### Defined variables

recloc defined in line 16; used 2 times

- in line 43, 76

rsue defined in line 17; used 8 times

- in line 25-33(3), 59-68(5)

wsue defined in line 18; used 1 times

- in line 41

Last modified: 1987-02-18 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 581 |