1 /* BEGIN INCLUDE FILE gcos_next_arg.incl.pl1   (Wardd Multics)  06/09/81 2041.7 mst Tue */
 2 next_arg: proc (i, p, l)returns (bit (1));
 3 
 4 /* Set pointer "p" to the next argument in "arg_string"
 5    and "l" to length of the argument, return "0"b.
 6    Return "1"b if no more arguments.
 7 */
 8 dcl  i                        fixed bin(24)parm;
 9 dcl  l                        fixed bin(24)parm;
10 dcl  p                        ptr parm;
11           if i = 1 then do;                                 /* First argument. */
12                rp = addr (arg_string);
13                rl = length (arg_string);
14           end;
15           if rl<1 then return ("1"b);                       /* No more arguments. */
16           k = index (rs, ",");
17           p = rp;
18           if k = 0 then do;                                 /* Final argument. */
19                l = rl;
20                rl = 0;
21                rp = null ();
22                return ("0"b);
23           end;
24 
25 /* More arguments remaining. */
26           l = k-1;
27           rp = addr (rs2 (k+1));
28           rl = rl - k;
29           return ("0"b);
30 
31 dcl  addr                     builtin;
32 dcl  index                    builtin;
33 dcl  k                        fixed bin(24);
34 dcl  length                   builtin;
35 dcl  rl                       fixed bin(24)static int;
36 dcl  rp                       ptr static int;
37 dcl  rs                       char(rl)unal based(rp);
38 dcl  rs2                      (k+1)char(1)unal based(rp);
39      end next_arg;
40 
41 /*   END INCLUDE FILE gcos_next_arg.incl.pl1 */