Check for SYS/GL during library init. Reason is that
[AROS.git] / workbench / network / stacks / AROSTCP / netlib / _lseek.c
blobdb8758bac38afcc2d5f057a472608d346e56516e
1 /* $Id$
3 * _lseek.c - lseek() which knows sockets (SAS/C)
5 * Copyright © 1994 AmiTCP/IP Group,
6 * Network Solutions Development Inc.
7 * All rights reserved.
8 */
10 #include <ios1.h>
11 #include <fcntl.h>
12 #include <stdlib.h>
13 #include <dos.h>
14 #include <errno.h>
15 #include <dos/dos.h>
16 #include <proto/dos.h>
18 long
19 __lseek(int fd, long rpos, int mode)
21 struct UFB *ufb;
22 long apos;
25 * Check for the break signals
27 __chkabort();
29 * find the ufb *
31 if ((ufb = __chkufb(fd)) == NULL) {
32 errno = EINVAL;
33 return -1;
36 _OSERR = 0;
38 if (ufb->ufbflg & UFB_SOCK) {
39 errno = ESPIPE; /* illegal seek */
40 return -1;
43 if ((apos = Seek(ufb->ufbfh, rpos, mode - 1)) == -1) {
44 _OSERR = IoErr();
45 errno = EIO;
46 return -1;
49 switch (mode) {
50 case 0:
51 return rpos;
52 case 1:
53 return apos + rpos;
54 case 2:
55 return Seek(ufb->ufbfh, 0, 0);