lr_get_attrib_string
Returns a string type value of an argument passed to the script run.
char *lr_get_attrib_string( char *argument_name );
| Alphabetical Listing - C Language Utility Functions |
Arguments
| Name | Comments |
|---|---|
| argument_name | The name of a script invocation argument. |
The lr_get_attrib_string function returns the value of an argument that was passed to the run of the script. For example, lr_get_attrib_string("ipv6") returns the IPv6 address of the current Vuser.
To view the arguments passed to a script run, see mdrv_cmd.txt in the script folder.
Return Values
The function returns the value of the argument as a string. If the argument is empty (for example a flag), an empty string is returned. If the argument does not exist, NULL is returned.
Parameterization
You cannot use standard parameterization for any arguments in this function.
Example
In the following example, lr_get_attrib_string retrieves the name of the host string value from the mdrv command line string that was used to run the script.
D:\<product>\bin\mdrv.exe -usr D:\LR_Tests\C\get_attribute\get_attribute.usr -out D:\LR_Tests\C\get_attribute\out -host sun2 -loop 4 -time 1.5
where host, loop and time are mdrv command line parameters to be used in get_attribute.usr. lr_get_attrib_string assigns the value of parameter "host" to the variable "server".
vuser_init() {
/* LPCSTR is a char * . */
LPCSTR server;
LPCSTR user = "tomh";
LPCSTR password = "pwd";
LPCSTR connect[10];
server=lr_get_attrib_string("host");
if (server==NULL){
lr_error_message("Failed to login. Unknown host.\n");
return(0);
}
/*Prepare a string with login information */
sprintf(connect,"%s%s%s", user, password, server);
lr_message("%s", connect);
return 0;

