Annotation of researchv10dc/cmd/icon/pi/pil/seek.c, revision 1.1.1.1

1.1       root        1: /*
                      2:  *     SEEK
                      3:  *
                      4:  *     Seek to position in stream
                      5:  *
                      6:  *     Stephen B. Wampler
                      7:  *
                      8:  *     Last modified 5/2/86 by Ralph E. Griswold
                      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: FncDcl(seek,3)
                     19:    {
                     20:    long l1, l2;
                     21:    int status;
                     22:    FILE *fd;
                     23:    long ftell();
                     24: 
                     25:    if (Arg1.dword != D_File)
                     26:       runerr(106);
                     27: 
                     28:    defint(&Arg2, &l1, 0);
                     29:    defshort(&Arg3, 0);
                     30: 
                     31:    fd = BlkLoc(Arg1)->file.fd;
                     32: 
                     33:    if ((BlkLoc(Arg1)->file.status == 0) ||
                     34:        (fseek(fd, l1, Arg3.vword.integr) == -1))
                     35:       Fail;
                     36:    Mkint(ftell(fd), &Arg0);
                     37:    Return;
                     38:    }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.