Example (getsyntx -- Return LC_SYNTAX Characters)

This example uses getsyntx to show the value of various special characters.

    #include <stdio.h>
    #include <stdlib.h>
    #include <variant.h>
    #include <locale.h>

    #if (1 == __TOS_OS2__)
       #define LOCNAME "en_us.ibm-850"      /* OS/2 name */
    #else
       #define LOCNAME "fr_fr.ibm-1252"  /* Windows name */
    #endif

    int main(void)
    {
       struct variant *var;

       if (NULL == setlocale(LC_ALL, LOCNAME)) {
          printf("Locale \"%s\" could not be loaded\n", LOCNAME);
          exit(1);
       }
       var = getsyntx();
       printf("codeset         : %s\n", var->codeset         );
       printf("backslash       : %c\n", var->backslash       );
       printf("right_bracket   : %c\n", var->right_bracket   );
       printf("left_bracket    : %c\n", var->left_bracket    );
       printf("right_brace     : %c\n", var->right_brace     );
       printf("left_brace      : %c\n", var->left_brace      );
       printf("circumflex      : %c\n", var->circumflex      );
       printf("tilde           : %c\n", var->tilde           );
       printf("exclamation_mark: %c\n", var->exclamation_mark);
       printf("number_sign     : %c\n", var->number_sign     );
       printf("vertical_line   : %c\n", var->vertical_line   );
       printf("dollar_sign     : %c\n", var->dollar_sign     );
       printf("commercial_at   : %c\n", var->commercial_at   );
       printf("grave_accent    : %c\n", var->grave_accent    );
       return 0;

       /********************************************************
          The output should be similar to :

          codeset         : LOCNAME
          backslash       : \
          right_bracket   : ]
          left_bracket    : [
          right_brace     : }
          left_brace      : {
          circumflex      : ^
          tilde           : ~
          exclamation_mark: !
          number_sign     : #
          vertical_line   : |
          dollar_sign     : $
          commercial_at   : @
          grave_accent    : `
       *********************************************************/
    }