tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject cvs commit: jakarta-tomcat-connectors/procrun tomcat.c
Date Thu, 02 Oct 2003 07:24:25 GMT
mturk       2003/10/02 00:24:25

  Modified:    procrun  tomcat.c
  Log:
  Improve the listview parsing and creation, and make sure that stderr
  messages gets display as error.
  
  Revision  Changes    Path
  1.3       +46 -25    jakarta-tomcat-connectors/procrun/tomcat.c
  
  Index: tomcat.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/procrun/tomcat.c,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- tomcat.c	1 Oct 2003 18:08:58 -0000	1.2
  +++ tomcat.c	2 Oct 2003 07:24:25 -0000	1.3
  @@ -91,23 +91,32 @@
   #include <jni.h>
    
   #include "procrun.h"
  -
  +
   prcrun_lview_t tac_columns[] = {
  -    {   "Status",   140     },
  +    {   "Type",     60      },
  +    {   "Date",     80      },
  +    {   "Time",     60      },
       {   "Class",    172     },
       {   "Message",  300     },
  -    {   NULL,       0       },
  +    {   NULL,       0       },
   };
   
  -static char *ac_lv_stat = NULL;
  -static char ac_lv_clbuf[1024] = {0};
  +static char ac_lv_buf[1024] = {0};
   static char *ac_lv_class = NULL;
  -static char *ac_lv_clmsg = NULL;
  +static char *ac_lv_msg = NULL;
  +static char *ac_lv_date = NULL;
  +static char *ac_lv_time = NULL;
   static int  ac_lv_iicon = 0;
  -
  +
  +static char *lv_infos[] = {
  +    "Info",
  +    "Warning",
  +    "Error",
  +    "Severe"
  +};
   
   
  -void tc_parse_list_string(const char *str)
  +void tc_parse_list_string(const char *str, int from)
   {
       int row = 0x7FFFFFFF;
       LV_ITEM lvi;
  @@ -116,12 +125,16 @@
       if (isdigit(*str)) {
           char *p;
                   
  -        strncpy(ac_lv_clbuf, str, 1023);
  -        ac_lv_stat = p = &ac_lv_clbuf[0];
  +        strncpy(ac_lv_buf, str, 1023);
  +        ac_lv_date = p = &ac_lv_buf[0];
   
           while (*p && !isspace(*p))
               ++p;
  -        ++p;
  +        *(p++) = 0;
  +        while (*p && isspace(*p))
  +            ++p;
  +        ac_lv_time = p;
  +
           while (*p && !isspace(*p))
               ++p;
           *(p++) = 0;
  @@ -132,7 +145,7 @@
           while (*p && !isspace(*p))
               ++p;
           *(p++) = 0;
  -        ac_lv_clmsg = p;
  +        ac_lv_msg = p;
           
       }
       else {
  @@ -149,31 +162,38 @@
               off = STRN_SIZE("ERROR:") + 1;
           }
           else if (STRN_COMPARE(str, "SEVERE:")) {
  -            ac_lv_iicon = 2;
  +            ac_lv_iicon = 3;
               off = STRN_SIZE("SEVERE:") + 1;
           }
  -        ac_lv_clmsg = (char *)str + off;
  +        ac_lv_msg = (char *)str + off;
   
           /* skip leading spaces */
  -        while (*ac_lv_clmsg && isspace(*ac_lv_clmsg))
  -            ++ac_lv_clmsg;
  +        while (*ac_lv_msg && isspace(*ac_lv_msg))
  +            ++ac_lv_msg;
       }
  +    
  +    /* if this is from stderr set the error icon */
  +    if (from)
  +        ac_lv_iicon = 2;
   
       STR_NOT_NULL(ac_lv_class);
  -    STR_NOT_NULL(ac_lv_clmsg);
  -    STR_NOT_NULL(ac_lv_stat);
  +    STR_NOT_NULL(ac_lv_msg);
  +    STR_NOT_NULL(ac_lv_date);
  +    STR_NOT_NULL(ac_lv_time);
   
       memset(&lvi, 0, sizeof(LV_ITEM));
       lvi.mask        = LVIF_IMAGE | LVIF_TEXT;
       lvi.iItem       = ac_lview_current;
       lvi.iImage      = ac_lv_iicon;
  -    lvi.pszText     = ac_lv_stat;
  -    lvi.cchTextMax  = strlen(ac_lv_stat) + 1;
  +    lvi.pszText     = lv_infos[ac_lv_iicon];
  +    lvi.cchTextMax  = 8;
       row = ListView_InsertItem(ac_list_hwnd, &lvi);
       if (row == -1)
           return;
  -    ListView_SetItemText(ac_list_hwnd, row, 1, ac_lv_class); 
  -    ListView_SetItemText(ac_list_hwnd, row, 2, ac_lv_clmsg);
  +    ListView_SetItemText(ac_list_hwnd, row, 1, ac_lv_date); 
  +    ListView_SetItemText(ac_list_hwnd, row, 2, ac_lv_time); 
  +    ListView_SetItemText(ac_list_hwnd, row, 3, ac_lv_class); 
  +    ListView_SetItemText(ac_list_hwnd, row, 4, ac_lv_msg);
       ListView_EnsureVisible(ac_list_hwnd,
                                  ListView_GetItemCount(ac_list_hwnd) - 1,
                                  FALSE); 
  @@ -184,10 +204,11 @@
   
   void acx_init_extended()
   {
  -    ac_use_lview = 1;
  -    ac_splash_msg = "INFO: Jk running";
  -    ac_columns = &tac_columns[0];
  +    ac_splash_timeout = 20000;
  +    ac_splash_msg = "INFO: Jk running";
  +    ac_columns = &tac_columns[0];
       lv_parser = tc_parse_list_string;
  +
   }
   
   #endif
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-dev-help@jakarta.apache.org


Mime
View raw message