1 /* $Id: sset.c,v 1.9 2020-11-19 02:31:31 phil Exp $ */
2 
3 #ifdef HAVE_CONFIG_H
4 #include "config.h"
5 #endif /* HAVE_CONFIG_H defined */
6 
7 #include <stdio.h>			/* for lib.h */
8 
9 #include "h.h"
10 #include "snotypes.h"
11 #include "macros.h"
12 #include "load.h"
13 #include "equ.h"
14 #include "lib.h"
15 
16 /*
17  * Experimental:
18  * LOAD("SSET(INTEGER,INTEGER,INTEGER[,INTEGER])INTEGER")
19  *
20  * Usage;	SSET(unit, offset, whence, scale)
21  * Returns;	scaled file position
22  */
23 
24 pmlret_t
SSET(LA_ALIST)25 SSET( LA_ALIST ) {
26     int_t unit, offset, whence, scale, oof;
27 
28     (void) nargs;
29     unit = LA_INT(0);
30     offset = LA_INT(1);
31     whence = LA_INT(2);
32     scale = LA_INT(3);
33     if (scale == 0)
34 	scale = 1;
35 
36     if (io_sseek( unit, offset, whence, scale, &oof )) {
37 	RETINT( oof );
38     }
39     RETFAIL;
40 }
41