mturk       2005/02/15 01:00:43

  Modified:    jk/native/common jk_status.c
  Log:
  Remove CRLF's. I simply hate that.
  
  Revision  Changes    Path
  1.8       +138 -138  jakarta-tomcat-connectors/jk/native/common/jk_status.c
  
  Index: jk_status.c
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-connectors/jk/native/common/jk_status.c,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- jk_status.c       15 Feb 2005 08:52:53 -0000      1.7
  +++ jk_status.c       15 Feb 2005 09:00:43 -0000      1.8
  @@ -146,42 +146,42 @@
       return rc;
   }
   
  -/* Actually APR's apr_strfsize */

  -char *status_strfsize(size_t size, char *buf)

  -{

  -    const char ord[] = "KMGTPE";

  -    const char *o = ord;

  -    int remain;

  -

  -    if (size < 0) {

  -        return strcpy(buf, "  - ");

  -    }

  -    if (size < 973) {

  -        if (sprintf(buf, "%3d ", (int) size) < 0)

  -            return strcpy(buf, "****");

  -        return buf;

  -    }

  -    do {

  -        remain = (int)(size & 1023);

  -        size >>= 10;

  -        if (size >= 973) {

  -            ++o;

  -            continue;

  -        }

  -        if (size < 9 || (size == 9 && remain < 973)) {

  -            if ((remain = ((remain * 5) + 256) / 512) >= 10)

  -                ++size, remain = 0;

  -            if (sprintf(buf, "%d.%d%c", (int) size, remain, *o) < 0)

  -                return strcpy(buf, "****");

  -            return buf;

  -        }

  -        if (remain >= 512)

  -            ++size;

  -        if (sprintf(buf, "%3d%c", (int) size, *o) < 0)

  -            return strcpy(buf, "****");

  -        return buf;

  -    } while (1);

  -}

  +/* Actually APR's apr_strfsize */
  +char *status_strfsize(size_t size, char *buf)
  +{
  +    const char ord[] = "KMGTPE";
  +    const char *o = ord;
  +    int remain;
  +
  +    if (size < 0) {
  +        return strcpy(buf, "  - ");
  +    }
  +    if (size < 973) {
  +        if (sprintf(buf, "%3d ", (int) size) < 0)
  +            return strcpy(buf, "****");
  +        return buf;
  +    }
  +    do {
  +        remain = (int)(size & 1023);
  +        size >>= 10;
  +        if (size >= 973) {
  +            ++o;
  +            continue;
  +        }
  +        if (size < 9 || (size == 9 && remain < 973)) {
  +            if ((remain = ((remain * 5) + 256) / 512) >= 10)
  +                ++size, remain = 0;
  +            if (sprintf(buf, "%d.%d%c", (int) size, remain, *o) < 0)
  +                return strcpy(buf, "****");
  +            return buf;
  +        }
  +        if (remain >= 512)
  +            ++size;
  +        if (sprintf(buf, "%3d%c", (int) size, *o) < 0)
  +            return strcpy(buf, "****");
  +        return buf;
  +    } while (1);
  +}
   
   static const char *status_worker_type(int t)
   {
  @@ -219,21 +219,21 @@
           s->write(s, "(null)", 6);
   }
   
  -static void jk_putv(jk_ws_service_t *s, ...)

  -{

  -    va_list va;

  -    const char *str;

  -

  -    va_start(va, s);

  -    while (1) {

  -        str = va_arg(va, const char *);

  -        if (str == NULL)

  -            break;

  -        s->write(s, str, strlen(str));

  -    }

  -    va_end(va);

  -}

  -

  +static void jk_putv(jk_ws_service_t *s, ...)
  +{
  +    va_list va;
  +    const char *str;
  +
  +    va_start(va, s);
  +    while (1) {
  +        str = va_arg(va, const char *);
  +        if (str == NULL)
  +            break;
  +        s->write(s, str, strlen(str));
  +    }
  +    va_end(va);
  +}
  +
   
   /**
    * Command line reference:
  @@ -272,17 +272,17 @@
               /* Skip status, jni and ajp12 worker */
               continue;
           }
  -        jk_puts(s, "<hr />\n<h3>Worker Status for ");

  -        jk_putv(s, "<a href=\"", s->req_uri, "?cmd=show&w=",

  -                sw->we->worker_list[i], "\">", NULL); 

  -        jk_putv(s, sw->we->worker_list[i], "</a></h3>\n", NULL);

  -        if (lb != NULL) {

  -            unsigned int j;

  -            int selected = -1;

  -            jk_puts(s, "<table border=\"0\"><tr>"

  -                    "<th>Type</th><th>Sticky session</th>"

  -                    "<th>Local worker only</th>"

  -                    "<th>Retries</th>"

  +        jk_puts(s, "<hr />\n<h3>Worker Status for ");
  +        jk_putv(s, "<a href=\"", s->req_uri, "?cmd=show&w=",
  +                sw->we->worker_list[i], "\">", NULL); 
  +        jk_putv(s, sw->we->worker_list[i], "</a></h3>\n", NULL);
  +        if (lb != NULL) {
  +            unsigned int j;
  +            int selected = -1;
  +            jk_puts(s, "<table border=\"0\"><tr>"
  +                    "<th>Type</th><th>Sticky session</th>"
  +                    "<th>Local worker only</th>"
  +                    "<th>Retries</th>"
                       "</tr>\n<tr>");        
               jk_putv(s, "<td>", status_worker_type(w->type), "</td>", NULL);
               jk_putv(s, "<td>", status_val_bool(lb->s->sticky_session),
  @@ -291,100 +291,100 @@
                       "</td>", NULL);
               jk_printf(s, "<td>%d</td>", lb->s->retries);
               jk_puts(s, "</tr>\n</table>\n");
  -            jk_puts(s, "<table border=\"0\"><tr>"

  -                    "<th>Name</th><th>Type</th><th>Host</th><th>Addr</th>"

  -                    
"<th>Stat</th><th>F</th><th>V</th><th>Acc</th><th>Err</th>"

  +            jk_puts(s, "<table border=\"0\"><tr>"
  +                    "<th>Name</th><th>Type</th><th>Host</th><th>Addr</th>"
  +                    
"<th>Stat</th><th>F</th><th>V</th><th>Acc</th><th>Err</th>"
                       "<th>Wr</th><th>Rd</th><th>RR</th><th>Cd</th></tr>\n");
               for (j = 0; j < lb->num_of_workers; j++) {
                   worker_record_t *wr = &(lb->lb_workers[j]);
                   ajp_worker_t *a = (ajp_worker_t *)wr->w->worker_private;
  -                jk_putv(s, "<tr>\n<td><a href=\"", s->req_uri,

  -                        "?cmd=show&w=",

  -                        wr->s->name, "\">",

  -                        wr->s->name, "</td>", NULL);

  -                if (dworker && strcmp(dworker, wr->s->name) == 0)

  -                    selected = j;

  +                jk_putv(s, "<tr>\n<td><a href=\"", s->req_uri,
  +                        "?cmd=show&w=",
  +                        wr->s->name, "\">",
  +                        wr->s->name, "</td>", NULL);
  +                if (dworker && strcmp(dworker, wr->s->name) == 0)
  +                    selected = j;
                   jk_putv(s, "<td>", status_worker_type(wr->w->type), "</td>", 
NULL);
                   jk_printf(s, "<td>%s:%d</td>", a->host, a->port);
                   jk_putv(s, "<td>", jk_dump_hinfo(&a->worker_inet_addr, buf),
                           "</td>", NULL);
                   /* TODO: descriptive status */
  -                jk_putv(s, "<td>",

  -                        status_val_status(wr->s->is_disabled,

  -                                          wr->s->in_error_state,

  -                                          wr->s->in_recovering),

  -                        "</td>", NULL);

  -                jk_printf(s, "<td>%d</td>", wr->s->lb_factor);

  -                jk_printf(s, "<td>%d</td>", wr->s->lb_value);

  -                jk_printf(s, "<td>%u</td>", wr->s->elected);

  -                jk_printf(s, "<td>%u</td>", wr->s->errors);

  -                jk_putv(s, "<td>", status_strfsize(wr->s->transferred, buf),

  -                        "</td>", NULL);

  -                jk_putv(s, "<td>", status_strfsize(wr->s->readed, buf),

  -                        "</td><td>", NULL);

  -                jk_puts(s, wr->s->redirect);

  -                jk_puts(s, "</td><td>\n");

  -                jk_puts(s, wr->s->domain);

  -                jk_puts(s, "</td>\n</tr>\n");

  +                jk_putv(s, "<td>",
  +                        status_val_status(wr->s->is_disabled,
  +                                          wr->s->in_error_state,
  +                                          wr->s->in_recovering),
  +                        "</td>", NULL);
  +                jk_printf(s, "<td>%d</td>", wr->s->lb_factor);
  +                jk_printf(s, "<td>%d</td>", wr->s->lb_value);
  +                jk_printf(s, "<td>%u</td>", wr->s->elected);
  +                jk_printf(s, "<td>%u</td>", wr->s->errors);
  +                jk_putv(s, "<td>", status_strfsize(wr->s->transferred, buf),
  +                        "</td>", NULL);
  +                jk_putv(s, "<td>", status_strfsize(wr->s->readed, buf),
  +                        "</td><td>", NULL);
  +                jk_puts(s, wr->s->redirect);
  +                jk_puts(s, "</td><td>\n");
  +                jk_puts(s, wr->s->domain);
  +                jk_puts(s, "</td>\n</tr>\n");
               }
  -            jk_puts(s, "</table><br />\n");

  -            if (selected >= 0) {

  +            jk_puts(s, "</table><br />\n");
  +            if (selected >= 0) {
                   worker_record_t *wr = &(lb->lb_workers[selected]);
                   ajp_worker_t *a = (ajp_worker_t *)wr->w->worker_private;
  -                jk_putv(s, "<hr /><h3>Edit worker settings for ",

  -                        wr->s->name, "</h3>\n", NULL);

  -                jk_putv(s, "<form method=\"GET\" action=\"",

  -                        s->req_uri, "\">\n", NULL);

  -                jk_puts(s, "<table>\n<input type=hidden name=\"cmd\" ");

  -                jk_puts(s, "value=\"update\">\n");

  -                jk_puts(s, "<input type=hidden name=\"w\" ");

  -                jk_putv(s, "value=\"", wr->s->name, "\">\n</table>\n", NULL);

  -

  -                jk_puts(s, "<table>\n<tr><td>Load factor:</td><td><input 
name=\"lf\" type=text ");

  -                jk_printf(s, "value=\"%d\"></td><tr>\n", wr->s->lb_factor);  
          

  -                jk_puts(s, "<tr><td>Route Redirect:</td><td><input 
name=\"rr\" type=text ");

  -                jk_putv(s, "value=\"", wr->s->redirect, NULL); 

  -                jk_puts(s, "\"></td></tr>\n");

  -                jk_puts(s, "<tr><td>Cluster Domain:</td><td><input 
name=\"cd\" type=text ");

  -                jk_putv(s, "value=\"", wr->s->domain, NULL); 

  -                jk_puts(s, "\"></td></tr>\n");    

  -                jk_puts(s, "<tr><td>Disabled:</td><td><input name=\"dw\" 
type=checkbox");

  -                if (wr->s->is_disabled)

  -                    jk_puts(s, " checked");

  -                jk_puts(s, "></td></tr>\n");            

  -

  -                jk_puts(s, "<tr><td colspan=2>&nbsp;</td></tr>\n");    

  -                jk_puts(s, "<tr><td colspan=2><input type=submit 
value=\"Update Worker\">");

  -                jk_puts(s, "</td></tr>\n</table>\n</form>\n");

  -

  -            }

  +                jk_putv(s, "<hr /><h3>Edit worker settings for ",
  +                        wr->s->name, "</h3>\n", NULL);
  +                jk_putv(s, "<form method=\"GET\" action=\"",
  +                        s->req_uri, "\">\n", NULL);
  +                jk_puts(s, "<table>\n<input type=hidden name=\"cmd\" ");
  +                jk_puts(s, "value=\"update\">\n");
  +                jk_puts(s, "<input type=hidden name=\"w\" ");
  +                jk_putv(s, "value=\"", wr->s->name, "\">\n</table>\n", NULL);
  +
  +                jk_puts(s, "<table>\n<tr><td>Load factor:</td><td><input 
name=\"lf\" type=text ");
  +                jk_printf(s, "value=\"%d\"></td><tr>\n", wr->s->lb_factor);  
          
  +                jk_puts(s, "<tr><td>Route Redirect:</td><td><input 
name=\"rr\" type=text ");
  +                jk_putv(s, "value=\"", wr->s->redirect, NULL); 
  +                jk_puts(s, "\"></td></tr>\n");
  +                jk_puts(s, "<tr><td>Cluster Domain:</td><td><input 
name=\"cd\" type=text ");
  +                jk_putv(s, "value=\"", wr->s->domain, NULL); 
  +                jk_puts(s, "\"></td></tr>\n");    
  +                jk_puts(s, "<tr><td>Disabled:</td><td><input name=\"dw\" 
type=checkbox");
  +                if (wr->s->is_disabled)
  +                    jk_puts(s, " checked");
  +                jk_puts(s, "></td></tr>\n");            
  +
  +                jk_puts(s, "<tr><td colspan=2>&nbsp;</td></tr>\n");    
  +                jk_puts(s, "<tr><td colspan=2><input type=submit 
value=\"Update Worker\">");
  +                jk_puts(s, "</td></tr>\n</table>\n</form>\n");
  +
  +            }
           }
           else {
  -            jk_puts(s, "\n\n<table border=\"0\"><tr>"

  -                    "<th>Type</th><th>Host</th><th>Addr</th>"

  +            jk_puts(s, "\n\n<table border=\"0\"><tr>"
  +                    "<th>Type</th><th>Host</th><th>Addr</th>"
                       "</tr>\n<tr>");        
               jk_putv(s, "<td>", status_worker_type(w->type), "</td>", NULL);
               jk_puts(s, "</tr>\n</table>\n");
               jk_printf(s, "<td>%s:%d</td>", aw->host, aw->port);
               jk_putv(s, "<td>", jk_dump_hinfo(&aw->worker_inet_addr, buf),
                       "</td>\n</tr>\n", NULL);
  -            jk_puts(s, "</table>\n");

  +            jk_puts(s, "</table>\n");
           }
       }
       /* Display legend */
  -    jk_puts(s, "<hr /><table>\n"

  -            "<tr><th>Name</th><td>Worker route name</td></tr>\n"

  -            "<tr><th>Type</th><td>Worker type</td></tr>\n"

  -            "<tr><th>Addr</th><td>Backend Address info</td></tr>\n"

  -            "<tr><th>Stat</th><td>Worker status</td></tr>\n"

  -            "<tr><th>F</th><td>Load Balancer Factor</td></tr>\n"

  -            "<tr><th>V</th><td>Load Balancer Value</td></tr>\n"

  -            "<tr><th>Acc</th><td>Number of requests</td></tr>\n"

  -            "<tr><th>Err</th><td>Number of failed requests</td></tr>\n"

  -            "<tr><th>Wr</th><td>Number of bytes transferred</td></tr>\n"

  -            "<tr><th>Rd</th><td>Number of bytes read</td></tr>\n"

  -            "<tr><th>RR</th><td>Route redirect</td></tr>\n"

  -            "<tr><th>Cd</th><td>Cluster domain</td></tr>\n"

  +    jk_puts(s, "<hr /><table>\n"
  +            "<tr><th>Name</th><td>Worker route name</td></tr>\n"
  +            "<tr><th>Type</th><td>Worker type</td></tr>\n"
  +            "<tr><th>Addr</th><td>Backend Address info</td></tr>\n"
  +            "<tr><th>Stat</th><td>Worker status</td></tr>\n"
  +            "<tr><th>F</th><td>Load Balancer Factor</td></tr>\n"
  +            "<tr><th>V</th><td>Load Balancer Value</td></tr>\n"
  +            "<tr><th>Acc</th><td>Number of requests</td></tr>\n"
  +            "<tr><th>Err</th><td>Number of failed requests</td></tr>\n"
  +            "<tr><th>Wr</th><td>Number of bytes transferred</td></tr>\n"
  +            "<tr><th>Rd</th><td>Number of bytes read</td></tr>\n"
  +            "<tr><th>RR</th><td>Route redirect</td></tr>\n"
  +            "<tr><th>Cd</th><td>Cluster domain</td></tr>\n"
               "</table>");
   }
   
  @@ -454,10 +454,10 @@
           jk_puts(s, "<h1>JK Status Manager for ");
           jk_puts(s, s->server_name);
           jk_puts(s, "</h1>\n\n");
  -        jk_putv(s, "<dl><dt>Server Version: ",

  -                s->server_software, "</dt>\n", NULL);

  -        jk_putv(s, "<dt>JK Version: ",

  -                JK_VERSTRING, "\n</dt></dl>\n", NULL);

  +        jk_putv(s, "<dl><dt>Server Version: ",
  +                s->server_software, "</dt>\n", NULL);
  +        jk_putv(s, "<dt>JK Version: ",
  +                JK_VERSTRING, "\n</dt></dl>\n", NULL);
   
           /* Step 1: Process GET params and update configuration */
           cmd = status_cmd_type(s->query_string);
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to