MODULE ifm$send_attribute_kludge;
?? PUSH (LISTEXT := ON) ??
*copyc osd$default_pragmats
*copyc iit$connection_description
*copyc iiv$int_task_open_file_count
*copyc iip$build_super_msg_skeleton
*copyc iip$convert_downline_term_char
*copyc iiv$interactive_terminated
*copyc iip$send_to_pass_on
*copyc iip$sign_on
*copyc iip$sign_off
?? POP ??

  PROCEDURE [XDCL, #GATE] ifp$send_attribute_kludge (attrs: ^array [ * ] OF
    record
          fn,
          fv: 0 .. 0ff(16),
    recend;
    VAR status: ost$status);

    VAR
      ost: ost$status,
      term_char_message_length: mlt$message_length,
      appln: mlt$application_name,
      define_term_char_message: iit$output_data_message,
      osm: iit$output_supervisory_message,
      i,
      j: integer;

    status.normal := TRUE;
    iip$build_super_msg_skeleton (^osm, iic$sm_define_term_char, 0);
    osm.header.address := iiv$job_connection;
    osm.header.character_type := iic$8_bit_characters;
    osm.header.block_number := 1;

    j := 1;
    FOR i := LOWERBOUND (attrs^) TO UPPERBOUND (attrs^) DO
      osm.define_term_char.term_char_string [j].field_number := attrs^ [i].fn;
      osm.define_term_char.term_char_string [j].field_value := attrs^ [i].fv;
      j := j + 1;
    FOREND;
    IF j > 1 THEN
      osm.header.text_length := (j - 1) * 2 + 2;

{ 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.

      iip$sign_on (appln, status);
      IF NOT status.normal THEN
        RETURN;
      IFEND;
      iip$send_to_pass_on (appln, #LOC (define_term_char_message),
            term_char_message_length, iic$output_data_message +
            iiv$job_connection, status);
      iip$sign_off (appln, ost);
    IFEND;
  PROCEND ifp$send_attribute_kludge;
MODEND
