_CP_atvar

The _CP_atvar function reads and writes D3 shell variables. It is equivalent to the BASIC u91 user exit.

Syntax

 _CP_atvar(CPSTR ** result, CPSTR * input)

Parameter(s)

result The result from processing the input parameter.
input This parameter can take on the following four forms:
  • Null string: Returns the names of all D3 shell variables as an attribute mark delimited list.
  • var.name: Returns the value associated with the specified variable.
  • var.name^value: Attribute mark delimited name and value.

    This assigns the given value to the specified variable.

  • var.name]: Name followed by value mark.

    This deletes the specified variable.

Description

This function returns:
  • 0: Success
  • -1: Error

Example(s)

 
 CPSTR * AM = _CP_mkstrl("\xfe", 1);
 CPSTR * VM = _CP_mkstrl("\xfd", 1);
 CPSTR * connectionType = _CP_mkstr("CONNECTIONTYPE");
 CPSTR * connectionTypeValue = _CP_mkstr("web interface");
 CPSTR * input = _CP_str_null;;
 CPSTR * result = _CP_str_null;
 
 // Display existing D3 shell variable names.
 if (_CP_atvar(&result, _CP_str_null) == 0) _CP_print(result);
 
 // Set the D3 shell variable called CONNECTIONTYPE to "web interface".
 _CP_cat(&input, connectionType, AM);
 _CP_cat(&input, input, connectionTypeValue);
 if (_CP_atvar(&result, input) == 0) _CP_print(result);
 
 // Display existing D3 shell variable names, followed by the value of the CONNECTIONTYPE variable.
 if (_CP_atvar(&result, _CP_str_null) == 0) _CP_print(result);
 if (_CP_atvar(&result, connectionType) == 0) _CP_print(result);
 
 // Delete the CONNECTIONTYPE variable then the display the remaining D3 shell variables.
 _CP_cat(&input, connectionType, VM);
 if (_CP_atvar(&result, input) == 0) _CP_print(result);
 if (_CP_atvar(&result, _CP_str_null) == 0) _CP_print(result);
 
 _CP_str_free(input);
 _CP_str_free(connectionType);
 _CP_str_free(connectionTypeValue);