Example: lr_get_attrib_long

In the following example, lr_get_attrib_long retrieves the value of the loop parameter from the mdrv command line string that was used to run the script:

test1   -host sun2   -loop 4   -time 10

where test1 is the name of the executable, and host, loop and time are command line options. lr_get_attrib_long assigns the value to a variable, iterations. This variable is incorporated into the script and sets how many loops to perform.

Action() {
    long loop;
    int i;
    iterations=lr_get_attrib_long("loop");
    if (iterations==0){
        lr_error_message("Illegal value \n");
        return;
    }
    for (i=0; i <iterations; ++i) {
         /* perform test operations... */
    }
}