Initializing help system before first use

shiftargv

Purpose
Shift current positional program arguments.
Synopsis
procedure shiftargv(n: integer)
procedure shiftargv
Argument
number of times to shift (default: 1)
Example
Consider the following model:
model mycmd
uses 'deploy'

 writeln("My arguments:",argc)
 forall(i in 1..argc) write(argv(i)," ")
 writeln
 if argc>1 then
  shiftargv
  writeln("After shift:",argc)
  forall(i in 1..argc) write(argv(i)," ")
  writeln
 end-if
end-model
Executed with the following command:
mosel exe mycmd.mos -- A B C
Will produce the following output:
My arguments:4
mycmd A B C
After shift:3
mycmd B C
Further information
1. This procedure shifts the positional program argumenst by n positions starting from the second arguments ( i.e. argv(1) is not altered): argv(2) is replaced by argv(2+n), argv(3) is replaced by argv(3+n), ... and the last n arguments are removed.
2. The behaviour of this procedure is undefined if it is used by several models of the same instance concurrently as the program arguments are shared by all models of the instance.
Related topics
Module

© 2001-2025 Fair Isaac Corporation. All rights reserved. This documentation is the property of Fair Isaac Corporation (“FICO”). Receipt or possession of this documentation does not convey rights to disclose, reproduce, make derivative works, use, or allow others to use it except solely for internal evaluation purposes to determine whether to purchase a license to the software described in this documentation, or as otherwise set forth in a written software license agreement between you and FICO (or a FICO affiliate). Use of this documentation and the software described in it must conform strictly to the foregoing permitted uses, and no other use is permitted.