/* This function can be called from a telnet command parser in order to print out a string of text on the connection. The two strings given as arguments to the function will be concatenated, a carrige return and a new line character will be added, and the line is sent. */
void telnetd_output(struct telnetd_state *s, char *str1, char *str2)
/* This function can be called from a telnet command parser in order to print out a string of text on the connection. The two strings given as arguments to the function will be concatenated, a carrige return and a new line character will be added, and the line is sent. */
void telnetd_output(struct telnetd_state *s, char *str1, char *str2)
{
  static unsigned len;
  char *line;
  line = alloc_line();
  if(line != NULL) {
    len = strlen(str1);
    strncpy(line, str1, TELNETD_LINELEN);
    if(len < TELNETD_LINELEN) {
      strncpy(line + len, str2, TELNETD_LINELEN - len);
    }
    len = strlen(line);
    if(len < TELNETD_LINELEN - 2) {
      line[len] = ISO_cr;
      line[len+1] = ISO_nl;
      line[len+2] = 0;
    }
    sendline(s, line);
  }
}