httpd-test-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grega...@apache.org
Subject cvs commit: httpd-test/specweb99/specweb99-2.0 mod_specweb99.c
Date Wed, 15 Jan 2003 16:15:03 GMT
gregames    2003/01/15 08:15:03

  Modified:    specweb99/specweb99-2.0 mod_specweb99.c
  Log:
  style police: convert leading tabs to blanks.  No functional change.
  
  Revision  Changes    Path
  1.18      +486 -486  httpd-test/specweb99/specweb99-2.0/mod_specweb99.c
  
  Index: mod_specweb99.c
  ===================================================================
  RCS file: /home/cvs/httpd-test/specweb99/specweb99-2.0/mod_specweb99.c,v
  retrieving revision 1.17
  retrieving revision 1.18
  diff -u -r1.17 -r1.18
  --- mod_specweb99.c	14 Jan 2003 15:02:00 -0000	1.17
  +++ mod_specweb99.c	15 Jan 2003 16:15:02 -0000	1.18
  @@ -132,7 +132,7 @@
   
   static apr_int16_t
   getCADFile(struct server_rec *sv, struct request_rec *r,
  -	     struct specweb99_module_data * _my); 
  +         struct specweb99_module_data * _my); 
   
   /* Use interal locking - the main reason for doing
    * so is error trapping and being able to warn/info
  @@ -147,7 +147,7 @@
    * - when 'file' is passed - logging will be more meaningfull
    */
   static int _dolock(struct server_rec *s, struct request_rec *r, apr_file_t * f,
  -		       int type, char *file)
  +               int type, char *file)
   {
       int e;
       /*
  @@ -157,29 +157,29 @@
        *
        */
       if ((e = apr_file_lock(f, type | APR_FLOCK_NONBLOCK)) != APR_SUCCESS) {
  -	/*
  -	 * XXX timeouts removed !  not sure how to do that in 2.0
  -	 */
  -	if (s)
  -	    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, e, s,
  -			 "Camping out %s%s for a %s lock",
  -			 file ? "on " : "", file ? file : "",
  -			 ((type == APR_FLOCK_SHARED) ? "read" : "write"));
  -
  -	e = apr_file_lock(f, type);
  -	/*
  -	 * XXXX clear timeout removed not sure how to do that in 2.0
  -	 */
  +    /*
  +     * XXX timeouts removed !  not sure how to do that in 2.0
  +     */
  +    if (s)
  +        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_INFO, e, s,
  +             "Camping out %s%s for a %s lock",
  +             file ? "on " : "", file ? file : "",
  +             ((type == APR_FLOCK_SHARED) ? "read" : "write"));
  +
  +    e = apr_file_lock(f, type);
  +    /*
  +     * XXXX clear timeout removed not sure how to do that in 2.0
  +     */
       }
   
       /* Trap both first/second flock() error. */
       if (e) {
  -	if (s)
  -	    ap_log_error(APLOG_MARK, APLOG_ERR, e, s,
  -			 "Failed to %s" "lock%s%s",
  -			 ((type == APR_FLOCK_SHARED) ? "read" : "write"),
  -			 ((file) ? ": " : ""), ((file) ? file : ""));
  -	return -1;
  +    if (s)
  +        ap_log_error(APLOG_MARK, APLOG_ERR, e, s,
  +             "Failed to %s" "lock%s%s",
  +             ((type == APR_FLOCK_SHARED) ? "read" : "write"),
  +             ((file) ? ": " : ""), ((file) ? file : ""));
  +    return -1;
       }
       return 0;
   }
  @@ -190,10 +190,10 @@
   
       /* Fill up the boilerplate with info */
       bp_head = apr_psprintf(r->pool, boilerplate_start,
  -			   ap_get_server_version(),
  -			   ap_get_remote_host(r->connection, NULL,
  -					      REMOTE_NOLOOKUP, NULL), r->uri,
  -			   r->args ? r->args : "");
  +               ap_get_server_version(),
  +               ap_get_remote_host(r->connection, NULL,
  +                          REMOTE_NOLOOKUP, NULL), r->uri,
  +               r->args ? r->args : "");
   
       r->content_type = "text/html";
   
  @@ -216,7 +216,7 @@
       b1 = apr_bucket_transient_create(bp_head, strlen(bp_head), c->bucket_alloc);
       b2 = apr_bucket_transient_create(buf, buflen, c->bucket_alloc);
       b3 = apr_bucket_immortal_create(boilerplate_end,
  -				  boilerplate_end_len, c->bucket_alloc);
  +                  boilerplate_end_len, c->bucket_alloc);
   
       APR_BRIGADE_INSERT_TAIL(bb, b1);
       APR_BRIGADE_INSERT_TAIL(bb, b2);
  @@ -225,9 +225,9 @@
   
       rv = ap_pass_brigade(r->output_filters, bb);
       if (rv != APR_SUCCESS) {
  -	ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
  -		      "mod_specweb: ap_pass_brigade failed for buffer '%s'",
  -		      buf);
  +    ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
  +              "mod_specweb: ap_pass_brigade failed for buffer '%s'",
  +              buf);
       }
   }				/* returnHTMLPageWithBuffer */
   
  @@ -255,10 +255,10 @@
       conn_rec *c = r->connection;
   
       if ((rv = apr_stat(&s, fname, APR_FINFO_SIZE, r->pool)) != APR_SUCCESS) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
  -		     "Could not stat file '%s' for reading", fname);
  -	returnHTMLPageWithMessage(r, "Error: Failed to stat the file");
  -	return;
  +    ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
  +             "Could not stat file '%s' for reading", fname);
  +    returnHTMLPageWithMessage(r, "Error: Failed to stat the file");
  +    return;
       }
   
       bp_head = returnHTMLPageHead(r);
  @@ -266,38 +266,38 @@
       b1 = apr_bucket_transient_create(bp_head, strlen(bp_head), c->bucket_alloc);
   
       if ((rv =
  -	 apr_file_open(&f, fname, APR_READ, APR_OS_DEFAULT,
  -		       r->pool)) != APR_SUCCESS) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
  -		     "Could not open file '%s' for reading", fname);
  -	returnHTMLPageWithMessage(r, "Error: could not open file for reading.");
  -	return;
  +     apr_file_open(&f, fname, APR_READ, APR_OS_DEFAULT,
  +               r->pool)) != APR_SUCCESS) {
  +    ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
  +             "Could not open file '%s' for reading", fname);
  +    returnHTMLPageWithMessage(r, "Error: could not open file for reading.");
  +    return;
       }
   
       bb = apr_brigade_create(r->pool, c->bucket_alloc);
   #if APR_HAS_LARGE_FILES
       if (s.size > AP_MAX_SENDFILE) {
  -	/*
  -	 * APR_HAS_LARGE_FILES issue; must split into mutiple buckets, no
  -	 * greater than MAX(apr_size_t), and more granular than that in case
  -	 * the brigade code/filters attempt to read it directly.
  -	 */
  -	apr_off_t fsize = s.size;
  -	b = apr_bucket_file_create(f, zero, AP_MAX_SENDFILE, r->pool);
  -	while (fsize > AP_MAX_SENDFILE) {
  -	    APR_BRIGADE_INSERT_TAIL(bb, b);
  -	    apr_bucket_copy(b, &b);
  -	    b->start += AP_MAX_SENDFILE;
  -	    fsize -= AP_MAX_SENDFILE;
  -	}
  -	b->length = (apr_size_t) fsize;	/* Resize just the last bucket */
  +    /*
  +     * APR_HAS_LARGE_FILES issue; must split into mutiple buckets, no
  +     * greater than MAX(apr_size_t), and more granular than that in case
  +     * the brigade code/filters attempt to read it directly.
  +     */
  +    apr_off_t fsize = s.size;
  +    b = apr_bucket_file_create(f, zero, AP_MAX_SENDFILE, r->pool);
  +    while (fsize > AP_MAX_SENDFILE) {
  +        APR_BRIGADE_INSERT_TAIL(bb, b);
  +        apr_bucket_copy(b, &b);
  +        b->start += AP_MAX_SENDFILE;
  +        fsize -= AP_MAX_SENDFILE;
  +    }
  +    b->length = (apr_size_t) fsize;	/* Resize just the last bucket */
       }
       else
   #endif
  -	b2 = apr_bucket_file_create(f, zero, (apr_size_t) (s.size),
  -				    r->pool, c->bucket_alloc);
  +    b2 = apr_bucket_file_create(f, zero, (apr_size_t) (s.size),
  +                    r->pool, c->bucket_alloc);
       b3 = apr_bucket_immortal_create(boilerplate_end, 
  -				    boilerplate_end_len, c->bucket_alloc);
  +                    boilerplate_end_len, c->bucket_alloc);
   
       APR_BRIGADE_INSERT_TAIL(bb, b1);
       APR_BRIGADE_INSERT_TAIL(bb, b2);
  @@ -306,8 +306,8 @@
   
       rv = ap_pass_brigade(r->output_filters, bb);
       if (rv != APR_SUCCESS) {
  -	ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
  -		      "mod_specweb: ap_pass_brigade failed for %s", fname);
  +    ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
  +              "mod_specweb: ap_pass_brigade failed for %s", fname);
       }
   }				/* returnHTMLPageWithFile */
   
  @@ -319,7 +319,7 @@
   
   static apr_int16_t
          checkUPFile(struct server_rec *sv, struct request_rec *r,
  -		          struct specweb99_module_data * _my)
  +                  struct specweb99_module_data * _my)
   {
       apr_finfo_t s;
       apr_status_t rv;
  @@ -337,16 +337,16 @@
   
       /* stat it, compare to stored stat */
       if ((rv = apr_stat(&s, _my->up_path,
  -		       APR_FINFO_SIZE | APR_FINFO_MTIME,
  -		       r->pool)) != APR_SUCCESS) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -		     "Could not stat User.Personality file '%s'",
  -		     _my->up_path);
  -	return 1;
  +               APR_FINFO_SIZE | APR_FINFO_MTIME,
  +               r->pool)) != APR_SUCCESS) {
  +    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "Could not stat User.Personality file '%s'",
  +             _my->up_path);
  +    return 1;
       };
   
       if (s.mtime == _my->up_lastmod) {
  -	return 0;
  +    return 0;
       }
   
       numrecords = s.size / UPRLENGTH;
  @@ -354,72 +354,72 @@
        * Check buffer array for nullness and bigness, make if necessary.
        */
       if ((_my->up == NULL) || (numrecords > _my->up_count)) {
  -	/* User personalities are only 32 bits (sad, really) */
  -	apr_pool_clear(_my->up_pool);
  +    /* User personalities are only 32 bits (sad, really) */
  +    apr_pool_clear(_my->up_pool);
          _my->up = apr_palloc(_my->up_pool, numrecords * sizeof(apr_uint32_t));
  -	_my->up_count = numrecords;
  +    _my->up_count = numrecords;
       }
       /*
        * open the file, with memory from the request pool because we will
        * not need it very long.
        */
       if ((rv = apr_file_open(&f, _my->up_path,
  -			    APR_READ, APR_OS_DEFAULT,
  -			    r->pool)) != APR_SUCCESS) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -		     "Could not open User.Personality file '%s'",
  -		     _my->up_path);
  -	return 1;
  +                APR_READ, APR_OS_DEFAULT,
  +                r->pool)) != APR_SUCCESS) {
  +    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "Could not open User.Personality file '%s'",
  +             _my->up_path);
  +    return 1;
       }
   
       if (_rlock(sv, r, f, _my->up_path)) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -		     "Failed to lock User.Personality file '%s'",
  -		     _my->up_path);
  -	apr_file_close(f);
  -	return 1;
  +    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "Failed to lock User.Personality file '%s'",
  +             _my->up_path);
  +    apr_file_close(f);
  +    return 1;
       }
   
       /* Read every record, parse, put user demographics in array */
       up_uid = 0;
       while (1) {
  -	int id, dem;
  -	apr_size_t l;
  +    int id, dem;
  +    apr_size_t l;
  +
  +    if ((rv =
  +         apr_file_read_full(f, up_record, UPRLENGTH, &l)) != APR_SUCCESS)
  +        break;
  +
  +    up_record[UPRLENGTH] = '\0';
  +
  +    if (sscanf(up_record, "%d %x", &id, &dem) != 2) {
  +        ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "corrupted entry in UP file");
  +        e = 1;
  +    }
   
  -	if ((rv =
  -	     apr_file_read_full(f, up_record, UPRLENGTH, &l)) != APR_SUCCESS)
  -	    break;
  -
  -	up_record[UPRLENGTH] = '\0';
  -
  -	if (sscanf(up_record, "%d %x", &id, &dem) != 2) {
  -	    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -			 "corrupted entry in UP file");
  -	    e = 1;
  -	}
  -
  -	if (up_uid != id) {
  -	    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -			 "user id out of sync in UP file");
  -	    e = 1;
  -	}
  +    if (up_uid != id) {
  +        ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "user id out of sync in UP file");
  +        e = 1;
  +    }
   
  -	_my->up[up_uid] = dem;
  -	up_uid++;
  +    _my->up[up_uid] = dem;
  +    up_uid++;
       }
   
       if ((up_uid != numrecords) && (rv != APR_SUCCESS)) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -		     "Failed read from User.Personality file '%s'",
  -		     _my->up_path);
  -	e++;
  +    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "Failed read from User.Personality file '%s'",
  +             _my->up_path);
  +    e++;
       }
   
       if (apr_file_unlock(f) != APR_SUCCESS) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -		     "Failed to unlock User.Personality file '%s'",
  -		     _my->up_path);
  -	e = 1;
  +    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "Failed to unlock User.Personality file '%s'",
  +             _my->up_path);
  +    e = 1;
       };
   
       /* Close file */
  @@ -427,7 +427,7 @@
   
       /* Store last modified date assuming no errors. */
       if (e) {
  -	_my->up_lastmod = 0;
  +    _my->up_lastmod = 0;
           return e;
       }
       _my->up_lastmod = s.mtime;
  @@ -447,7 +447,7 @@
   
   static apr_int16_t
   getCADFile(struct server_rec *sv, struct request_rec *r,
  -	     struct specweb99_module_data * _my)
  +         struct specweb99_module_data * _my)
   {
       apr_finfo_t s;
       apr_status_t rv;
  @@ -458,11 +458,11 @@
       int e = 0;
   
       if ((rv =
  -	 apr_stat(&s, _my->cad_path, APR_FINFO_SIZE | APR_FINFO_MTIME,
  -		  r->pool)) != APR_SUCCESS) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -		     "Failed to stat CAD file '%s'", _my->cad_path);
  -	return 1;
  +     apr_stat(&s, _my->cad_path, APR_FINFO_SIZE | APR_FINFO_MTIME,
  +          r->pool)) != APR_SUCCESS) {
  +    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "Failed to stat CAD file '%s'", _my->cad_path);
  +    return 1;
       };
   
       /*
  @@ -471,73 +471,73 @@
        */
       numrecords = s.size / CADRLENGTH;
       if (numrecords > _my->cad_count) {
  -	apr_pool_clear(_my->cad_pool);
  -	_my->cad =
  -	    apr_palloc(_my->cad_pool, numrecords * sizeof(struct cadrec));
  -	_my->cad_count = numrecords;
  +    apr_pool_clear(_my->cad_pool);
  +    _my->cad =
  +        apr_palloc(_my->cad_pool, numrecords * sizeof(struct cadrec));
  +    _my->cad_count = numrecords;
       }
   
       if ((rv = apr_file_open(&f, _my->cad_path,
  -			    APR_READ, APR_OS_DEFAULT,
  -			    r->pool)) != APR_SUCCESS) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -		     "Failed to open CAD file '%s'", _my->cad_path);
  -	return 1;
  +                APR_READ, APR_OS_DEFAULT,
  +                r->pool)) != APR_SUCCESS) {
  +    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "Failed to open CAD file '%s'", _my->cad_path);
  +    return 1;
       };
   
       if (_rlock(sv, r, f, _my->cad_path)) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -		     "Failed to lock CAD file '%s'", _my->cad_path);
  -	return 1;
  +    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "Failed to lock CAD file '%s'", _my->cad_path);
  +    return 1;
       }
   
       cad_uid = 0;
       while (cad_uid < numrecords) {
  -	int id, dem, adw, adm, exp;
  -	apr_size_t l;
  -	if ((rv =
  -	   apr_file_read_full(f, cadline, CADRLENGTH, &l)) != APR_SUCCESS) {
  -	    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -			 "Failed to read from CAD file '%s'", _my->cad_path);
  -	    e = 1;
  -	    break;
  -	};
  -	/*
  -	 * Decode AD file (see specweb page ..)
  -	 *
  -	 * 0123456789.123456789.123456789.12345678 01234 01234567 01234567
  -	 * 012 0123456789n "%5d %8X %8X %3d %10d\n", Ad_id,
  -	 * AdDemographics, Weightings, Minimum_Match_Value,
  -	 * Expiration_Time
  -	 *
  -	 */
  -	if (sscanf(cadline, "%d %x %x %d %d", &id, &dem, &adw, &adm, &exp) !=
  -	    5) {
  -	    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -			 "Entry CAD file corrupted");
  -	    continue;
  -	}
  -
  -	if (cad_uid != id) {
  -	    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -			 "Entry CAD file Id# out of sync");
  -	    continue;
  -	}
  -	_my->cad[cad_uid].addemographics = dem;
  -	_my->cad[cad_uid].gen_weightings = (adw & 0x00f0000) >> 16;
  -	_my->cad[cad_uid].age_weightings = (adw & 0x000f000) >> 12;
  -	_my->cad[cad_uid].reg_weightings = (adw & 0x0000f00) >> 8;
  -	_my->cad[cad_uid].int1_weightings = (adw & 0x00000f0) >> 4;
  -	_my->cad[cad_uid].int2_weightings = (adw & 0x000000f);
  -	_my->cad[cad_uid].minimum_match_value = adm;
  -	_my->cad[cad_uid].expiration_time = exp;
  -	cad_uid++;
  +    int id, dem, adw, adm, exp;
  +    apr_size_t l;
  +    if ((rv =
  +       apr_file_read_full(f, cadline, CADRLENGTH, &l)) != APR_SUCCESS) {
  +        ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "Failed to read from CAD file '%s'", _my->cad_path);
  +        e = 1;
  +        break;
  +    };
  +    /*
  +     * Decode AD file (see specweb page ..)
  +     *
  +     * 0123456789.123456789.123456789.12345678 01234 01234567 01234567
  +     * 012 0123456789n "%5d %8X %8X %3d %10d\n", Ad_id,
  +     * AdDemographics, Weightings, Minimum_Match_Value,
  +     * Expiration_Time
  +     *
  +     */
  +    if (sscanf(cadline, "%d %x %x %d %d", &id, &dem, &adw, &adm, &exp) !=
  +        5) {
  +        ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "Entry CAD file corrupted");
  +        continue;
  +    }
  +
  +    if (cad_uid != id) {
  +        ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "Entry CAD file Id# out of sync");
  +        continue;
  +    }
  +    _my->cad[cad_uid].addemographics = dem;
  +    _my->cad[cad_uid].gen_weightings = (adw & 0x00f0000) >> 16;
  +    _my->cad[cad_uid].age_weightings = (adw & 0x000f000) >> 12;
  +    _my->cad[cad_uid].reg_weightings = (adw & 0x0000f00) >> 8;
  +    _my->cad[cad_uid].int1_weightings = (adw & 0x00000f0) >> 4;
  +    _my->cad[cad_uid].int2_weightings = (adw & 0x000000f);
  +    _my->cad[cad_uid].minimum_match_value = adm;
  +    _my->cad[cad_uid].expiration_time = exp;
  +    cad_uid++;
       }
   
       if (apr_file_unlock(f) != APR_SUCCESS) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  -		     "Failed to unlock the CAD file '%s'", _my->cad_path);
  -	e = 1;
  +    ap_log_error(APLOG_MARK, APLOG_ERR, rv, sv,
  +             "Failed to unlock the CAD file '%s'", _my->cad_path);
  +    e = 1;
       };
   
       apr_file_close(f);
  @@ -549,7 +549,7 @@
   {
       struct specweb99_module_data *_my;
       _my = (struct specweb99_module_data *)
  -	apr_pcalloc(p, sizeof(struct specweb99_module_data));
  +    apr_pcalloc(p, sizeof(struct specweb99_module_data));
   
       _my->up_lastmod = (apr_time_t) 0L;
   
  @@ -563,16 +563,16 @@
   }
   
   static int specweb99_module_init(apr_pool_t * p,
  -		       apr_pool_t * plog, apr_pool_t * ptemp, server_rec *s)
  +               apr_pool_t * plog, apr_pool_t * ptemp, server_rec *s)
   {
       ap_add_version_component(p, NAME "/" VERSION);
   
       ap_log_error(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO, 0, s,
  -		 NAME "/" VERSION " module: Compiled on %s at %s", __DATE__,
  -		 __TIME__);
  +         NAME "/" VERSION " module: Compiled on %s at %s", __DATE__,
  +         __TIME__);
   
       ap_log_error(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO, 0, s, "%s",
  -	    "$Id$");
  +        "$Id$");
   
       return 0;
   }				/* specweb99_module_init */
  @@ -580,7 +580,7 @@
   static void specweb99_child_init(apr_pool_t * p, server_rec *s)
   {
       struct specweb99_module_data *_my =
  -	ap_get_module_config(s->module_config, &specweb99_module);
  +    ap_get_module_config(s->module_config, &specweb99_module);
       struct request_rec r;
       const char *docroot;
   
  @@ -595,31 +595,31 @@
       _my->cadgen99 = ap_make_full_path(p, docroot, "cadgen99");
   
       if (apr_pool_create(&(_my->up_pool), p) != APR_SUCCESS)
  -	exit(APEXIT_CHILDFATAL);
  +    exit(APEXIT_CHILDFATAL);
   
       if (apr_pool_create(&(_my->cad_pool), p) != APR_SUCCESS)
  -	exit(APEXIT_CHILDFATAL);
  +    exit(APEXIT_CHILDFATAL);
   
       if (s->next) {
  -	fprintf(stderr,
  -		"WARNING- this specweb module currently does not support vhosts/services\n"
  -		"See %s:%d for what you need to change. The server will continue and assume\n"
  -		"the config of the base server\n", __FILE__, __LINE__ + 2);
  -
  -	/*
  -	 * Right now we assume you are specwebbing a whole server install -
  -	 * as opposed to a host:port:protocol instance tied to a virtual
  -	 * service.
  -	 *
  -	 * To support vhosts - the _my module config needs simply to be moved to
  -	 * the per server config block (or the per dir block) and the init
  -	 * and/or any access to it need to either go through the ->nxt list
  -	 * OR carefull overlay merging needs to be done to a sensible default
  -	 * for each of the cases. The current simplistic 'docroot' references
  -	 * are propably no longer going to work and will need explicit config
  -	 * (e.g. think ~user and other redirect cases with clobber the
  -	 * concept of a docroot).
  -	 */
  +    fprintf(stderr,
  +        "WARNING- this specweb module currently does not support vhosts/services\n"
  +        "See %s:%d for what you need to change. The server will continue and assume\n"
  +        "the config of the base server\n", __FILE__, __LINE__ + 2);
  +
  +    /*
  +     * Right now we assume you are specwebbing a whole server install -
  +     * as opposed to a host:port:protocol instance tied to a virtual
  +     * service.
  +     *
  +     * To support vhosts - the _my module config needs simply to be moved to
  +     * the per server config block (or the per dir block) and the init
  +     * and/or any access to it need to either go through the ->nxt list
  +     * OR carefull overlay merging needs to be done to a sensible default
  +     * for each of the cases. The current simplistic 'docroot' references
  +     * are propably no longer going to work and will need explicit config
  +     * (e.g. think ~user and other redirect cases with clobber the
  +     * concept of a docroot).
  +     */
       };
   }				/* specweb99_module_init */
   
  @@ -627,7 +627,7 @@
   static int do_housekeeping(request_rec *r)
   {
       struct specweb99_module_data *_my =
  -	ap_get_module_config(r->server->module_config, &specweb99_module);
  +    ap_get_module_config(r->server->module_config, &specweb99_module);
       apr_file_t *f;
       char *data, *key, *val, *line  = "<unset>";
       apr_table_t *tab;
  @@ -642,144 +642,144 @@
       /* we already know args starts with "command/", so skip over that */
       
       if (!strncmp(r->args + 8, "Fetch", 5)) {  
  -	returnHTMLPageWithFile(r, _my->log_path);
  -	return OK;
  +    returnHTMLPageWithFile(r, _my->log_path);
  +    return OK;
       }
       else if ((data = strstr(r->args + 8, "Reset"))) {
  -	/*
  -	 * We are sleeping at least one second - to make sure that any
  -	 * fstat() on mtime will actually yield different values - no matter
  -	 * how closely spaced the Reset's are issued. (in particular the
  -	 * spacing between the test reset from the manager and the reset at
  -	 * the commencing - which normally can be within a second - thus
  -	 * having identical mtime's on platforms with second granularity
  -	 * (Solaris,Linux).
  -	 */
  -	apr_sleep(2 * APR_USEC_PER_SEC);
  +    /*
  +     * We are sleeping at least one second - to make sure that any
  +     * fstat() on mtime will actually yield different values - no matter
  +     * how closely spaced the Reset's are issued. (in particular the
  +     * spacing between the test reset from the manager and the reset at
  +     * the commencing - which normally can be within a second - thus
  +     * having identical mtime's on platforms with second granularity
  +     * (Solaris,Linux).
  +     */
  +    apr_sleep(2 * APR_USEC_PER_SEC);
   
  -	/*
  +    /*
            *           1 
            * 012345678901234
  -	 * command/Reset&maxload=[MaxLoad]&pttime=[PointTime]&maxthreads=[
  -	 * MaxThreads]&exp=[ExpiredList]&urlroot=[UrlRoot]
  -	 */
  -	data += 6;		/* position at start of argument string */
  -	/* Tokenize argument string */
  -	tab = apr_table_make(r->pool, 0);
  -
  -	while (*data && (val = ap_getword(r->pool,
  -					  (const char **) &data, '&'))) {
  -	    key = ap_getword(r->pool, (const char **) &val, '=');
  -	    ap_unescape_url(key);
  -	    ap_unescape_url(val);
  -	    apr_table_set(tab, key, val);
  -	}
  -	/* Put arguments in variables */
  -	maxload = apr_table_get(tab, "maxload");
  -	pointtime = apr_table_get(tab, "pttime");
  -	/*
  -	 * The Run Rules pseudocode is ambivalent about this token name: the
  -	 * pseudocode says 'maxthreads' but its test command a couple of
  -	 * lines down says 'maxthread'. Aside from the question whether we
  -	 * should at all pay attention to the token names, I'm going along
  -	 * with what the manager script sends which is 'maxthread'.
  -	 */
  -	maxthread = apr_table_get(tab, "maxthread");
  -
  -	/*
  -	 * OK, this vexes me. Every shred of documentation about SPECWeb
  -	 * speaks of a comma-separated list of expired ads, but the cadgen99
  -	 * program segfaults if you pass anything but a whitespace- separated
  -	 * list. The Run Rules explicitly state that the pseudo code is the
  -	 * definitive Reference By Which This Module Shall Be Coded, yet I
  -	 * had to yank the following gem from the perl script:
  -	 */
  -	exp = apr_pstrdup(r->pool, apr_table_get(tab, "exp"));
  -	for(c=exp;*c;c++)
  -	    if(*c == ',') *c = ' ';
  -
  -	urlroot = apr_table_get(tab, "urlroot");
  -
  -	/*
  -	 * Prep: we got a URI from the request. Need to parse that, extract
  -	 * the local part and tack that onto docroot.
  -	 */
  -	if ((rv =
  -	     apr_uri_parse(r->pool, urlroot, &urlrootrec)) != APR_SUCCESS) {
  -	    ap_log_error(APLOG_MARK, APLOG_NOERRNO, rv, r->server,
  -			 "The URL Root '%s' was invalid", urlroot);
  -	    returnHTMLPageWithMessage(r, "The UrlRoot passed was invalid");
  -	    return OK;
  -	}
  +     * command/Reset&maxload=[MaxLoad]&pttime=[PointTime]&maxthreads=[
  +     * MaxThreads]&exp=[ExpiredList]&urlroot=[UrlRoot]
  +     */
  +    data += 6;		/* position at start of argument string */
  +    /* Tokenize argument string */
  +    tab = apr_table_make(r->pool, 0);
  +
  +    while (*data && (val = ap_getword(r->pool,
  +                      (const char **) &data, '&'))) {
  +        key = ap_getword(r->pool, (const char **) &val, '=');
  +        ap_unescape_url(key);
  +        ap_unescape_url(val);
  +        apr_table_set(tab, key, val);
  +    }
  +    /* Put arguments in variables */
  +    maxload = apr_table_get(tab, "maxload");
  +    pointtime = apr_table_get(tab, "pttime");
  +    /*
  +     * The Run Rules pseudocode is ambivalent about this token name: the
  +     * pseudocode says 'maxthreads' but its test command a couple of
  +     * lines down says 'maxthread'. Aside from the question whether we
  +     * should at all pay attention to the token names, I'm going along
  +     * with what the manager script sends which is 'maxthread'.
  +     */
  +    maxthread = apr_table_get(tab, "maxthread");
  +
  +    /*
  +     * OK, this vexes me. Every shred of documentation about SPECWeb
  +     * speaks of a comma-separated list of expired ads, but the cadgen99
  +     * program segfaults if you pass anything but a whitespace- separated
  +     * list. The Run Rules explicitly state that the pseudo code is the
  +     * definitive Reference By Which This Module Shall Be Coded, yet I
  +     * had to yank the following gem from the perl script:
  +     */
  +    exp = apr_pstrdup(r->pool, apr_table_get(tab, "exp"));
  +    for(c=exp;*c;c++)
  +        if(*c == ',') *c = ' ';
  +
  +    urlroot = apr_table_get(tab, "urlroot");
  +
  +    /*
  +     * Prep: we got a URI from the request. Need to parse that, extract
  +     * the local part and tack that onto docroot.
  +     */
  +    if ((rv =
  +         apr_uri_parse(r->pool, urlroot, &urlrootrec)) != APR_SUCCESS) {
  +        ap_log_error(APLOG_MARK, APLOG_NOERRNO, rv, r->server,
  +             "The URL Root '%s' was invalid", urlroot);
  +        returnHTMLPageWithMessage(r, "The UrlRoot passed was invalid");
  +        return OK;
  +    }
           if (!urlrootrec.path) {
               urlrootrec.path = "";
           }
  -	rootdir = ap_os_escape_path(r->pool,
  -				    ap_make_full_path(r->pool,
  -						      docroot,
  -						      urlrootrec.path), 0);
  -
  -	/* Call upfgen and cadgen */
  -	/*
  -	 * Keep request arguments around, we need them for eventual response
  -	 */
  -	saveargs = apr_pstrdup(r->pool, r->args);
  -
  -	cmd1 = apr_psprintf(r->pool, "%s -C %s -n %s -t %s",
  -	    _my->upfgen99, docroot, maxload, maxthread);
  -
  -	if((cmd1res = system(cmd1)) != 0) 
  -	    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r->server,
  -		"Call failed %d=%s",cmd1res,cmd1);
  -	else
  -	    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0, r->server,
  -		"Called %s",cmd1);
  -
  -	cmd2 = apr_psprintf(r->pool, "%s -C %s -e %s -t %s %s",
  -	    _my->cadgen99, docroot, pointtime, maxthread, exp);
  -
  -	cmd2res = system(cmd2);
  -
  -	if((cmd1res = system(cmd2)) != 0) 
  -	    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r->server,
  -		"Call failed %d=%s",cmd2res,cmd2);
  -	else
  -	    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0, r->server,
  -		"Called %s",cmd2);
  -
  -	r->args = saveargs;
  -	/*
  -	 * Reset post.log i.e. Truncate, open for writing
  -	 */
  -	if ((rv =
  -	     apr_file_open(&f, _my->log_path, 
  -			   APR_WRITE | APR_CREATE | APR_TRUNCATE,
  -			   APR_OS_DEFAULT, r->pool)) != APR_SUCCESS) {
  -	    ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
  -			 "Could not open post.log '%s' for writing",
  -			 _my->log_path);
  -	    returnHTMLPageWithMessage(r,
  -			      "Error: couldn't open post.log for writing.");
  -	    return OK;
  -	}
  +    rootdir = ap_os_escape_path(r->pool,
  +                    ap_make_full_path(r->pool,
  +                              docroot,
  +                              urlrootrec.path), 0);
  +
  +    /* Call upfgen and cadgen */
  +    /*
  +     * Keep request arguments around, we need them for eventual response
  +     */
  +    saveargs = apr_pstrdup(r->pool, r->args);
  +
  +    cmd1 = apr_psprintf(r->pool, "%s -C %s -n %s -t %s",
  +        _my->upfgen99, docroot, maxload, maxthread);
  +
  +    if((cmd1res = system(cmd1)) != 0) 
  +        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r->server,
  +        "Call failed %d=%s",cmd1res,cmd1);
  +    else
  +        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0, r->server,
  +        "Called %s",cmd1);
  +
  +    cmd2 = apr_psprintf(r->pool, "%s -C %s -e %s -t %s %s",
  +        _my->cadgen99, docroot, pointtime, maxthread, exp);
  +
  +    cmd2res = system(cmd2);
  +
  +    if((cmd1res = system(cmd2)) != 0) 
  +        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r->server,
  +        "Call failed %d=%s",cmd2res,cmd2);
  +    else
  +        ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, 0, r->server,
  +        "Called %s",cmd2);
  +
  +    r->args = saveargs;
  +    /*
  +     * Reset post.log i.e. Truncate, open for writing
  +     */
  +    if ((rv =
  +         apr_file_open(&f, _my->log_path, 
  +               APR_WRITE | APR_CREATE | APR_TRUNCATE,
  +               APR_OS_DEFAULT, r->pool)) != APR_SUCCESS) {
  +        ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
  +             "Could not open post.log '%s' for writing",
  +             _my->log_path);
  +        returnHTMLPageWithMessage(r,
  +                  "Error: couldn't open post.log for writing.");
  +        return OK;
  +    }
   
  -	line = apr_psprintf(r->pool, "%10d\n", 0);
  +    line = apr_psprintf(r->pool, "%10d\n", 0);
   
           rv = apr_file_write_full(f, line, strlen(line), NULL);
           if (rv != APR_SUCCESS) {
               ap_log_rerror(APLOG_MARK, APLOG_ERR, rv, r,
  -			 "Could not write to post.log '%s'", _my->log_path);
  -	    returnHTMLPageWithMessage(r,
  -				      "Error: could not write to post.log.");
  -	}
  -	else {
  -	    returnHTMLPageWithMessage(r, "%s\n%d\n%s\n%d\n",
  -		cmd1,cmd1res,cmd2,cmd2res);
  -	}
  +             "Could not write to post.log '%s'", _my->log_path);
  +        returnHTMLPageWithMessage(r,
  +                      "Error: could not write to post.log.");
  +    }
  +    else {
  +        returnHTMLPageWithMessage(r, "%s\n%d\n%s\n%d\n",
  +        cmd1,cmd1res,cmd2,cmd2res);
  +    }
   
  -	apr_file_close(f);
  +    apr_file_close(f);
   
  -	return OK;
  +    return OK;
       }				/* Reset Command */
   
       /* Fall through */
  @@ -829,12 +829,12 @@
       Y = apr_psprintf(r->pool, "%1d", adid % 9);
   
       if ((rv = apr_stat(&s, fname, APR_FINFO_SIZE, r->pool)) != APR_SUCCESS)
  -	return NULL;
  +    return NULL;
   
       if ((rv =
  -	 apr_file_open(&f, fname, APR_READ, APR_OS_DEFAULT,
  -		       r->pool)) != APR_SUCCESS)
  -	return NULL;
  +     apr_file_open(&f, fname, APR_READ, APR_OS_DEFAULT,
  +               r->pool)) != APR_SUCCESS)
  +    return NULL;
   
       len = s.size;
       buf = apr_palloc(r->pool, len + 1);
  @@ -844,8 +844,8 @@
        * oprofile shows a lot of samples in file_read_actor in the Linux kernel.
        */
       if (((rv = apr_file_read_full(f, buf, len, &l)) != APR_SUCCESS)
  -	|| (l != len))
  -	return NULL;		/* Error on read */
  +    || (l != len))
  +    return NULL;		/* Error on read */
   
       buf[len] = '\0';            /* Null terminate it so the strstr will
                                    * halt
  @@ -857,17 +857,17 @@
        * disease on todays web pages)?
        */
       while ((index = strstr(index, MARKER)) != NULL) {
  -	/* This lands us a new index */
  +    /* This lands us a new index */
   /* <!WEB99CAD><IMG SRC="/file_set/dirNNNNN/classX_Y">
    * 01234567890123456789012345678901234567890123456789
    *           1         2         3         4          */
  -	for (i = 0; i < 5; i++) {
  -	    *(index + 34 + i) = N[i];
  -	}
  -	*(index + 45) = *X;
  -	*(index + 47) = *Y;
  -	index += 50;		/* Put the index past this marker, continue
  -				 * scanning */
  +    for (i = 0; i < 5; i++) {
  +        *(index + 34 + i) = N[i];
  +    }
  +    *(index + 45) = *X;
  +    *(index + 47) = *Y;
  +    index += 50;		/* Put the index past this marker, continue
  +                 * scanning */
       }
       returnHTMLPageWithBuffer(r, buf, len);
   
  @@ -897,7 +897,7 @@
   
   #ifdef DEBUG
       ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_DEBUG, r->server,
  -		 "Full path is '%s'", filename);
  +         "Full path is '%s'", filename);
   #endif
       /*
        * Calculate UserIndex into User.Personality file UserIndex = MyUser -
  @@ -910,26 +910,26 @@
        */
   
       if (checkUPFile(r->server, r, _my)) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r->server,
  -		     "User personality check failed.");
  -	returnHTMLPageWithMessage(r,
  -			      "Error: User personality file check failed.");
  -	return HTTP_INTERNAL_SERVER_ERROR;
  +    ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r->server,
  +             "User personality check failed.");
  +    returnHTMLPageWithMessage(r,
  +                  "Error: User personality file check failed.");
  +    return HTTP_INTERNAL_SERVER_ERROR;
       }
   
       if (userindex < 0 || userindex >= _my->up_count) {
  -	/* Couldn't find it, so let's make our mark and leave */
  +    /* Couldn't find it, so let's make our mark and leave */
   #ifdef DEBUG
  -	specweb99_debug(r->server, "User record not found");
  +    specweb99_debug(r->server, "User record not found");
   #endif
  -	returnHTMLPageWithMessage(r,
  -	      "User Record %d not found (out of my current range %d .. %d)",
  -				  userindex + 10000, 10000,
  -				  _my->up_count + 10000 - 1);
  -	ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r->server,
  -	      "User Record %d not found (out of my current range %d .. %d)",
  -		     userindex + 10000, 10000, _my->up_count + 10000 - 1);
  -	return OK;
  +    returnHTMLPageWithMessage(r,
  +          "User Record %d not found (out of my current range %d .. %d)",
  +                  userindex + 10000, 10000,
  +                  _my->up_count + 10000 - 1);
  +    ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r->server,
  +          "User Record %d not found (out of my current range %d .. %d)",
  +             userindex + 10000, 10000, _my->up_count + 10000 - 1);
  +    return OK;
       }
   
       userdemographics = _my->up[userindex];
  @@ -940,63 +940,63 @@
   */
       while (1) {
   /*        CombinedDemographics = ( AdDemographics & UserDemographics ) */
  -	combineddemographics =
  -	    (_my->cad[adindex].addemographics) & userdemographics;
  +    combineddemographics =
  +        (_my->cad[adindex].addemographics) & userdemographics;
   /*        Ad_weight = 0 */
  -	ad_weight = 0;
  -	if (combineddemographics & GENDER_MASK) {
  -	    ad_weight += _my->cad[adindex].gen_weightings;
  -	}
  -	if (combineddemographics & AGE_GROUP_MASK) {
  -	    ad_weight += _my->cad[adindex].age_weightings;
  -	}
  -	if (combineddemographics & REGION_MASK) {
  -	    ad_weight += _my->cad[adindex].reg_weightings;
  -	}
  -	if (combineddemographics & INTEREST1_MASK) {
  -	    ad_weight += _my->cad[adindex].int1_weightings;
  -	}
  -	if (combineddemographics & INTEREST2_MASK) {
  -	    ad_weight += _my->cad[adindex].int2_weightings;
  -	}
  -	if (ad_weight >= _my->cad[adindex].minimum_match_value) {
  -	    break;
  -	}
  -	adindex = (adindex + 1) % 360;
  -	if (adindex == last_ad) {
  -	    ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r->server,
  -			 "Ad to expire not found");
  -	    break;
  -	}
  +    ad_weight = 0;
  +    if (combineddemographics & GENDER_MASK) {
  +        ad_weight += _my->cad[adindex].gen_weightings;
  +    }
  +    if (combineddemographics & AGE_GROUP_MASK) {
  +        ad_weight += _my->cad[adindex].age_weightings;
  +    }
  +    if (combineddemographics & REGION_MASK) {
  +        ad_weight += _my->cad[adindex].reg_weightings;
  +    }
  +    if (combineddemographics & INTEREST1_MASK) {
  +        ad_weight += _my->cad[adindex].int1_weightings;
  +    }
  +    if (combineddemographics & INTEREST2_MASK) {
  +        ad_weight += _my->cad[adindex].int2_weightings;
  +    }
  +    if (ad_weight >= _my->cad[adindex].minimum_match_value) {
  +        break;
  +    }
  +    adindex = (adindex + 1) % 360;
  +    if (adindex == last_ad) {
  +        ap_log_error(APLOG_MARK, APLOG_ERR | APLOG_NOERRNO, 0, r->server,
  +             "Ad to expire not found");
  +        break;
  +    }
       }
       expired =
  -	((time((time_t *) NULL) > _my->cad[adindex].expiration_time)) ? 1 : 0;
  +    ((time((time_t *) NULL) > _my->cad[adindex].expiration_time)) ? 1 : 0;
   
       ap_log_error(APLOG_MARK, APLOG_INFO | APLOG_NOERRNO, 0, r->server,
  -		 "Found ad %d : expire %s (%d > %d)",
  -		 adindex, expired ? "yes" : "no",
  -		 (int) time((time_t *) NULL),
  -		 _my->cad[adindex].expiration_time);
  +         "Found ad %d : expire %s (%d > %d)",
  +         adindex, expired ? "yes" : "no",
  +         (int) time((time_t *) NULL),
  +         _my->cad[adindex].expiration_time);
   
       cookie_out = apr_psprintf(r->pool,
  -			    "found_cookie=Ad_id=%d&Ad_weight=%d&Expired=%d",
  -			      adindex, ad_weight, expired);
  +                "found_cookie=Ad_id=%d&Ad_weight=%d&Expired=%d",
  +                  adindex, ad_weight, expired);
       apr_table_setn(r->headers_out, "Set-Cookie", cookie_out);
   
       if ((strstr(filename, "class1") != NULL) ||
  -	(strstr(filename, "class2") != NULL)) {
  -	customadscan(r, filename, adindex);
  +    (strstr(filename, "class2") != NULL)) {
  +    customadscan(r, filename, adindex);
       }
       else {
  -	returnHTMLPageWithFile(r, filename);
  +    returnHTMLPageWithFile(r, filename);
       }
       return OK;
   }
   
   
   static char *_log_and_write(struct request_rec *r, apr_file_t * f,
  -		            char *filename, const char *urlroot, int dirnum,
  -		          int classnum, int filenum, int clientnum, int uid)
  +                    char *filename, const char *urlroot, int dirnum,
  +                  int classnum, int filenum, int clientnum, int uid)
   {
       pid_t pid;
       time_t stamp;
  @@ -1010,25 +1010,25 @@
       pid = getpid();
   
       if ((rv = apr_file_read_full(f, recnumstr, 11, &l)) != APR_SUCCESS)
  -	return "Failed to read recordcount from post.log";
  +    return "Failed to read recordcount from post.log";
   
       recnumstr[11] = '\0';
       recnum = atol(recnumstr) + 1;
   
       if ((rv = apr_file_seek(f, APR_SET, &zero)) != APR_SUCCESS)
  -	return "Failed to seek 0 to post.log";
  +    return "Failed to seek 0 to post.log";
   
       if ((rv=(apr_file_printf(f, "%10d", recnum))) < 0) 
  -	return "Failed to write num to post.log";
  +    return "Failed to write num to post.log";
   
       if ((rv = apr_file_seek(f, APR_END, &zero)) != APR_SUCCESS)
  -	return "Failed to seek end to post.log";
  +    return "Failed to seek end to post.log";
   
       if ((apr_file_printf
  -	 (f, "%10d %10d %10d %5d %2d %2d %10d %-60.60s %10d %10d\n", recnum,
  -	  (int) stamp, (int) pid, dirnum, classnum, filenum, clientnum,
  -	  filename, (int) pid, uid)) < 0)
  -	return "Failed to write record to post.log";
  +     (f, "%10d %10d %10d %5d %2d %2d %10d %-60.60s %10d %10d\n", recnum,
  +      (int) stamp, (int) pid, dirnum, classnum, filenum, clientnum,
  +      filename, (int) pid, uid)) < 0)
  +    return "Failed to write record to post.log";
   
       apr_file_flush(f);
   
  @@ -1072,30 +1072,30 @@
        * affects the pre-run tests: the regular client does send the header.
        */
       if ((type == NULL) || (strcasecmp(type, DEFAULT_ENCTYPE) != 0)) {
  -	ap_log_error(APLOG_MARK,
  -		     APLOG_WARNING | APLOG_NOERRNO, 0,
  -		     r->server,
  -		     "The client didn't send %s as Content-Type. Version "
  -		     "1.02 of the SPECWeb does not do this and thus violates "
  -		     "the HTTP specification. Please apply the following "
  -		     "patch to your manager script and bitch to SPEC that "
  -		     "they fix this:\n%s", DEFAULT_ENCTYPE,
  -		     SPEC_MANAGER_PATCH);
  -	return HTTP_INTERNAL_SERVER_ERROR;
  +    ap_log_error(APLOG_MARK,
  +             APLOG_WARNING | APLOG_NOERRNO, 0,
  +             r->server,
  +             "The client didn't send %s as Content-Type. Version "
  +             "1.02 of the SPECWeb does not do this and thus violates "
  +             "the HTTP specification. Please apply the following "
  +             "patch to your manager script and bitch to SPEC that "
  +             "they fix this:\n%s", DEFAULT_ENCTYPE,
  +             SPEC_MANAGER_PATCH);
  +    return HTTP_INTERNAL_SERVER_ERROR;
       }
   
       if (ap_setup_client_block(r, REQUEST_CHUNKED_ERROR) != OK) {
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r->server,
  -		     "Could not setup client block");
  -	returnHTMLPageWithMessage(r, "Couldn't set up client block");
  -	return HTTP_INTERNAL_SERVER_ERROR;
  +    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r->server,
  +             "Could not setup client block");
  +    returnHTMLPageWithMessage(r, "Couldn't set up client block");
  +    return HTTP_INTERNAL_SERVER_ERROR;
       }
   
       if (!ap_should_client_block(r)) {
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r->server,
  -		     "No POST data");
  -	returnHTMLPageWithMessage(r, "No POST data");
  -	return HTTP_INTERNAL_SERVER_ERROR;
  +    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0, r->server,
  +             "No POST data");
  +    returnHTMLPageWithMessage(r, "No POST data");
  +    return HTTP_INTERNAL_SERVER_ERROR;
       }
   
       length = r->remaining;
  @@ -1103,54 +1103,54 @@
       data = apr_pcalloc(r->pool, length + 1);
   
       while ((len_read =
  -	    ap_get_client_block(r, argsbuffer, sizeof(argsbuffer))) > 0) {
  -	if ((rpos + len_read) > length) {
  -	    rsize = length - rpos;
  -	}
  -	else {
  -	    rsize = len_read;
  -	}
  -	memcpy((char *) data + rpos, argsbuffer, rsize);
  -	rpos += rsize;
  +        ap_get_client_block(r, argsbuffer, sizeof(argsbuffer))) > 0) {
  +    if ((rpos + len_read) > length) {
  +        rsize = length - rpos;
  +    }
  +    else {
  +        rsize = len_read;
  +    }
  +    memcpy((char *) data + rpos, argsbuffer, rsize);
  +    rpos += rsize;
       }
   
       data[length] = '\0';
   
       posterr = 5;		/* Counter to make sure we get all VARiables
  -				 * from the CGI post */
  +                 * from the CGI post */
       while (data) {
  -	const char *p = data;
  +    const char *p = data;
   
  -	data = index(p, '&' /* 0x26 */ );
  -	if (data != NULL)
  -	    *data++ = '\0';
  -
  -	if (strncmp(p, "urlroot=", 8) == 0) {
  -	    urlroot = apr_pstrdup(r->pool, p + 8);
  -	    posterr--;
  -	}
  -	else if (strncmp(p, "dir=", 4) == 0) {
  -	    dirnum = atoi(p + 4);
  -	    posterr--;
  -	}
  -	else if (strncmp(p, "class=", 6) == 0) {
  -	    classnum = atoi(p + 6);
  -	    posterr--;
  -	}
  -	else if (strncmp(p, "num=", 4) == 0) {
  -	    filenum = atoi(p + 4);
  -	    posterr--;
  -	}
  -	else if (strncmp(p, "client=", 7) == 0) {
  -	    clientnum = atoi(p + 7);
  -	    posterr--;
  -	}
  +    data = index(p, '&' /* 0x26 */ );
  +    if (data != NULL)
  +        *data++ = '\0';
  +
  +    if (strncmp(p, "urlroot=", 8) == 0) {
  +        urlroot = apr_pstrdup(r->pool, p + 8);
  +        posterr--;
  +    }
  +    else if (strncmp(p, "dir=", 4) == 0) {
  +        dirnum = atoi(p + 4);
  +        posterr--;
  +    }
  +    else if (strncmp(p, "class=", 6) == 0) {
  +        classnum = atoi(p + 6);
  +        posterr--;
  +    }
  +    else if (strncmp(p, "num=", 4) == 0) {
  +        filenum = atoi(p + 4);
  +        posterr--;
  +    }
  +    else if (strncmp(p, "client=", 7) == 0) {
  +        clientnum = atoi(p + 7);
  +        posterr--;
  +    }
       }
       if (posterr != 0) {
  -	ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0,
  -		     r->server, "Did not get all POST arguments");
  -	returnHTMLPageWithMessage(r, "Did not get all POST arguments");
  -	return HTTP_INTERNAL_SERVER_ERROR;
  +    ap_log_error(APLOG_MARK, APLOG_NOERRNO | APLOG_ERR, 0,
  +             r->server, "Did not get all POST arguments");
  +    returnHTMLPageWithMessage(r, "Did not get all POST arguments");
  +    return HTTP_INTERNAL_SERVER_ERROR;
       }
   
   /*  Filename = [urlroot]/dir[5-digit Dir#]/class[Class#]_[File#]*/
  @@ -1159,50 +1159,50 @@
   /*        would make Filename = /specweb99/file_set/dir00123/class1_1)*/
   
       filename = ap_make_full_path(r->pool,
  -				 docroot, apr_psprintf(r->pool,
  -						  "%s/dir%05d/class%1d_%1d",
  -						       urlroot, dirnum,
  -						       classnum, filenum));
  +                 docroot, apr_psprintf(r->pool,
  +                          "%s/dir%05d/class%1d_%1d",
  +                               urlroot, dirnum,
  +                               classnum, filenum));
   
       /* Do_atomically (for example, using a file lock or other mutex): */
   
       if ((rv = apr_file_open(&f, _my->log_path, APR_READ | APR_WRITE,
  -			    APR_OS_DEFAULT, r->pool)) != APR_SUCCESS) {
  -	ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
  -		     "Failed to open post.log '%s' for updating",
  -		     _my->log_path);
  -	returnHTMLPageWithMessage(r,
  -			       "Failed to open post.log file for updating");
  -	return HTTP_INTERNAL_SERVER_ERROR;
  +                APR_OS_DEFAULT, r->pool)) != APR_SUCCESS) {
  +    ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
  +             "Failed to open post.log '%s' for updating",
  +             _my->log_path);
  +    returnHTMLPageWithMessage(r,
  +                   "Failed to open post.log file for updating");
  +    return HTTP_INTERNAL_SERVER_ERROR;
       }
   
       if ((rv = _wlock(r->server, r, f, _my->log_path)) != APR_SUCCESS)
  -	returnHTMLPageWithMessage(r, "Failed to lock post.log file");
  +    returnHTMLPageWithMessage(r, "Failed to lock post.log file");
       else {
  -	char *msg =
  -	_log_and_write(r, f, filename, urlroot, dirnum, classnum, filenum,
  -		       clientnum, uid);
  -	if (msg) {
  -	    rv = APR_OS_START_USEERR;
  -	    ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, msg);
  -	    returnHTMLPageWithMessage(r, msg);
  -	}
  +    char *msg =
  +    _log_and_write(r, f, filename, urlroot, dirnum, classnum, filenum,
  +               clientnum, uid);
  +    if (msg) {
  +        rv = APR_OS_START_USEERR;
  +        ap_log_error(APLOG_MARK, APLOG_ERR, 0, r->server, msg);
  +        returnHTMLPageWithMessage(r, msg);
  +    }
       }
   
       if ((rv2 = apr_file_unlock(f)) != APR_SUCCESS) {
  -	if (rv == APR_SUCCESS) {
  -	    rv = rv2;
  -	    ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
  -			 "Failed to unlock %s", filename ? filename : "");
  -	    returnHTMLPageWithMessage(r, "Failed to lock unpost.log file");
  -	}
  +    if (rv == APR_SUCCESS) {
  +        rv = rv2;
  +        ap_log_error(APLOG_MARK, APLOG_ERR, rv, r->server,
  +             "Failed to unlock %s", filename ? filename : "");
  +        returnHTMLPageWithMessage(r, "Failed to lock unpost.log file");
  +    }
       }
   
       apr_file_close(f);
   
       if (rv != APR_SUCCESS)
  -	return HTTP_INTERNAL_SERVER_ERROR;	/* _log_and_write() will have
  -						 * displayed a page already */
  +    return HTTP_INTERNAL_SERVER_ERROR;	/* _log_and_write() will have
  +                         * displayed a page already */
   
       /*
        * CookieString = "my_cookie=<myCookie>"
  @@ -1212,7 +1212,7 @@
        * number.
        */
       apr_table_setn(r->headers_out, "Set-Cookie",
  -		   apr_psprintf(r->pool, "my_cookie=%d", uid));
  +           apr_psprintf(r->pool, "my_cookie=%d", uid));
   
       /* 
        * Return HTML Page with File='RootDir/FileName' and Cookie=CookieString
  @@ -1237,8 +1237,8 @@
           char *end;
   #ifdef DEBUG
           specweb99_debug(r->server, ap_psprintf(r->pool,
  -					"Got a cookie: %s",
  -					   cookie_in));
  +                    "Got a cookie: %s",
  +                       cookie_in));
   #endif
           /*
            * Parse Cookie string into MyUser and Last_Ad(cadget). The format of the 
  
  
  

Mime
View raw message