*copyc osd$default_pragmats
MODULE iim$change_terminal_attributes;

{ PURPOSE:  This ring 2 module changes the terminal attributes for a dual
{           state connection to the attribute values specified on a SETTA
{           or CHATA command.
{
{  DESIGN:  The input attribute keys and values are validated and then a
{           CNTL/CHAR/R message is built using the input attribute values.
{           This message is sent downline to PASSON to effect the terminal
{           characteristics change in the TIP.  The connection descriptor's
{           terminal attributes are finally updated with the new attribute
{           values.
{
{           Note that as of 3/6/86 this module does not wait for a normal
{           response (i.e., CNTL/CHAR/N) to ensure that the TIP was actually
{           changed.  Consequently, if an attribute change is rejected by
{           the network for some reason, this module would not detect it
{           and would unknowingly update the connection descriptor with the
{           wrong values.
{
?? TITLE := 'MODULE iim$change_terminal_attributes' ??

?? PUSH (LISTEXT := ON) ??
*copyc CLP$VALIDATE_NAME
*copyc IFE$ERROR_CODES
*copyc IFT$TERMINAL_ATTRIBUTE_TYPES
*copyc IIK$KEYPOINTS
*copyc IIP$ADD_SENDER
*copyc IIP$BUILD_SUPER_MSG_SKELETON
*copyc IIP$CHANGE_TERMINAL_CLASS
*copyc IIP$CLEAR_LOCK
*copyc IIP$CONVERT_DOWNLINE_TERM_CHAR
*copyc IIP$FLUSH
*copyc IIP$REPORT_STATUS_ERROR
*copyc IIP$REQUEST_DEFAULT_ATTRIBUTES
*copyc IIP$SEND_TO_PASS_ON
*copyc IIP$SET_LOCK
*copyc IIP$SIGN_ON
*copyc IIP$SIGN_OFF
*copyc IIP$TERMINAL_TO_VT_ATTRIBUTES
*copyc IIT$VT_CONNECTIONS
*copyc IIP$VT_CREATE_ATTRIBUTE_OCTETS
*copyc IIV$CONNECTION_DESC_PTR
*copyc IIV$INTERACTIVE_TERMINATED
*copyc IIV$INT_TASK_OPEN_FILE_COUNT
*copyc JMP$SYSTEM_JOB
*copyc MLD$MEMORY_LINK_DECLARATIONS
*copyc OST$STATUS
*copyc OSP$APPEND_STATUS_INTEGER
*copyc OSP$APPEND_STATUS_PARAMETER
*copyc OSP$SET_STATUS_ABNORMAL
*copyc OSS$JOB_PAGED_LITERAL
?? POP ??

{ Static variables.

  VAR
    fake_file_id: [READ,OSS$JOB_PAGED_LITERAL] amt$file_identifier := [0, 1];

?? NEWTITLE := 'PROCEDURE iip$change_terminal_attributes', EJECT ??

  PROCEDURE [XDCL, #GATE] iip$change_terminal_attributes (terminal_attributes:
    ift$terminal_attributes;
    VAR status: ost$status);

    VAR
      array_of_octets: ^array [1 .. *] of iit$term_char_pair,
      buffer: ^SEQ (*),
      cdp: ^iit$connection_description,
      char_value: char,
      conflicting_attribute: string (osc$max_name_size),
      current_control_char_values: array [1 .. iic$number_of_control_chars] of char,
      define_term_char_message: iit$output_data_message,
      delay: 0 .. 250,
      field_value_pointer: ^iit$field_value,
      i: integer,
      index: integer,
      iiv$chata_application_name: mlt$application_name,
      j: integer,
      k: integer,
      length_of_octets: nat$data_length,
      local_status: ost$status,
      new_control_char_values: array [1 .. iic$number_of_control_chars] of char,
      osm: iit$output_supervisory_message,
      page_length: integer,
      page_width: integer,
      set_of_end_line_positions: iit$set_of_end_line_positions,
      set_of_end_part_positions: iit$set_of_end_part_positions,
      set_of_parity_modes: iit$set_of_parity_modes,
      set_of_status_actions: iit$set_of_status_actions,
      set_of_terminal_attribute_keys: iit$terminal_attribute_keys_set,
      set_of_terminal_classes: iit$set_of_terminal_classes,
      terminal_class: boolean,
      term_class: iit$terminal_class,
      term_char_message_length: mlt$message_length,
      vt_attributes: ^iit$vt_attributes;

    status.normal := TRUE;

    #KEYPOINT (osk$entry, 0 , iik$change_terminal_attributes);

  { Get the pointer to the connection description.

    iip$set_lock (iiv$connection_desc_lock, osc$wait, local_status);
    cdp := iiv$connection_desc_ptr;
    iip$clear_lock (iiv$connection_desc_lock, local_status);

  { Build a define terminal characteristics message to change terminal
  { attributes.

    IF iiv$cdcnet_connection THEN
      iip$build_super_msg_skeleton (^osm, iic$sm_cdcnet_define_term_char, 0);
    ELSE
      iip$build_super_msg_skeleton (^osm, iic$sm_define_term_char, 0);
    IFEND;
    osm.header.address := cdp^.connection_number;
    osm.header.character_type := iic$8_bit_characters;
    index := 1;
    length_of_octets := 0;
    terminal_class := FALSE;

  { Validate the terminal attribute keys.

    set_of_terminal_attribute_keys := - $iit$terminal_attribute_keys_set [];
    FOR i := LOWERBOUND (terminal_attributes) TO UPPERBOUND
          (terminal_attributes) DO
      IF NOT (terminal_attributes [i].key IN set_of_terminal_attribute_keys)
            THEN
        osp$set_status_abnormal (ifc$interactive_facility_id,
              ife$unknown_attribute_key, '', status);
        k := ORD (terminal_attributes [i].key);
        osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
              FALSE, status);
        osp$append_status_parameter (osc$status_parameter_delimiter,
          'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
        RETURN;
      IFEND;
    FOREND;

    IF iiv$cdcnet_connection THEN

{ Validate character attribute values and page length and width.

      page_length := 0;           { Initialize these variables to legal values. }
      page_width := 0;

   /validate_character_attributes/
      FOR i := 1 TO UPPERBOUND (terminal_attributes) DO
        CASE terminal_attributes [i].key OF
        = ifc$attention_character =
          char_value := terminal_attributes [i].attention_character;
        = ifc$begin_line_character =
          char_value := terminal_attributes [i].begin_line_character;
        = ifc$backspace_character =
          char_value := terminal_attributes [i].backspace_character;
        = ifc$cancel_line_character =
          char_value := terminal_attributes [i].cancel_line_character;
        = ifc$network_command_character =
          char_value := terminal_attributes [i].network_command_character;
        = ifc$end_partial_character =
          char_value := terminal_attributes [i].end_partial_character;
        = ifc$terminal_class =
          terminal_class := TRUE;
          term_class := iiv$downline_term_class_conv [terminal_attributes [i] .terminal_class];
          CYCLE /validate_character_attributes/;
        = ifc$page_length =
          page_length := terminal_attributes [i].page_length;
          CYCLE /validate_character_attributes/;
        = ifc$page_width =
          page_width := terminal_attributes [i].page_width;
          CYCLE /validate_character_attributes/;
        ELSE
          CYCLE /validate_character_attributes/;
        CASEND;

        k := ORD (char_value);
        IF (k > 7f(16)) { the character is non-ascii } OR
           ((k >= 30(16)) AND (k <= 39(16))) { number } OR
           ((k >= 41(16)) AND (k <= 5a(16))) { uppercase letter } OR
           ((k >= 61(16)) AND (k <= 7a(16))) { lowercase letter } THEN
          osp$set_status_abnormal (ifc$interactive_facility_id,
                ife$attr_val_disallowed_by_nam, 'this Character attribute', status);
          osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                TRUE, status);
          osp$append_status_parameter (osc$status_parameter_delimiter,
            'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
          RETURN;
        IFEND;
      FOREND /validate_character_attributes/;

      IF (page_length < LOWERVALUE (ift$page_length)) OR
            (page_length > UPPERVALUE (ift$page_length)) OR (page_length = 1) THEN
        osp$set_status_abnormal (ifc$interactive_facility_id,
              ife$page_length, '', status);
        osp$append_status_integer (osc$status_parameter_delimiter, page_length, 10,
              FALSE, status);
        page_length := LOWERVALUE (ift$page_length);
        osp$append_status_integer (osc$status_parameter_delimiter, page_length, 10,
              FALSE, status);
        page_length := UPPERVALUE (ift$page_length);
        osp$append_status_integer (osc$status_parameter_delimiter, page_length, 10,
              FALSE, status);
        osp$append_status_parameter (osc$status_parameter_delimiter,
          'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
        RETURN;
      IFEND;

      IF (page_width < LOWERVALUE (ift$page_width)) OR
            (page_width > UPPERVALUE (ift$page_width)) OR
            ((page_width > 0) AND (page_width < 10)) THEN
        osp$set_status_abnormal (ifc$interactive_facility_id,
              ife$page_width, '', status);
        osp$append_status_integer (osc$status_parameter_delimiter, page_width, 10,
              FALSE, status);
        page_width := LOWERVALUE (ift$page_width);
        osp$append_status_integer (osc$status_parameter_delimiter, page_width, 10,
              FALSE, status);
        page_width := UPPERVALUE (ift$page_width);
        osp$append_status_integer (osc$status_parameter_delimiter, page_width, 10,
              FALSE, status);
        osp$append_status_parameter (osc$status_parameter_delimiter,
          'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
        RETURN;
      IFEND;

      PUSH vt_attributes: [1 .. UPPERBOUND (terminal_attributes)];
      iip$terminal_to_vt_attributes (terminal_attributes, vt_attributes^);
      PUSH buffer: [[REP iic$vt_max_output_mess_length OF cell]];
      iip$vt_create_attribute_octets (vt_attributes^, buffer, length_of_octets);
      RESET buffer;
      IF length_of_octets > 0 THEN
        NEXT array_of_octets: [1 .. (length_of_octets MOD 2) + (length_of_octets DIV 2) ] IN buffer;
        osm.cdcnet_define_term_char.array_of_octets := array_of_octets^;
      IFEND;
    ELSE
    { Get the current control character values.

      j := 1;
      current_control_char_values [j] := cdp^.terminal_attributes.backspace_character;
      j := j + 1;
      current_control_char_values [j] := cdp^.terminal_attributes.cancel_line_character;
      j := j + 1;
      current_control_char_values [j] := cdp^.terminal_attributes.end_line_character;
      j := j + 1;
      current_control_char_values [j] := cdp^.terminal_attributes.network_command_character;
      j := j + 1;
      current_control_char_values [j] := cdp^.terminal_attributes.pause_break_character;
      j := j + 1;
      current_control_char_values [j] := cdp^.terminal_attributes.terminate_break_character;

    { Initialize the new control character values.

      FOR j := 1 TO iic$number_of_control_chars DO
        new_control_char_values [j] := '=';
      FOREND;

    { Validate the attribute values.

      iip$set_lock (cdp^.lock, osc$wait, status);
      IF status.normal THEN

      /validate_attributes/
        FOR i := LOWERBOUND (terminal_attributes) TO UPPERBOUND
              (terminal_attributes) DO

          CASE terminal_attributes [i].key OF

          = ifc$backspace_character =

            k := ORD (terminal_attributes [i].backspace_character);
            IF ((terminal_attributes [i].backspace_character = '=') OR
                  (k > 7f(16)) { the character is non-ascii } OR
                  ((k >= 30(16)) AND (k <= 39(16))) { number } OR
                  ((k >= 41(16)) AND (k <= 5a(16))) { uppercase letter } OR
                  ((k >= 61(16)) AND (k <= 7a(16)))) { lowercase letter } THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$attr_val_disallowed_by_nam, 'BACKSPACE_CHARACTER', status);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                    TRUE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            conflicting_attribute := '  ';

          /check_backspace_conflict/
            FOR j := 1 TO iic$number_of_control_chars DO
              IF iiv$control_char_descriptions [j].key = ifc$backspace_character
                    THEN
                new_control_char_values [j] := terminal_attributes[i].backspace_character;
                CYCLE /check_backspace_conflict/;
              ELSEIF terminal_attributes [i].backspace_character =
                    current_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              ELSEIF terminal_attributes [i].backspace_character =
                    new_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              IFEND;

              IF conflicting_attribute <> '  ' THEN
                osp$set_status_abnormal (ifc$interactive_facility_id,
                      ife$control_char_conflict, 'BACKSPACE_CHARACTER', status);
                osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                      TRUE, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                      conflicting_attribute, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                  'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
                EXIT /validate_attributes/;
              IFEND;

            FOREND /check_backspace_conflict/;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_backspace_character;
            field_value_pointer := #LOC (terminal_attributes [i].backspace_character);
            osm.define_term_char.term_char_string [index].field_value :=
                  field_value_pointer^;
            index := index + 1;

          = ifc$cancel_line_character =

            k := ORD (terminal_attributes [i].cancel_line_character);
            IF ((terminal_attributes [i].cancel_line_character = '=') OR
                  (k > 7f(16)) { the character is non-ascii } OR
                  ((k >= 30(16)) AND (k <= 39(16))) { number } OR
                  ((k >= 41(16)) AND (k <= 5a(16))) { uppercase letter } OR
                  ((k >= 61(16)) AND (k <= 7a(16)))) { lowercase letter } THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$attr_val_disallowed_by_nam, 'CANCEL_LINE_CHARACTER',
                    status);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                    TRUE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            conflicting_attribute := '  ';

          /check_cancel_line_conflict/
            FOR j := 1 TO iic$number_of_control_chars DO
              IF iiv$control_char_descriptions [j].key = ifc$cancel_line_character
                    THEN
                new_control_char_values [j] := terminal_attributes[i].cancel_line_character;
                CYCLE /check_cancel_line_conflict/;
              ELSEIF terminal_attributes [i].cancel_line_character =
                    current_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              ELSEIF terminal_attributes [i].cancel_line_character =
                    new_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              IFEND;

              IF conflicting_attribute <> '  ' THEN
                osp$set_status_abnormal (ifc$interactive_facility_id,
                      ife$control_char_conflict, 'CANCEL_LINE_CHARACTER', status);
                osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                      TRUE, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                      conflicting_attribute, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                  'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
                EXIT /validate_attributes/;
              IFEND;
            FOREND /check_cancel_line_conflict/;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_cancel_line_character;
            field_value_pointer := #LOC (terminal_attributes [i].cancel_line_character);
            osm.define_term_char.term_char_string [index].field_value :=
                  field_value_pointer^;
            index := index + 1;

          = ifc$carriage_return_delay =

            k := terminal_attributes [i].carriage_return_delay;
            IF ((k < LOWERVALUE (ift$carriage_return_delay)) OR (k >
                  UPPERVALUE (ift$carriage_return_delay))) THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$cr_delay, '', status);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              k := LOWERVALUE (ift$carriage_return_delay);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              k := UPPERVALUE (ift$carriage_return_delay);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_cr_delay_count;
            delay := terminal_attributes [i].carriage_return_delay DIV 4;
            field_value_pointer := #LOC (delay);
            osm.define_term_char.term_char_string [index].field_value :=
                  field_value_pointer^;
            index := index + 1;

          = ifc$echoplex =

            IF ((terminal_attributes [i].echoplex < LOWERVALUE (boolean)) OR
                  (terminal_attributes [i].echoplex > UPPERVALUE (boolean))) THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$echoplex, 'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_echoplex;
            IF terminal_attributes [i].echoplex THEN
              osm.define_term_char.term_char_string [index].field_value := 1;
            ELSE
              osm.define_term_char.term_char_string [index].field_value := 0;
            IFEND;
            index := index + 1;

          = ifc$status_action =

            set_of_status_actions := - $iit$set_of_status_actions [];
            IF NOT (terminal_attributes [i].status_action IN set_of_status_actions)
                  THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$unknown_status_action, '', status);
              k := ORD (terminal_attributes [i].status_action);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_lockout_unsolicited_msgs;  { LK = 32(10) }
            CASE terminal_attributes [i].status_action OF
            = ifc$send_status =
              osm.define_term_char.term_char_string [index].field_value := 0;
            = ifc$hold_status, ifc$discard_status =
              osm.define_term_char.term_char_string [index].field_value := 1;
            CASEND;

            index := index + 1;

          = ifc$fold_line =

            IF ((terminal_attributes [i].fold_line < LOWERVALUE (boolean)) OR
                  (terminal_attributes [i].fold_line > UPPERVALUE (boolean))) THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$fold_line, 'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_output_device;
            IF terminal_attributes [i].fold_line THEN
              osm.define_term_char.term_char_string [index].field_value := 0;
            ELSE
              osm.define_term_char.term_char_string [index].field_value := 1;
            IFEND;
            index := index + 1;

          = ifc$end_partial_character =

            k := ORD (terminal_attributes [i].end_partial_character);
            IF ((terminal_attributes [i].end_partial_character = '=') OR
                  (k > 7f(16)) { the character is non-ascii } OR
                  ((k >= 30(16)) AND (k <= 39(16))) { number } OR
                  ((k >= 41(16)) AND (k <= 5a(16))) { uppercase letter } OR
                  ((k >= 61(16)) AND (k <= 7a(16)))) { lowercase letter } THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$attr_val_disallowed_by_nam, 'END_PARTIAL_CHARACTER',
                    status);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                    TRUE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            conflicting_attribute := '  ';

          /check_end_part_conflict/
            FOR j := 1 TO iic$number_of_control_chars DO
              IF iiv$control_char_descriptions [j].key = ifc$end_partial_character
                    THEN
                new_control_char_values [j] := terminal_attributes[i].end_partial_character;
                CYCLE /check_end_part_conflict/;
              ELSEIF terminal_attributes [i].end_partial_character =
                    current_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              ELSEIF terminal_attributes [i].end_partial_character =
                    new_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              IFEND;

              IF conflicting_attribute <> '  ' THEN
                osp$set_status_abnormal (ifc$interactive_facility_id,
                      ife$control_char_conflict, 'END_PARTIAL_CHARACTER', status);
                osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                      TRUE, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                      conflicting_attribute, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                  'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
                EXIT /validate_attributes/;
              IFEND;
            FOREND /check_end_part_conflict/;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_end_block_character;
            field_value_pointer := #LOC (terminal_attributes [i].end_partial_character);
            osm.define_term_char.term_char_string [index].field_value :=
                  field_value_pointer^;
            index := index + 1;

          = ifc$end_partial_positioning =

            set_of_end_part_positions := - $iit$set_of_end_part_positions [];
            IF NOT (terminal_attributes [i].end_partial_positioning IN set_of_end_part_positions)
                  THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$unknown_end_part_position, '', status);
              k := ORD (terminal_attributes [i].end_partial_positioning);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

          { Turn the cursor_positioning characteristic ON for all EPP settings

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_cursor_positioning;
            osm.define_term_char.term_char_string [index].field_value := 1;
            index := index + 1;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_eob_cursor_positioning;
            CASE terminal_attributes [i].end_partial_positioning OF
            = ifc$no_epp =
              osm.define_term_char.term_char_string [index].field_value := 0;
            = ifc$epp_crs =
              osm.define_term_char.term_char_string [index].field_value := 1;
            = ifc$epp_lfs =
              osm.define_term_char.term_char_string [index].field_value := 2;
            = ifc$epp_crslfs =
              osm.define_term_char.term_char_string [index].field_value := 3;
            ELSE
            CASEND;

            index := index + 1;

          = ifc$end_line_character =

            k := ORD (terminal_attributes [i].end_line_character);
            IF ((terminal_attributes [i].end_line_character = '=') OR
                  (k > 7f(16)) { the character is non-ascii } OR
                  ((k >= 30(16)) AND (k <= 39(16))) { number } OR
                  ((k >= 41(16)) AND (k <= 5a(16))) { uppercase letter } OR
                  ((k >= 61(16)) AND (k <= 7a(16)))) { lowercase letter } THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$attr_val_disallowed_by_nam, 'END_LINE_CHARACTER',
                    status);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                    TRUE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            conflicting_attribute := '  ';

          /check_end_line_conflict/
            FOR j := 1 TO iic$number_of_control_chars DO
              IF iiv$control_char_descriptions [j].key = ifc$end_line_character
                    THEN
                new_control_char_values [j] := terminal_attributes[i].end_line_character;
                CYCLE /check_end_line_conflict/;
              ELSEIF terminal_attributes [i].end_line_character =
                    current_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              ELSEIF terminal_attributes [i].end_line_character =
                    new_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              IFEND;

              IF conflicting_attribute <> '  ' THEN
                osp$set_status_abnormal (ifc$interactive_facility_id,
                      ife$control_char_conflict, 'END_LINE_CHARACTER', status);
                osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                      TRUE, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                      conflicting_attribute, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                  'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
                EXIT /validate_attributes/;
              IFEND;
            FOREND /check_end_part_conflict/;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_end_line_character;
            field_value_pointer := #LOC (terminal_attributes [i].end_line_character);
            osm.define_term_char.term_char_string [index].field_value :=
                  field_value_pointer^;
            index := index + 1;

          = ifc$end_line_positioning =

            set_of_end_line_positions := - $iit$set_of_end_line_positions [];
            IF NOT (terminal_attributes [i].end_line_positioning IN set_of_end_line_positions)
                  THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$unknown_end_line_position, '', status);
              k := ORD (terminal_attributes [i].end_line_positioning);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

          { Turn the cursor_positioning characteristic ON for all ELP settings

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_cursor_positioning;
            osm.define_term_char.term_char_string [index].field_value := 1;
            index := index + 1;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_eol_cursor_positioning;
            CASE terminal_attributes [i].end_line_positioning OF
            = ifc$elp_none =
              osm.define_term_char.term_char_string [index].field_value := 0;
            = ifc$elp_crs =
              osm.define_term_char.term_char_string [index].field_value := 1;
            = ifc$elp_lfs =
              osm.define_term_char.term_char_string [index].field_value := 2;
            = ifc$elp_crslfs =
              osm.define_term_char.term_char_string [index].field_value := 3;
            ELSE
            CASEND;

            index := index + 1;

          = ifc$character_flow_control =

            IF ((terminal_attributes [i].character_flow_control < LOWERVALUE (boolean)) OR
                  (terminal_attributes [i].character_flow_control > UPPERVALUE (boolean))) THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$character_flow_control, 'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;
            IF terminal_attributes [i].character_flow_control THEN
              osm.define_term_char.term_char_string [index].field_number :=
                    iic$fn_output_flow_control;
              osm.define_term_char.term_char_string [index].field_value := 1;
              index := index + 1;
              osm.define_term_char.term_char_string [index].field_number :=
                    iic$fn_input_flow_control;
              osm.define_term_char.term_char_string [index].field_value := 1;
            ELSE
              osm.define_term_char.term_char_string [index].field_number :=
                    iic$fn_output_flow_control;
              osm.define_term_char.term_char_string [index].field_value := 0;
              index := index + 1;
              osm.define_term_char.term_char_string [index].field_number :=
                    iic$fn_input_flow_control;
              osm.define_term_char.term_char_string [index].field_value := 0;
            IFEND;

            index := index + 1;

          = ifc$line_feed_delay =

            k := terminal_attributes [i].line_feed_delay;
            IF ((k < LOWERVALUE (ift$line_feed_delay)) OR (k > UPPERVALUE
                  (ift$line_feed_delay))) THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$lf_delay, '', status);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              k := LOWERVALUE (ift$line_feed_delay);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              k := UPPERVALUE (ift$line_feed_delay);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_lf_delay_count;
            delay := terminal_attributes [i].line_feed_delay DIV 4;
            field_value_pointer := #LOC (delay);
            osm.define_term_char.term_char_string [index].field_value :=
                  field_value_pointer^;
            index := index + 1;

          = ifc$network_command_character =

            k := ORD (terminal_attributes [i].network_command_character);
            IF ((terminal_attributes [i].network_command_character = '=') OR
                  (k > 7f(16)) { the character is non-ascii } OR
                  ((k >= 30(16)) AND (k <= 39(16))) { number } OR
                  ((k >= 41(16)) AND (k <= 5a(16))) { uppercase letter } OR
                  ((k >= 61(16)) AND (k <= 7a(16)))) { lowercase letter } THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$attr_val_disallowed_by_nam, 'NETWORK_CONTROL_CHARACTER', status);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                    TRUE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            conflicting_attribute := '  ';

          /check_network_command_conflict/
            FOR j := 1 TO iic$number_of_control_chars DO
              IF iiv$control_char_descriptions [j].key = ifc$network_command_character
                    THEN
                new_control_char_values [j] := terminal_attributes[i].network_command_character;
                CYCLE /check_network_command_conflict/;
              ELSEIF terminal_attributes [i].network_command_character =
                    current_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              ELSEIF terminal_attributes [i].network_command_character =
                    new_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              IFEND;

              IF conflicting_attribute <> '  ' THEN
                osp$set_status_abnormal (ifc$interactive_facility_id,
                      ife$control_char_conflict, 'NETWORK_COMMAND_CHARACTER', status);
                osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                      TRUE, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                      conflicting_attribute, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                  'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
                EXIT /validate_attributes/;
              IFEND;

            FOREND /check_network_command_conflict/;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_network_cmd_character;
            field_value_pointer := #LOC (terminal_attributes [i].network_command_character);
            osm.define_term_char.term_char_string [index].field_value :=
                  field_value_pointer^;
            index := index + 1;

          = ifc$null_terminal_attribute =

          = ifc$page_length =

            k := terminal_attributes [i].page_length;
            IF ((k < LOWERVALUE (ift$page_length)) OR (k > UPPERVALUE
                  (ift$page_length))) THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$page_length, '', status);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              k := LOWERVALUE (ift$page_length);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              k := UPPERVALUE (ift$page_length);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_page_length;
            field_value_pointer := #LOC (terminal_attributes [i].page_length);
            osm.define_term_char.term_char_string [index].field_value :=
                  field_value_pointer^;
            index := index + 1;

          = ifc$hold_page =

            IF ((terminal_attributes [i].hold_page < LOWERVALUE (boolean)) OR
                  (terminal_attributes [i].hold_page > UPPERVALUE (boolean))) THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$hold_page, 'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_hold_page;
            IF terminal_attributes [i].hold_page THEN
              osm.define_term_char.term_char_string [index].field_value := 1;
            ELSE
              osm.define_term_char.term_char_string [index].field_value := 0;
            IFEND;
            index := index + 1;

          = ifc$page_width =

            k := terminal_attributes [i].page_width;
            IF ((k < LOWERVALUE (ift$page_width)) OR (k > UPPERVALUE
                  (ift$page_width))) THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$page_width, '', status);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              k := LOWERVALUE (ift$page_width);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              k := UPPERVALUE (ift$page_width);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_page_width;
            field_value_pointer := #LOC (terminal_attributes [i].page_width);
            osm.define_term_char.term_char_string [index].field_value :=
                  field_value_pointer^;
            index := index + 1;

          = ifc$parity =

            set_of_parity_modes := - $iit$set_of_parity_modes [];
            IF NOT (terminal_attributes [i].parity IN set_of_parity_modes) THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$unknown_parity_mode, '', status);
              k := ORD (terminal_attributes [i].parity);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_parity;
            CASE terminal_attributes [i].parity OF
            = ifc$zero_parity, ifc$mark_parity =
              osm.define_term_char.term_char_string [index].field_value :=
                    iic$zero_parity;
            = ifc$even_parity =
              osm.define_term_char.term_char_string [index].field_value :=
                    iic$even_parity;
            = ifc$odd_parity =
              osm.define_term_char.term_char_string [index].field_value :=
                  iic$odd_parity;
            = ifc$no_parity =

              osm.define_term_char.term_char_string [index].field_value :=
                    iic$no_parity;

            { Turn on IGNORE PARITY if XPT mode is on and the 2**7 bit of either the TFC or TTC
            { is zero.  This tells the 2550 to ignore the parity bit when it is checking for the
            { TFC or TTC, which, in effect, allows, for example, a TFC of 0D(16) to successfully
            { compare with 8D(16).

              IF (cdp^.nam_os_default_attributes.input_editing_mode.value =
                    ifc$trans_edit) THEN
                IF (ORD (cdp^.nam_os_default_attributes.trans_forward_character.value.
                      value (1)) < 7F(16)) OR
                      (ORD (cdp^.nam_os_default_attributes.trans_terminate_character.value.
                      value (1)) < 7F(16)) THEN
                  osm.define_term_char.term_char_string [index].field_value :=
                        iic$ignore_parity;
                IFEND;
              IFEND;

            ELSE
            CASEND;

            index := index + 1;

          = ifc$pause_break_character =

            k := ORD (terminal_attributes [i].pause_break_character);
            IF ((terminal_attributes [i].pause_break_character = '=') OR
                 (k > 7f(16)) { the character is non-ascii } OR
                 ((k >= 30(16)) AND (k <= 39(16))) { number } OR
                 ((k >= 41(16)) AND (k <= 5a(16))) { uppercase letter } OR
                 ((k >= 61(16)) AND (k <= 7a(16)))) { lowercase letter } THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$attr_val_disallowed_by_nam, 'PAUSE_BREAK_CHARACTER',
                    status);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                    TRUE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            conflicting_attribute := '  ';

          /check_pause_break_conflict/
            FOR j := 1 TO iic$number_of_control_chars DO
              IF iiv$control_char_descriptions [j].key = ifc$pause_break_character
                    THEN
                new_control_char_values [j] := terminal_attributes[i].pause_break_character;
                CYCLE /check_pause_break_conflict/;
              ELSEIF terminal_attributes [i].pause_break_character =
                    current_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              ELSEIF terminal_attributes [i].pause_break_character =
                    new_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              IFEND;

              IF conflicting_attribute <> '  ' THEN
                osp$set_status_abnormal (ifc$interactive_facility_id,
                      ife$control_char_conflict, 'PAUSE_BREAK_CHARACTER', status);
                osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                      TRUE, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                      conflicting_attribute, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                  'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
                EXIT /validate_attributes/;
              IFEND;

            FOREND /check_pause_break_conflict/;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_pause_break_character;
            field_value_pointer := #LOC (terminal_attributes [i].pause_break_character);
            osm.define_term_char.term_char_string [index].field_value :=
                  field_value_pointer^;
            index := index + 1;

          = ifc$terminal_class =

            set_of_terminal_classes := - $iit$set_of_terminal_classes [];
            IF NOT (terminal_attributes [i].terminal_class IN
                  set_of_terminal_classes) THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$unknown_terminal_class, '', status);
              k := ORD (terminal_attributes [i].terminal_class);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                    FALSE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            ELSE
              terminal_class := TRUE;
              term_class := iiv$downline_term_class_conv [terminal_attributes [i] .terminal_class];
            IFEND;

          = ifc$terminal_model =

            cdp^.terminal_attributes.terminal_model.size := terminal_attributes [i].
                  terminal_model.size;
            cdp^.terminal_attributes.terminal_model.value := terminal_attributes [i].
                  terminal_model.value;

          = ifc$terminate_break_character =

            k := ORD (terminal_attributes [i].terminate_break_character);
            IF ((terminal_attributes [i].terminate_break_character = '=') OR
                  (k > 7f(16)) { the character is non-ascii } OR
                  ((k >= 30(16)) AND (k <= 39(16))) { number } OR
                  ((k >= 41(16)) AND (k <= 5a(16))) { uppercase letter } OR
                  ((k >= 61(16)) AND (k <= 7a(16)))) { lowercase letter } THEN
              osp$set_status_abnormal (ifc$interactive_facility_id,
                    ife$attr_val_disallowed_by_nam, 'TERMINATE_BREAK_CHARACTER',
                    status);
              osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                    TRUE, status);
              osp$append_status_parameter (osc$status_parameter_delimiter,
                'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
              EXIT /validate_attributes/;
            IFEND;

            conflicting_attribute := '  ';

          /check_terminate_break_conflict/
            FOR j := 1 TO iic$number_of_control_chars DO
              IF iiv$control_char_descriptions [j].key =
                    ifc$terminate_break_character THEN
                new_control_char_values [j] := terminal_attributes[i].terminate_break_character;
                CYCLE /check_terminate_break_conflict/;
              ELSEIF terminal_attributes [i].terminate_break_character =
                    current_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              ELSEIF terminal_attributes [i].terminate_break_character =
                    new_control_char_values [j] THEN
                conflicting_attribute := iiv$control_char_descriptions [j].text;
              IFEND;

              IF conflicting_attribute <> '  ' THEN
                osp$set_status_abnormal (ifc$interactive_facility_id,
                      ife$control_char_conflict, 'TERMINATE_BREAK_CHARACTER',
                      status);
                osp$append_status_integer (osc$status_parameter_delimiter, k, 16,
                      TRUE, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                      conflicting_attribute, status);
                osp$append_status_parameter (osc$status_parameter_delimiter,
                  'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
                EXIT /validate_attributes/;
              IFEND;

            FOREND /check_terminate_break_conflict/;

            osm.define_term_char.term_char_string [index].field_number :=
                  iic$fn_term_break_character;
            field_value_pointer := #LOC (terminal_attributes [i].terminate_break_character);
            osm.define_term_char.term_char_string [index].field_value :=
                  field_value_pointer^;
            index := index + 1;

          = ifc$attention_character =
            { note - this attribute is accepted only to the extent that storing a non-null }
            { character will indicate to iim$build_term_char_values that it should use }
            { transparency type 2 (interruptible) instead of the default type 1 (no interrupts). }

          = ifc$begin_line_character, ifc$carriage_return_sequence,
            ifc$control_code_replacement, ifc$code_set, ifc$code_set_name,
            ifc$end_page_action, ifc$form_feed_delay,ifc$form_feed_sequence,
            ifc$function_key_class, ifc$hold_page_over, ifc$line_feed_sequence =

          { *** THESE ATTRIBUTES ARE IGNORED FOR DUAL STATE CONNECTIONS *** }

          = ifc$end_output_sequence =

          { The NAM mapping for EOS is to PP (FN=66(16):  pacer prompting) which cannot be reset. }

          ELSE

        { The attribute key is not valid for this request.

            osp$set_status_abnormal (ifc$interactive_facility_id,
                  ife$invalid_key_for_request, '', status);
            k := ORD (terminal_attributes [i].key);
            osp$append_status_integer (osc$status_parameter_delimiter, k, 10,
                  FALSE, status);
            osp$append_status_parameter (osc$status_parameter_delimiter,
              'IFP$CHANGE_TERMINAL_ATTRIBUTES', status);
            EXIT /validate_attributes/;

          CASEND;

        FOREND /validate_attributes/;
        iip$clear_lock (cdp^.lock, local_status);
        IF NOT status.normal THEN
          RETURN;
        IFEND;
      IFEND; { status.normal from iip$set_lock }
    IFEND; { iiv$cdcnet_connection }

  { Change the terminal class if specified.

    IF terminal_class THEN
      iip$flush (fake_file_id, NIL, local_status);
      iip$change_terminal_class (cdp, term_class, local_status);
    IFEND;

    IF (length_of_octets > 0) OR (index > 1) THEN
      IF iiv$cdcnet_connection THEN
        osm.header.text_length := length_of_octets + 2;
      ELSE
        osm.header.text_length := (index - 1) * 2 + 2;
      IFEND;

    { Convert the define terminal characteristics message to C170 NAM format.

      iip$convert_downline_term_char (#LOC (osm), #LOC (define_term_char_message),
            iic$l_define_term_char * 8, term_char_message_length);

    { Send the define terminal characteristics message to Pass-On.

      IF iiv$int_task_open_file_count = 0 THEN

      { No files are open in this task, which infers that
      { this task is not signed on to the Memory Link and,
      { hence, cannot 'talk to' PASSON.  NV0I012 fix--5/8/86.

        iip$sign_on (iiv$chata_application_name, status);
        IF NOT status.normal THEN
          #KEYPOINT (osk$exit, 0 , iik$change_terminal_attributes);
          RETURN;
        IFEND;

        iip$add_sender (iiv$chata_application_name, status);
        IF NOT status.normal THEN
          iip$sign_off (iiv$chata_application_name, local_status);
          #KEYPOINT (osk$exit, 0 , iik$change_terminal_attributes);
          RETURN;
        IFEND;

        iip$send_to_pass_on (iiv$chata_application_name, #LOC
              (define_term_char_message), term_char_message_length,
              iic$output_data_message + iiv$job_connection, status);
        IF NOT status.normal THEN
          iip$report_status_error (status, 'send to passon');
        IFEND;

        iip$sign_off (iiv$chata_application_name, status);

      ELSE
        iip$send_to_pass_on (iiv$int_application_name, #LOC
              (define_term_char_message), term_char_message_length,
              iic$output_data_message + iiv$job_connection, status);
      IFEND;
    IFEND; { index > 1 }

    { Update the NAM default attributes if the terminal class was specified.

    IF terminal_class THEN
      iip$request_default_attributes (cdp, status);
    IFEND;

  { Update the terminal_attributes record in the connection description.

    FOR i := 1 TO UPPERBOUND (terminal_attributes) DO
      CASE terminal_attributes [i].key OF
      = ifc$backspace_character =
          cdp^.terminal_attributes.backspace_character :=
                terminal_attributes [i].backspace_character;
      = ifc$cancel_line_character =
        cdp^.terminal_attributes.cancel_line_character :=
              terminal_attributes [i].cancel_line_character;
      = ifc$carriage_return_delay =
        cdp^.terminal_attributes.carriage_return_delay :=
              terminal_attributes [i].carriage_return_delay;
      = ifc$echoplex =
        cdp^.terminal_attributes.echoplex :=
              terminal_attributes [i].echoplex;
      = ifc$status_action =
        cdp^.terminal_attributes.status_action := terminal_attributes [i].status_action;
      = ifc$fold_line =
        cdp^.terminal_attributes.fold_line := terminal_attributes [i].fold_line;
      = ifc$end_partial_character =
        cdp^.terminal_attributes.end_partial_character :=
              terminal_attributes [i].end_partial_character;
      = ifc$end_partial_positioning =
        cdp^.terminal_attributes.end_partial_positioning :=
              terminal_attributes [i].end_partial_positioning;
      = ifc$end_line_character =
        cdp^.terminal_attributes.end_line_character :=
              terminal_attributes [i].end_line_character;
      = ifc$end_line_positioning =
        cdp^.terminal_attributes.end_line_positioning :=
              terminal_attributes [i].end_line_positioning;
      = ifc$character_flow_control =
        cdp^.terminal_attributes.character_flow_control :=
              terminal_attributes [i].character_flow_control;
      = ifc$line_feed_delay =
        cdp^.terminal_attributes.line_feed_delay :=
              terminal_attributes [i].line_feed_delay;
      = ifc$network_command_character =
        cdp^.terminal_attributes.network_command_character :=
              terminal_attributes [i].network_command_character;
      = ifc$null_terminal_attribute =
      = ifc$page_length =
        cdp^.terminal_attributes.page_length :=
              terminal_attributes [i].page_length;
      = ifc$hold_page =
        cdp^.terminal_attributes.hold_page :=
              terminal_attributes [i].hold_page;
      = ifc$page_width =
        cdp^.terminal_attributes.page_width :=
              terminal_attributes [i].page_width;
      = ifc$parity =
        cdp^.terminal_attributes.parity := terminal_attributes [i].parity;
      = ifc$pause_break_character =
        IF NOT iiv$cdcnet_connection THEN
          cdp^.terminal_attributes.pause_break_character :=
                terminal_attributes [i].pause_break_character;
        IFEND;
      = ifc$terminal_class =
          cdp^.terminal_attributes.terminal_class :=
                terminal_attributes [i].terminal_class;
      = ifc$terminal_model =
          cdp^.terminal_attributes.terminal_model :=
                terminal_attributes [i].terminal_model;
      = ifc$terminate_break_character =
        IF NOT iiv$cdcnet_connection THEN
          cdp^.terminal_attributes.terminate_break_character :=
                terminal_attributes [i].terminate_break_character;
        IFEND;
      = ifc$attention_character =
        cdp^.terminal_attributes.attention_character :=
              terminal_attributes [i].attention_character;
      = ifc$hold_page_over =
        IF iiv$cdcnet_connection THEN
          cdp^.terminal_attributes.hold_page_over :=
                terminal_attributes [i].hold_page_over;
        IFEND;
      = ifc$begin_line_character =
        IF iiv$cdcnet_connection THEN
          cdp^.terminal_attributes.begin_line_character :=
                terminal_attributes [i].begin_line_character;
        IFEND;
      = ifc$carriage_return_sequence =
        IF iiv$cdcnet_connection THEN
          cdp^.terminal_attributes.carriage_return_sequence :=
                terminal_attributes [i].carriage_return_sequence;
        IFEND;
      = ifc$end_output_sequence =
        IF iiv$cdcnet_connection THEN
          cdp^.terminal_attributes.end_output_sequence :=
                terminal_attributes [i].end_output_sequence;
        IFEND;
      = ifc$line_feed_sequence =
        IF iiv$cdcnet_connection THEN
          cdp^.terminal_attributes.line_feed_sequence :=
                terminal_attributes [i].line_feed_sequence;
        IFEND;
      = ifc$code_set =
        IF iiv$cdcnet_connection THEN
          cdp^.terminal_attributes.code_set := terminal_attributes [i].code_set;
        IFEND;
      = ifc$end_page_action =
        IF iiv$cdcnet_connection THEN
          cdp^.terminal_attributes.end_page_action :=
                terminal_attributes [i].end_page_action;
        IFEND;
      = ifc$form_feed_delay =
        IF iiv$cdcnet_connection THEN
          cdp^.terminal_attributes.form_feed_delay :=
                terminal_attributes [i].form_feed_delay;
        IFEND;
      = ifc$form_feed_sequence =
        IF iiv$cdcnet_connection THEN
          cdp^.terminal_attributes.form_feed_sequence :=
                terminal_attributes [i].form_feed_sequence;
        IFEND;
      = ifc$function_key_class =
        IF iiv$cdcnet_connection THEN
          cdp^.terminal_attributes.function_key_class :=
                terminal_attributes [i].function_key_class^;
        IFEND;
      ELSE
      CASEND;
    FOREND;

    #KEYPOINT (osk$exit, 0 , iik$change_terminal_attributes);

  PROCEND iip$change_terminal_attributes;
MODEND iim$change_terminal_attributes;
