Example #1
0
//****************************************************************************
void CTerminal::get_terminal_entry(LPARAM lParam)
{
   LV_DISPINFO *lpdi = (LV_DISPINFO *) lParam;
   static TCHAR szString[MAX_TERM_CHARS + 1];  //  there's where we're crashing on long strings!!

   //  item number is: lpdi->item.iItem 
   if (lpdi->item.mask & LVIF_TEXT) {
      term_lview_item_p lvptr = find_element(lpdi->item.iItem) ;
      if (lvptr == NULL) {
         wsprintf(szString, _T("listview element %d not found [%u total]"), 
            lpdi->item.iItem, curr_row);
         lpdi->item.pszText = szString ;
         set_term_attr(WIN_BCYAN, WIN_RED) ;
      } else {
#ifdef UNICODE
         str_ascii_to_unicode(lvptr->msg, szString, MAX_TERM_CHARS);
         //  this crashes on input strings > 260 bytes
         //  one can only copy *into* lpdi->item.pszText for strings < 260 chars.
         // int result = str_ascii_to_unicode(lvptr->msg, lpdi->item.pszText, MAX_TERM_CHARS);
         lpdi->item.pszText = szString ;
#else
         lpdi->item.pszText = lvptr->msg ;
#endif            
         set_term_attr(lvptr->fgnd, lvptr->bgnd) ; //  set up for TerminalCustomDraw()
      }
   }
}
Example #2
0
//********************************************************************
//  this *cannot* be called with a color attribute;
//  it must be called with an index into term_atable[] !!
//********************************************************************
int put_color_msg(uint idx, const char *fmt, ...)
{
   char consoleBuffer[MAX_TERM_CHARS + 1];
   va_list al; //lint !e522

   va_start(al, fmt);   //lint !e1055 !e530
   vsprintf(consoleBuffer, fmt, al);   //lint !e64
   set_term_attr(idx) ;
   myTerminal->put(consoleBuffer);
   va_end(al);
   return 1;
}
Example #3
0
//********************************************************************
int infoout(const char *fmt, ...)
{
   char consoleBuffer[MAX_TERM_CHARS + 1];
   va_list al; //lint !e522

   va_start(al, fmt);   //lint !e1055 !e530
   vsprintf(consoleBuffer, fmt, al);   //lint !e64
   // syslog("ecterm attribs: fgnd=%06X, bgnd=%06X\n", 
   //    term->term_fgnd, term->term_bgnd) ;
   set_term_attr(TERM_INFO) ;
   myTerminal->put(consoleBuffer);
   va_end(al);
   return 1;
}