"Fossies" - the Fresh Open Source Software Archive

Member "mod_log_sql-1.101/functions13.h" (29 Apr 2004, 1522 Bytes) of package /linux/www/apache_httpd_modules/old/mod_log_sql-1.101.tar.bz2:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 /* $Id: functions13.h 125 2004-04-29 18:05:25Z urkle@drip.ws $ */
    2 
    3 static const char *extract_bytes_sent(request_rec *r, char *a)
    4 {
    5     if (!r->sent_bodyct) {
    6         return "-";
    7     }
    8     else {
    9         long int bs;
   10         ap_bgetopt(r->connection->client, BO_BYTECT, &bs);
   11     return ap_psprintf(r->pool, "%ld", bs);
   12     }
   13 }
   14 
   15 static const char *extract_request_time(request_rec *r, char *a)
   16 {
   17     int timz;
   18     struct tm *t;
   19     char tstr[MAX_STRING_LEN];
   20 
   21     t = ap_get_gmtoff(&timz);
   22 
   23     if (a && *a) {     /* Custom format */
   24         strftime(tstr, MAX_STRING_LEN, a, t);
   25     } else {           /* CLF format */
   26         char sign = (timz < 0 ? '-' : '+');
   27 
   28         if (timz < 0) {
   29             timz = -timz;
   30         }
   31         strftime(tstr, MAX_STRING_LEN, "[%d/%b/%Y:%H:%M:%S ", t);
   32         ap_snprintf(tstr + strlen(tstr), sizeof(tstr) - strlen(tstr), "%c%.2d%.2d]", sign, timz / 60, timz % 60);
   33     }
   34 
   35     return ap_pstrdup(r->pool, tstr);
   36 }
   37 
   38 static const char *extract_request_duration(request_rec *r, char *a)
   39 {
   40     return ap_psprintf(r->pool, "%ld", time(NULL) - r->request_time);
   41 }
   42 
   43 static const char *extract_request_timestamp(request_rec *r, char *a)
   44 {
   45     return ap_psprintf(r->pool, "%ld", (long) time(NULL));
   46 }
   47 static const char *extract_connection_status(request_rec *r, char *a) __attribute__((unused));
   48 static const char *extract_connection_status(request_rec *r, char *a)
   49 {
   50     if (r->connection->aborted)
   51         return "X";
   52 
   53     if ((r->connection->keepalive) && 
   54         ((r->server->keep_alive_max - r->connection->keepalives) > 0)) {
   55         return "+";
   56     }
   57     return "-";
   58 }