1: /*
   2: #	SEEK(3.icon)
   3: #
   4: #	Seek to position in stream
   5: #
   6: #	Stephen B. Wampler
   7: #
   8: #	Last modified 8/19/84
   9: #
  10: */
  11: 
  12: #include "../h/rt.h"
  13: 
  14: /*
  15:  * seek(file,offset,start) - seek to offset byte from start in file.
  16:  */
  17: 
  18: Xseek(nargs, arg3, arg2, arg1, arg0)
  19: int nargs;
  20: struct descrip arg3, arg2, arg1, arg0;
  21:    {
  22:    long l1, l2;
  23:    int status;
  24:    FILE *fd;
  25:    long ftell();
  26: 
  27:    DeRef(arg1)
  28:    if (arg1.type != D_FILE)
  29:       runerr(106);
  30: 
  31:    defint(&arg2, &l1, 0);
  32:    defshort(&arg3, 0);
  33: 
  34:    fd = BLKLOC(arg1)->file.fd;
  35: 
  36:    if ((BLKLOC(arg1)->file.status == 0) ||
  37:        (fseek(fd, l1, arg3.value.integr) == -1))
  38:       fail();
  39:    mkint(ftell(fd), &arg0);
  40:    }
  41: 
  42: Procblock(seek,3)

Defined functions

Xseek defined in line 18; never used
Last modified: 1984-08-19
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 837
Valid CSS Valid XHTML 1.0 Strict