TutOptionSetEnumList


Name

TutOptionSetEnumList — set the value of an enumerated list option

Synopsis

T_BOOL TutOptionSetEnumList(option, enum_list_val) 
T_OPTION option; 
T_STR_LIST enum_list_val; 

Arguments

option — option to set

enum_list_val — enumerated list value to set option to

Return Values

TRUE if value is set successfully, FALSE otherwise.

Diagnostics

If TutOptionSetEnumList fails, it returns FALSE and sets the global SmartSockets error number to one of:

Description

TutOptionSetEnumList sets the enumerated list value of option. The argument enum_list_val is a linked list of strings. The string list passed in is copied, so the caller does not need to maintain storage for this list.

Caution

There is no way to specify legal values for enumerated list options. If this type of checking is required, it must be implemented using an option verify function. See TutOptionSetVerifyFunc on page 188 for more information on option verify functions.

See Also

TutOptionGetEnumList, TutOptionSetVerifyFunc

Examples

This example sets the value of the option named enum_list_opt to contain two enumerated values:

T_OPTION enum_list_opt; 
T_STR_LIST enum_list_val, node; 
T_STR_LIST_STRUCT node1, node2; 
 
enum_list_opt = TutOptionLookup("enum_list_opt"); 
if (enum_list_opt == NULL) { 
  /* error */ 
} 
 
node1.string = "red"; 
node2.string = "blue"; 
node1.next = &node2; 
node2.next = NULL; 
 
if (!TutOptionSetEnumList(enum_list_opt, &node1)) { 
  /* error */ 
} 
 
/* Dump the string values */ 
if (!TutOptionGetEnumList(enum_list_opt, &enum_list_val)) { 
  /* error */ 
} 
 
for (node = enum_list_val; node != NULL; node = node->next) { 
  TutOut("%s\n", node->string); 
} 

TIBCO SmartSockets™ Utilities
Software Release 6.8, July 2006
Copyright © TIBCO Software Inc. All rights reserved
www.tibco.com