Programming Guide


Tests a field for yes

int sm_is_yes(int field_number);
int sm_e_is_yes(char *field_name, int element);
int sm_i_is_yes(char *field_name, int occurrence);
int sm_n_is_yes(char *field_name);
int sm_o_is_yes(int field_number, int occurrence);

field_name, field_number
The field to test.

The element in field_name to test.

The occurrence in the field to test.



sm_is_yes compares the first character of the data in the specified field or occurrence to the first letter of the SM_YES entry in the message file, ignoring case. A return of 0 (failure) does not indicate whether the failure occurred because the field contains the value of SM_NO or for another reason. To test for SM_NO, use sm_is_no.

You can use this function with one-letter fields that specify the yes/no character edit. For these fields, users can enter only the values SM_YES or SM_NO, or space (= SM_NO). Unlike some other functions, sm_is_yes does not ignore leading blanks.

See Also