summaryrefslogtreecommitdiff
path: root/ACE/apps/JAWS/clients
diff options
context:
space:
mode:
authorAbdullah Sowayan <sowayan@users.noreply.github.com>2008-06-16 20:26:16 +0000
committerAbdullah Sowayan <sowayan@users.noreply.github.com>2008-06-16 20:26:16 +0000
commitcc7c6f16011d2ce569363573be80d92c9e245ada (patch)
treeea680052c264debca54f5156163d70dbc642b100 /ACE/apps/JAWS/clients
parentf1c997dc84b91b1f3eec3927fa275483e117e3e2 (diff)
downloadATCD-cc7c6f16011d2ce569363573be80d92c9e245ada.tar.gz
Mon Jun 16 20:24:45 UTC 2008 Abdullah Sowayan <abdullah.sowayan@lmco.com>
Diffstat (limited to 'ACE/apps/JAWS/clients')
-rw-r--r--ACE/apps/JAWS/clients/Blobby/Options.cpp11
-rw-r--r--ACE/apps/JAWS/clients/Blobby/blobby.cpp14
-rw-r--r--ACE/apps/JAWS/clients/Caching/ID_Generator.cpp4
-rw-r--r--ACE/apps/JAWS/clients/Caching/Local_Locator.cpp218
-rw-r--r--ACE/apps/JAWS/clients/Caching/Locator_Request_Reply.cpp52
-rw-r--r--ACE/apps/JAWS/clients/Caching/URL_Properties.inl2
-rw-r--r--ACE/apps/JAWS/clients/WebSTONE/src/bench.c265
-rw-r--r--ACE/apps/JAWS/clients/WebSTONE/src/cgi-send.c46
-rw-r--r--ACE/apps/JAWS/clients/WebSTONE/src/get.c228
-rw-r--r--ACE/apps/JAWS/clients/WebSTONE/src/getopt.c104
-rw-r--r--ACE/apps/JAWS/clients/WebSTONE/src/nsapi-send.c12
11 files changed, 476 insertions, 480 deletions
diff --git a/ACE/apps/JAWS/clients/Blobby/Options.cpp b/ACE/apps/JAWS/clients/Blobby/Options.cpp
index 08f7de4ad8b..cff24935e4e 100644
--- a/ACE/apps/JAWS/clients/Blobby/Options.cpp
+++ b/ACE/apps/JAWS/clients/Blobby/Options.cpp
@@ -14,7 +14,7 @@ Options *
Options::instance (void)
{
- if (Options::instance_ == 0)
+ if (Options::instance_ == 0)
Options::instance_ = new Options;
return Options::instance_;
@@ -61,15 +61,16 @@ Options::parse_args (int argc, ACE_TCHAR *argv[])
}
if (this->hostname_ == 0 || this->filename_ == 0)
{
- ACE_DEBUG ((LM_DEBUG,
- "%s -h hostname -f filename -[r/w] [-p port] [-l length] [-o offset] [-d]\n",
- argv[0]));
+ ACE_DEBUG ((LM_DEBUG,
+ "%s -h hostname -f filename -[r/w] [-p port] [-l length] [-o offset] [-d]\n",
+ argv[0]));
+
ACE_OS::exit (1);
}
}
-Options::Options (void)
+Options::Options (void)
: hostname_ (0),
port_ (ACE_DEFAULT_HTTP_SERVER_PORT),
filename_ (0),
diff --git a/ACE/apps/JAWS/clients/Blobby/blobby.cpp b/ACE/apps/JAWS/clients/Blobby/blobby.cpp
index e614b049c20..4d6f5802f56 100644
--- a/ACE/apps/JAWS/clients/Blobby/blobby.cpp
+++ b/ACE/apps/JAWS/clients/Blobby/blobby.cpp
@@ -39,14 +39,14 @@ ACE_TMAIN (int argc, ACE_TCHAR *argv[])
// Explain what is going to happen
if (options->debug_)
ACE_DEBUG ((LM_DEBUG,
- ACE_TEXT ("hostname = %C, port = %d, filename = %s, ")
+ ACE_TEXT ("hostname = %C, port = %d, filename = %s, ")
ACE_TEXT ("length = %d, offset = %d, operation = %c\n"),
- options->hostname_,
- options->port_,
- options->filename_,
- options->length_,
- options->offset_,
- options->operation_));
+ options->hostname_,
+ options->port_,
+ options->filename_,
+ options->length_,
+ options->offset_,
+ options->operation_));
// Create a blob
ACE_Blob blob;
diff --git a/ACE/apps/JAWS/clients/Caching/ID_Generator.cpp b/ACE/apps/JAWS/clients/Caching/ID_Generator.cpp
index 6e868611835..c2bde44f71c 100644
--- a/ACE/apps/JAWS/clients/Caching/ID_Generator.cpp
+++ b/ACE/apps/JAWS/clients/Caching/ID_Generator.cpp
@@ -22,7 +22,7 @@ ACE_ID_Generator::get_new_id (char *id)
ACE_ID_Generator::get_serial_id (t, sn);
ACE_NEW_RETURN (id, char [ACE_OFFER_ID_LENGTH], 0);
-
+
ACE_OS::sprintf (id, "%014d%06d", t, sn);
return id;
}
@@ -52,7 +52,7 @@ ACE_ID_Generator::get_lock (void)
// Double-checked Locking Optimization.
if (ACE_ID_Generator::lock_ == 0)
- ACE_NEW_RETURN (ACE_ID_Generator::lock_, ACE_SYNCH_MUTEX, 0);
+ ACE_NEW_RETURN (ACE_ID_Generator::lock_, ACE_SYNCH_MUTEX, 0);
}
#endif /* ACE_HAS_THREADS */
return ACE_ID_Generator::lock_;
diff --git a/ACE/apps/JAWS/clients/Caching/Local_Locator.cpp b/ACE/apps/JAWS/clients/Caching/Local_Locator.cpp
index 2aab4f874d8..1c9df290fbe 100644
--- a/ACE/apps/JAWS/clients/Caching/Local_Locator.cpp
+++ b/ACE/apps/JAWS/clients/Caching/Local_Locator.cpp
@@ -13,10 +13,10 @@ ACE_RCSID(Caching, Local_Locator, "$Id$")
int
ACE_URL_Local_Locator::url_query (const ACE_URL_Locator::ACE_Selection_Criteria how,
- const ACE_URL_Property_Seq *pseq,
- const size_t how_many,
- size_t &num_query,
- ACE_URL_Offer_Seq *offer)
+ const ACE_URL_Property_Seq *pseq,
+ const size_t how_many,
+ size_t &num_query,
+ ACE_URL_Offer_Seq *offer)
{
ACE_URL_Record *item = 0;
@@ -41,27 +41,27 @@ ACE_URL_Local_Locator::url_query (const ACE_URL_Locator::ACE_Selection_Criteria
// implement this using Hash_Map. Better yet, I think we should
// put this in a database and put SQL query here.
for (i_query = 0; found == 0 && i_query < pseq->size (); i_query++)
- for (i_db = 0; i_db < item->offer_->url_properties ().size (); i_db++)
- {
- if ((*pseq)[i_query].name () == item->offer_->url_properties ()[i_db].name ())
- if (how == ACE_URL_Locator::SOME)
+ for (i_db = 0; i_db < item->offer_->url_properties ().size (); i_db++)
+ {
+ if ((*pseq)[i_query].name () == item->offer_->url_properties ()[i_db].name ())
+ if (how == ACE_URL_Locator::SOME)
;
- // if match and Some, copy to <offer>, inc <num_query>, advance iterator
+ // if match and Some, copy to <offer>, inc <num_query>, advance iterator
- // else if All, advance iterator
+ // else if All, advance iterator
- // else if None, check next property in <pseq>.
+ // else if None, check next property in <pseq>.
- if (all properties checked and found and ALL)
- copy to <offer>; inc <num_query>;
- else if (all properties checked and not found and NONE)
- copy to <offer>; inc <num_query>;
- else
- shouldn't happen, internal error
+ if (all properties checked and found and ALL)
+ copy to <offer>; inc <num_query>;
+ else if (all properties checked and not found and NONE)
+ copy to <offer>; inc <num_query>;
+ else
+ shouldn't happen, internal error
if (num_query == how_many)
- break;
+ break;
}
return 0;
@@ -69,7 +69,7 @@ ACE_URL_Local_Locator::url_query (const ACE_URL_Locator::ACE_Selection_Criteria
int
ACE_URL_Local_Locator::export_offer (ACE_URL_Offer *offer,
- ACE_WString &offer_id)
+ ACE_WString &offer_id)
{
ACE_URL_Record *item = 0;
@@ -79,15 +79,15 @@ ACE_URL_Local_Locator::export_offer (ACE_URL_Offer *offer,
iter.advance ())
if (*item->offer_->url () == *offer->url ())
{
- errno = ACE_URL_Locator::OFFER_EXIST;
- return -1;
+ errno = ACE_URL_Locator::OFFER_EXIST;
+ return -1;
}
ACE_URL_Record *new_offer;
// Offer is not in repository, we can add new one in safely.
ACE_NEW_RETURN (new_offer, ACE_URL_Record (offer),
- ACE_URL_Locator::NOMEM);
+ ACE_URL_Locator::NOMEM);
this->repository_.push (*new_offer);
@@ -105,15 +105,15 @@ ACE_URL_Local_Locator::withdraw_offer (const ACE_WString &offer_id)
iter.next (item) != 0;
iter.advance ())
if (offer_id == *item->id_)
- {
- if (this->repository_.remove (*item) == 0)
- return 0
- else
- {
- errno = ACE_URL_Locator::UNKNOWN;
- return -1;
- }
- }
+ {
+ if (this->repository_.remove (*item) == 0)
+ return 0
+ else
+ {
+ errno = ACE_URL_Locator::UNKNOWN;
+ return -1;
+ }
+ }
errno = ACE_URL_Locator::NO_SUCH_OFFER;
return 0;
@@ -121,7 +121,7 @@ ACE_URL_Local_Locator::withdraw_offer (const ACE_WString &offer_id)
int
ACE_URL_Local_Locator::describe_offer (const ACE_WString &offer_id,
- ACE_URL_Offer *offer)
+ ACE_URL_Offer *offer)
{
ACE_URL_Record *item = 0;
@@ -132,8 +132,8 @@ ACE_URL_Local_Locator::describe_offer (const ACE_WString &offer_id,
iter.advance ())
if (offer_id == *item->id_)
{
- ACE_NEW_RETURN (offer, ACE_URL_Offer (*item->offer_), -1);
- return 0;
+ ACE_NEW_RETURN (offer, ACE_URL_Offer (*item->offer_), -1);
+ return 0;
}
errno = ACE_URL_Locator::NO_SUCH_OFFER;
@@ -142,9 +142,9 @@ ACE_URL_Local_Locator::describe_offer (const ACE_WString &offer_id,
int
ACE_URL_Local_Locator::modify_offer (const ACE_WString &offer_id,
- const ACE_WString *url,
- const ACE_URL_Property_Seq *del,
- const ACE_URL_Property_Seq *modify)
+ const ACE_WString *url,
+ const ACE_URL_Property_Seq *del,
+ const ACE_URL_Property_Seq *modify)
{
ACE_Unbounded_Set_Iterator<ACE_URL_Record> iter (this->repository_);
ACE_URL_Record *item = 0;
@@ -155,90 +155,90 @@ ACE_URL_Local_Locator::modify_offer (const ACE_WString &offer_id,
for (; iter.next (item) != 0; iter.advance ())
{
if (url != 0 && *url == item->offer_->url ())
- {
- errno = ACE_URL_Locator::OFFER_EXIST;
- return -1;
- }
+ {
+ errno = ACE_URL_Locator::OFFER_EXIST;
+ return -1;
+ }
if (offer_id == *item->id_)
- target = item;
+ target = item;
}
if (target != 0) // Aha, we found a target to work on
{
if (del != 0 && modify != 0)
- {
- // We need to make a copy of the original property sequence
- // so if any error occurs, we can revert our change easily.
-
- // First we need to calculate the maximum number of perperties.
- int psize = target->offer_->url_properties ().size ();
- if (del != 0)
- if ((psize -= del->size ()) < 0)
- {
- // If you try to delete more properties than we have,
- // you are doomed. No need to proceed.
- errno = ACE_URL_Locator::INVALID_ARGUMENT;
- return -1;
- }
- if (modify != 0)
- // In the worst case, all properties in <modify> will be added.
- psize += modify->size ();
-
- // Now, create a temporary work space.
- ACE_URL_Property_Seq working (psize);
- size_t sz = 0;
- for (; sz < item->offer_->url_properties ().size ())
- working[sz] = item->offer_->url_properties() [sz];
-
- if (del != 0)
- {
- // Argh, this is really a stupid design.
- // Go thru every property we want to delete
- for (size_t i = 0; i < del->size () && sz > 0; i++)
- // For earch, go thru our property sequence and
- // search for the property.
- for (size_t j = 0; j < sz; j++)
- if ((*del)[i].name () == working[j].name ())
- {
- sz -= 1;
- working[j] = working[sz]; // pack the array.
- break;
- }
- // Doesn't generate error when we want to delete an
- // imaginary property. Is this appropriate?
- }
-
- if (modify != 0)
- {
- // This is also stupid.
- // Go thru every property we want to modify/add
- for (size_t i = 0; i < modify->size () && sz > 0; i++)
- {
- // For each property, go thru our property list
- // and search for the matching property
- for (size_t j = 0; j < sz; j++)
- if ((*modify)[i].name () == working[j].name ())
- {
- // A match found.
- working[j].value ((*modify)[i].value ().fast_rep ());
- break;
- }
-
- // No matching property name were found,
- // We want to add this property into the list.
- if (j == sz)
- working[sz++] = (*modify)[i];
- }
- }
- }
+ {
+ // We need to make a copy of the original property sequence
+ // so if any error occurs, we can revert our change easily.
+
+ // First we need to calculate the maximum number of perperties.
+ int psize = target->offer_->url_properties ().size ();
+ if (del != 0)
+ if ((psize -= del->size ()) < 0)
+ {
+ // If you try to delete more properties than we have,
+ // you are doomed. No need to proceed.
+ errno = ACE_URL_Locator::INVALID_ARGUMENT;
+ return -1;
+ }
+ if (modify != 0)
+ // In the worst case, all properties in <modify> will be added.
+ psize += modify->size ();
+
+ // Now, create a temporary work space.
+ ACE_URL_Property_Seq working (psize);
+ size_t sz = 0;
+ for (; sz < item->offer_->url_properties ().size ())
+ working[sz] = item->offer_->url_properties() [sz];
+
+ if (del != 0)
+ {
+ // Argh, this is really a stupid design.
+ // Go thru every property we want to delete
+ for (size_t i = 0; i < del->size () && sz > 0; i++)
+ // For earch, go thru our property sequence and
+ // search for the property.
+ for (size_t j = 0; j < sz; j++)
+ if ((*del)[i].name () == working[j].name ())
+ {
+ sz -= 1;
+ working[j] = working[sz]; // pack the array.
+ break;
+ }
+ // Doesn't generate error when we want to delete an
+ // imaginary property. Is this appropriate?
+ }
+
+ if (modify != 0)
+ {
+ // This is also stupid.
+ // Go thru every property we want to modify/add
+ for (size_t i = 0; i < modify->size () && sz > 0; i++)
+ {
+ // For each property, go thru our property list
+ // and search for the matching property
+ for (size_t j = 0; j < sz; j++)
+ if ((*modify)[i].name () == working[j].name ())
+ {
+ // A match found.
+ working[j].value ((*modify)[i].value ().fast_rep ());
+ break;
+ }
+
+ // No matching property name were found,
+ // We want to add this property into the list.
+ if (j == sz)
+ working[sz++] = (*modify)[i];
+ }
+ }
+ }
// Yes, all operations passed. We can now copy the working version back.
item->offer_->url_properties (ACE_URL_Property_Seq (sz));
for (size_t i = 0; i < sz; i ++)
- item->offer_->url_properties ()[i] = working[i];
+ item->offer_->url_properties ()[i] = working[i];
if (url != 0)
- item->offer_->url (url->fast_rep ()); // replace URL location.
+ item->offer_->url (url->fast_rep ()); // replace URL location.
return 0;
}
errno = ACE_URL_Locator::NO_SUCH_OFFER;
diff --git a/ACE/apps/JAWS/clients/Caching/Locator_Request_Reply.cpp b/ACE/apps/JAWS/clients/Caching/Locator_Request_Reply.cpp
index 6c3f052aedc..7a0aa391b34 100644
--- a/ACE/apps/JAWS/clients/Caching/Locator_Request_Reply.cpp
+++ b/ACE/apps/JAWS/clients/Caching/Locator_Request_Reply.cpp
@@ -18,8 +18,8 @@ ACE_RCSID(Caching, Locator_Request_Reply, "$Id$")
int
ACE_URL_Locator_Request::url_query (const int how,
- const ACE_URL_Property_Seq &pseq,
- const int how_many)
+ const ACE_URL_Property_Seq &pseq,
+ const int how_many)
{
ACE_TRACE ("ACE_URL_Locator_Request::url_query");
@@ -29,19 +29,19 @@ ACE_URL_Locator_Request::url_query (const int how,
this->how_ = how;
this->how_many_ = how_many;
this->code_ = ACE_URL_Locator::QUERY;
- return 0;
+ return 0;
}
int
ACE_URL_Locator_Request::export_offer (const ACE_URL_Offer &offer)
{
ACE_TRACE ("ACE_URL_Locator_Request::export_offer");
-
+
ACE_NEW_RETURN (this->offer_, ACE_URL_Offer (offer), -1);
this->code_ = ACE_URL_Locator::EXPORT;
return 0;
}
-
+
int
ACE_URL_Locator_Request::withdraw_offer (const ACE_WString &offer_id)
{
@@ -56,7 +56,7 @@ int
ACE_URL_Locator_Request::describe_offer (const ACE_WString &offer_id)
{
ACE_TRACE ("ACE_URL_Locator_Request::describe_offer");
-
+
this->id_ = offer_id;
this->code_ = ACE_URL_Locator::DESCRIBE;
return 0;
@@ -64,9 +64,9 @@ ACE_URL_Locator_Request::describe_offer (const ACE_WString &offer_id)
int
ACE_URL_Locator_Request::modify_offer (const ACE_WString &offer_id,
- const ACE_WString *url,
- const ACE_URL_Property_Seq &del,
- const ACE_URL_Property_Seq &modify)
+ const ACE_WString *url,
+ const ACE_URL_Property_Seq &del,
+ const ACE_URL_Property_Seq &modify)
{
ACE_TRACE ("ACE_URL_Locator_Request::modify_offer");
@@ -107,7 +107,7 @@ ACE_URL_Locator_Request::encode (void)
ENCODE_UINT32 (this->buffer_, total_length, this->how_);
// Encode selection criteria.
-
+
ENCODE_UINT32 (this->buffer_, total_length, this->how_many_);
// Encode number of offers interested.
@@ -128,9 +128,9 @@ ACE_URL_Locator_Request::encode (void)
total_length += this->offer_->encode (this->buffer_ + total_length);
total_length += ACE_WString_Helper::encode (this->buffer_ + total_length,
- this->id_);
+ this->id_);
total_length += ACE_WString_Helper::encode (this->buffer_ + total_length,
- this->url_);
+ this->url_);
ACE_ASSERT (total_length == buf_size);
return total_length;
@@ -149,16 +149,16 @@ ACE_URL_Locator_Request::decode (void *buffer)
size_t buf_size;
size_t total_length = 0;
-
+
DECODE_UINT32 (cbuffer, total_length, buf_size);
// Decode length of buffer size first.
DECODE_UINT32 (cbuffer, total_length, this->code_);
// Get the operation code.
-
+
DECODE_UINT32 (cbuffer, total_length, this->how_);
// Decode selection criteria.
-
+
DECODE_UINT32 (cbuffer, total_length, this->how_many_);
// Decode number of offers interested.
@@ -184,7 +184,7 @@ ACE_URL_Locator_Request::decode (void *buffer)
ACE_NEW_RETURN (this->offer_, ACE_URL_Offer, 0);
total_length += this->offer_->decode (cbuffer + total_length);
}
-
+
this->id_ = ACE_WString ((ACE_USHORT16 *) (cbuffer + total_length));
total_length += ACE_WString_Helper::decode (cbuffer + total_length);
this->url_ = ACE_WString ((ACE_USHORT16 *) (cbuffer + total_length));
@@ -223,7 +223,7 @@ ACE_URL_Locator_Request::size (void)
this->valid_ptr_ |= VALID_OFFER;
total_length += this->offer_->size ();
}
-
+
total_length += ACE_WString_Helper::size (this->id_);
total_length += ACE_WString_Helper::size (this->url_);
@@ -269,16 +269,16 @@ ACE_URL_Locator_Request::dump (void) const
if (this->id_.length () > 0)
ACE_DEBUG ((LM_DEBUG, "Offer ID: %s\n",
- ACE_Auto_Basic_Array_Ptr<char> (this->id_.char_rep ()).get ()));
+ ACE_Auto_Basic_Array_Ptr<char> (this->id_.char_rep ()).get ()));
else
ACE_DEBUG ((LM_DEBUG, "Offer ID: \"\"\n"));
if (this->url_.length () > 0)
ACE_DEBUG ((LM_DEBUG, "URL: %s\n",
- ACE_Auto_Basic_Array_Ptr<char> (this->url_.char_rep ()).get ()));
+ ACE_Auto_Basic_Array_Ptr<char> (this->url_.char_rep ()).get ()));
else
ACE_DEBUG ((LM_DEBUG, "URL: \"\"\n"));
-
+
ACE_DEBUG ((LM_DEBUG, ACE_END_DUMP));
}
@@ -294,10 +294,10 @@ ACE_URL_Locator_Reply::status_reply (u_int op, int result)
int
ACE_URL_Locator_Reply::query_reply (int result, size_t num,
- const ACE_URL_Offer_Seq &offers)
+ const ACE_URL_Offer_Seq &offers)
{
ACE_TRACE ("ACE_URL_Locator_Reply::query_reply");
-
+
this->code_ = ACE_URL_Locator::QUERY;
this->status_ = result;
ACE_NEW_RETURN (this->offers_, ACE_URL_Offer_Seq (offers), -1);
@@ -306,7 +306,7 @@ ACE_URL_Locator_Reply::query_reply (int result, size_t num,
int
ACE_URL_Locator_Reply::describe_reply (int result,
- const ACE_URL_Offer &offer)
+ const ACE_URL_Offer &offer)
{
ACE_TRACE ("ACE_URL_Locator_Reply::describe_reply");
@@ -353,7 +353,7 @@ ACE_URL_Locator_Reply::encode (void)
ACE_ASSERT (total_length == buf_size);
return 0;
}
-
+
size_t
ACE_URL_Locator_Reply::decode (void *buffer)
{
@@ -396,11 +396,11 @@ ACE_URL_Locator_Reply::decode (void *buffer)
ACE_NEW_RETURN (this->offers_, ACE_URL_Offer_Seq (n), 0);
total_length += ace_array_decode (cbuffer + total_length, *this->offers_);
}
-
+
ACE_ASSERT (total_length ==buf_size);
return 0;
}
-
+
size_t
ACE_URL_Locator_Reply::size (void)
{
diff --git a/ACE/apps/JAWS/clients/Caching/URL_Properties.inl b/ACE/apps/JAWS/clients/Caching/URL_Properties.inl
index 768ad967d94..c32484dbb5c 100644
--- a/ACE/apps/JAWS/clients/Caching/URL_Properties.inl
+++ b/ACE/apps/JAWS/clients/Caching/URL_Properties.inl
@@ -17,7 +17,7 @@ ACE_URL_Property::ACE_URL_Property (const char *name, const char *value)
ACE_INLINE
ACE_URL_Property::ACE_URL_Property (const ACE_USHORT16 *name,
- const ACE_USHORT16 *value)
+ const ACE_USHORT16 *value)
: name_ (name),
value_ (value)
{
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/bench.c b/ACE/apps/JAWS/clients/WebSTONE/src/bench.c
index ace35460a1d..7139bcf040d 100644
--- a/ACE/apps/JAWS/clients/WebSTONE/src/bench.c
+++ b/ACE/apps/JAWS/clients/WebSTONE/src/bench.c
@@ -44,7 +44,7 @@ void *ptr;
return ptr;
}
-/*
+/*
* Receive n bytes from a socket
*/
int
@@ -53,18 +53,18 @@ recvdata(SOCKET sock, char *ptr, int nbytes) {
int nleft, nread;
nleft = nbytes;
- while (nleft > 0)
+ while (nleft > 0)
{
D_PRINTF( "In recvdata(%d, %d)\n", sock, nleft );
nread = NETREAD(sock, ptr, nleft);
D_PRINTF( "NETREAD() returned %d\n", nread );
if (BADSOCKET(nread) || nread == 0)
- {
- /* return error value NETWRITE */
+ {
+ /* return error value NETWRITE */
D_PRINTF( "Error in recvdata(): %s\n",neterrstr() );
- return(nread);
- }
-
+ return(nread);
+ }
+
D_PRINTF( "NETREAD() data: \"%.*s\"\n", nread, ptr);
nleft -= nread;
ptr += nread;
@@ -90,11 +90,11 @@ senddata(SOCKET sock, char *ptr, int nbytes) {
nwritten = NETWRITE(sock, ptr, nleft);
D_PRINTF( "senddata() returned %d\n", nwritten );
if (BADSOCKET(nwritten))
- {
- /* return error value from NETWRITE */
+ {
+ /* return error value from NETWRITE */
D_PRINTF( "Error in senddata(): %s\n", neterrstr() );
- return(nwritten);
- }
+ return(nwritten);
+ }
nleft -= nwritten;
ptr += nwritten;
}
@@ -110,7 +110,7 @@ senddata(SOCKET sock, char *ptr, int nbytes) {
char *
timeval_to_text(const struct timeval *the_timeval) {
- /*
+ /*
* given a timeval (seconds and microseconds), put the text
* "seconds.microseconds" into timeval_as_text
*/
@@ -120,8 +120,8 @@ timeval_to_text(const struct timeval *the_timeval) {
seconds = the_timeval->tv_sec;
microseconds = the_timeval->tv_usec;
- returnval = sprintf(timeval_as_text,
- "%10d.%6.6d\t", seconds, microseconds);
+ returnval = sprintf(timeval_as_text,
+ "%10d.%6.6d\t", seconds, microseconds);
return timeval_as_text;
}
@@ -139,14 +139,14 @@ double_to_text(const double the_double) {
}
struct timeval
-text_to_timeval(char *timeval_as_text) {
+text_to_timeval(char *timeval_as_text) {
int returnval = 0;
long int seconds, microseconds;
struct timeval the_timeval;
D_PRINTF("T/%d %s\n", (int)timeval_as_text, timeval_as_text);
- returnval = sscanf(timeval_as_text, "%ld.%ld",
- &seconds, &microseconds);
+ returnval = sscanf(timeval_as_text, "%ld.%ld",
+ &seconds, &microseconds);
the_timeval.tv_sec = seconds;
the_timeval.tv_usec = microseconds;
return the_timeval;
@@ -160,7 +160,7 @@ text_to_double(char *double_as_text) {
D_PRINTF("D/%d %s\n", (int)double_as_text, double_as_text);
returnval = sscanf(double_as_text, "%lf", &the_double);
return(the_double);
-}
+}
rqst_stats_t *
@@ -168,61 +168,61 @@ text_to_rqst_stats(char *rqst_stats_as_text) {
THREAD static rqst_stats_t rqst_stats;
rqst_stats_t *the_rqst_stats = &rqst_stats;
- the_rqst_stats->totalresponsetime =
+ the_rqst_stats->totalresponsetime =
text_to_timeval(strtok(rqst_stats_as_text, "\t"));
-
- the_rqst_stats->totalresponsetimesq =
- text_to_double(strtok((char *)0, "\t"));
-
- the_rqst_stats->minresponsetime =
+
+ the_rqst_stats->totalresponsetimesq =
+ text_to_double(strtok((char *)0, "\t"));
+
+ the_rqst_stats->minresponsetime =
text_to_timeval(strtok((char *)0, "\t"));
-
- the_rqst_stats->maxresponsetime =
+
+ the_rqst_stats->maxresponsetime =
text_to_timeval(strtok((char *)0, "\t"));
-
- the_rqst_stats->totalconnecttime =
+
+ the_rqst_stats->totalconnecttime =
text_to_timeval(strtok((char *)0, "\t"));
-
- the_rqst_stats->totalconnecttimesq =
+
+ the_rqst_stats->totalconnecttimesq =
text_to_double(strtok((char *)0, "\t"));
-
- the_rqst_stats->minconnecttime =
+
+ the_rqst_stats->minconnecttime =
text_to_timeval(strtok((char *)0, "\t"));
-
- the_rqst_stats->maxconnecttime =
+
+ the_rqst_stats->maxconnecttime =
text_to_timeval(strtok((char *)0, "\t"));
-
+
the_rqst_stats->totalconnects = (unsigned long)
text_to_double(strtok((char *)0, "\t"));
-
+
the_rqst_stats->totalerrs = (unsigned long)
text_to_double(strtok((char *)0, "\t"));
-
- the_rqst_stats->totalerrortime =
+
+ the_rqst_stats->totalerrortime =
text_to_timeval(strtok((char *)0, "\t"));
-
- the_rqst_stats->totalbytes =
+
+ the_rqst_stats->totalbytes =
text_to_double(strtok((char *)0, "\t"));
-
- the_rqst_stats->totalbytessq =
+
+ the_rqst_stats->totalbytessq =
text_to_double(strtok((char *)0, "\t"));
-
- the_rqst_stats->minbytes =
+
+ the_rqst_stats->minbytes =
text_to_double(strtok((char *)0, "\t"));
-
- the_rqst_stats->maxbytes =
+
+ the_rqst_stats->maxbytes =
text_to_double(strtok((char *)0, "\t"));
-
- the_rqst_stats->totalbody =
+
+ the_rqst_stats->totalbody =
text_to_double(strtok((char *)0, "\t"));
-
- the_rqst_stats->totalbodysq =
+
+ the_rqst_stats->totalbodysq =
text_to_double(strtok((char *)0, "\t"));
-
- the_rqst_stats->minbody =
+
+ the_rqst_stats->minbody =
text_to_double(strtok((char *)0, "\t"));
-
- the_rqst_stats->maxbody =
+
+ the_rqst_stats->maxbody =
text_to_double(strtok((char *)0, "\t"));
return(the_rqst_stats);
@@ -293,15 +293,15 @@ rqst_stats_to_text(rqst_stats_t *the_rqst_stats) {
tmpbuf = double_to_text((the_rqst_stats->maxbody));
strcat(rqst_stats_as_text, tmpbuf);
- D_PRINTF( "rqst_stats_to_text returning %d: %s\n",
- strlen(rqst_stats_as_text),
- rqst_stats_as_text );
+ D_PRINTF("rqst_stats_to_text returning %d: %s\n",
+ strlen(rqst_stats_as_text),
+ rqst_stats_as_text );
return(rqst_stats_as_text);
}
-stats_t *
+stats_t *
text_to_stats(char *stats_as_text) {
int i;
rqst_stats_t *the_rqst_stats;
@@ -314,13 +314,13 @@ text_to_stats(char *stats_as_text) {
the_stats->rs = *the_rqst_stats;
/* grab main structure */
- the_stats->starttime = text_to_timeval(strtok((char *)0, "\t"));
- the_stats->endtime = text_to_timeval(strtok((char *)0, "\t"));
- the_stats->datatime = text_to_timeval(strtok((char *)0, "\t"));
- the_stats->totalpages = (unsigned long) text_to_double(strtok((char *)0, "\t"));
- the_stats->total_num_of_files = (unsigned int) text_to_double(strtok((char *)0, "\t"));
- for (i = 0; i < number_of_pages; i++)
- {
+ the_stats->starttime = text_to_timeval(strtok((char *)0, "\t"));
+ the_stats->endtime = text_to_timeval(strtok((char *)0, "\t"));
+ the_stats->datatime = text_to_timeval(strtok((char *)0, "\t"));
+ the_stats->totalpages = (unsigned long) text_to_double(strtok((char *)0, "\t"));
+ the_stats->total_num_of_files = (unsigned int) text_to_double(strtok((char *)0, "\t"));
+ for (i = 0; i < number_of_pages; i++)
+ {
the_stats->page_numbers[i] = (unsigned int) text_to_double(strtok((char *)0, "\t"));
}
/* return bytes read */
@@ -330,7 +330,7 @@ text_to_stats(char *stats_as_text) {
-char *
+char *
stats_to_text(const stats_t *the_stats) {
int i;
THREAD static char stats_as_text[SIZEOF_STATSTEXT];
@@ -346,24 +346,24 @@ stats_to_text(const stats_t *the_stats) {
/* main structure */
- tmpbuf = timeval_to_text(&(the_stats->starttime));
+ tmpbuf = timeval_to_text(&(the_stats->starttime));
strcat(stats_as_text, tmpbuf);
- tmpbuf = timeval_to_text(&(the_stats->endtime));
+ tmpbuf = timeval_to_text(&(the_stats->endtime));
strcat(stats_as_text, tmpbuf);
-
- tmpbuf = timeval_to_text(&(the_stats->datatime));
+
+ tmpbuf = timeval_to_text(&(the_stats->datatime));
strcat(stats_as_text, tmpbuf);
- tmpbuf = double_to_text((the_stats->totalpages));
+ tmpbuf = double_to_text((the_stats->totalpages));
strcat(stats_as_text, tmpbuf);
- tmpbuf = double_to_text((the_stats->total_num_of_files));
+ tmpbuf = double_to_text((the_stats->total_num_of_files));
strcat(stats_as_text, tmpbuf);
- for (i = 0; i < number_of_pages; i++)
- {
- tmpbuf = double_to_text((the_stats->page_numbers[i]));
+ for (i = 0; i < number_of_pages; i++)
+ {
+ tmpbuf = double_to_text((the_stats->page_numbers[i]));
strcat(stats_as_text, tmpbuf);
}
@@ -384,12 +384,12 @@ text_to_page_stats(char *page_stats_as_text) {
the_rqst_stats = text_to_rqst_stats(page_stats_as_text);
/* grab main structure */
- pagestats->totalpages = (unsigned long) text_to_double(strtok((char *)0, "\t"));
-
- pagestats->page_size = (unsigned int) text_to_double(strtok((char *)0, "\t"));
-
- pagestats->page_valid = (int) text_to_double(strtok((char *)0, "\t"));
-
+ pagestats->totalpages = (unsigned long) text_to_double(strtok((char *)0, "\t"));
+
+ pagestats->page_size = (unsigned int) text_to_double(strtok((char *)0, "\t"));
+
+ pagestats->page_valid = (int) text_to_double(strtok((char *)0, "\t"));
+
pagestats->rs = *the_rqst_stats;
/* return bytes read */
@@ -398,7 +398,7 @@ text_to_page_stats(char *page_stats_as_text) {
-char *
+char *
page_stats_to_text(const page_stats_t *pagestats) {
THREAD static char page_stats_as_text[SIZEOF_PAGESTATSTEXT];
char *tmpbuf;
@@ -412,13 +412,13 @@ page_stats_to_text(const page_stats_t *pagestats) {
strcat(page_stats_as_text, tmpbuf);
/* main structure */
- tmpbuf = double_to_text(pagestats->totalpages);
+ tmpbuf = double_to_text(pagestats->totalpages);
strcat(page_stats_as_text, tmpbuf);
- tmpbuf = double_to_text(pagestats->page_size);
+ tmpbuf = double_to_text(pagestats->page_size);
strcat(page_stats_as_text, tmpbuf);
- tmpbuf = double_to_text(pagestats->page_valid);
+ tmpbuf = double_to_text(pagestats->page_valid);
strcat(page_stats_as_text, tmpbuf);
strcat(page_stats_as_text, "\n");
@@ -479,7 +479,7 @@ rqstat_times(rqst_stats_t *rs, rqst_timer_t *rt)
double t;
compdifftime(&(rt->exittime), &(rt->entertime),
- &(rs->totalresponsetime));
+ &(rs->totalresponsetime));
t = timevaldouble(&(rs->totalresponsetime));
rs->totalresponsetimesq = t * t;
@@ -487,7 +487,7 @@ rqstat_times(rqst_stats_t *rs, rqst_timer_t *rt)
rs->maxresponsetime = rs->totalresponsetime;
compdifftime(&(rt->afterconnect), &(rt->beforeconnect),
- &(rs->totalconnecttime));
+ &(rs->totalconnecttime));
t = timevaldouble(&(rs->totalconnecttime));
rs->totalconnecttimesq = t * t;
@@ -556,80 +556,77 @@ rqstat_fprint(FILE *f, rqst_stats_t *stats)
struct timeval meantime, /*vartime,*/ stdtime;
fprintf(f, "%d connection(s) to server, %d errors\n",
- stats->totalconnects, stats->totalerrs);
+ stats->totalconnects, stats->totalerrs);
if (stats->totalconnects == 0) {
- fprintf(f,"NO CONNECTIONS, THEREFORE NO STATISTICS\n"
- "IS YOUR WEBSERVER RUNNING?\n"
- "DO THE PAGES EXIST ON THE SERVER?\n");
- return;
+ fprintf(f,"NO CONNECTIONS, THEREFORE NO STATISTICS\n"
+ "IS YOUR WEBSERVER RUNNING?\n"
+ "DO THE PAGES EXIST ON THE SERVER?\n");
+ return;
}
/* title */
fprintf(f, "\n\t\t\t Average Std Dev Minimum Maximum\n\n");
/* first line (connect time) */
- avgtime(&(stats->totalconnecttime),
- stats->totalconnects, &meantime);
+ avgtime(&(stats->totalconnecttime),
+ stats->totalconnects, &meantime);
/* variancetime(&(stats->totalconnecttime),
- stats->totalconnecttimesq,
- stats->totalconnects, &vartime); */
+ stats->totalconnecttimesq,
+ stats->totalconnects, &vartime); */
stddevtime(&(stats->totalconnecttime),
- stats->totalconnecttimesq,
- stats->totalconnects, &stdtime);
+ stats->totalconnecttimesq,
+ stats->totalconnects, &stdtime);
fprintf(f, "Connect time (sec) \t%3d.%6.6d %3d.%6.6d %3d.%6.6d %3d.%6.6d\n",
- meantime.tv_sec,
- meantime.tv_usec,
- stdtime.tv_sec,
- stdtime.tv_usec,
- stats->minconnecttime.tv_sec,
- stats->minconnecttime.tv_usec,
- stats->maxconnecttime.tv_sec,
- stats->maxconnecttime.tv_usec);
+ meantime.tv_sec,
+ meantime.tv_usec,
+ stdtime.tv_sec,
+ stdtime.tv_usec,
+ stats->minconnecttime.tv_sec,
+ stats->minconnecttime.tv_usec,
+ stats->maxconnecttime.tv_sec,
+ stats->maxconnecttime.tv_usec);
/* second line (response time) */
- avgtime(&(stats->totalresponsetime),
- stats->totalconnects, &meantime);
+ avgtime(&(stats->totalresponsetime),
+ stats->totalconnects, &meantime);
/* variancetime(&(stats->totalresponsetime),
- stats->totalresponsetimesq,
- stats->totalconnects, &vartime); */
+ stats->totalresponsetimesq,
+ stats->totalconnects, &vartime); */
stddevtime(&(stats->totalresponsetime),
- stats->totalresponsetimesq,
- stats->totalconnects, &stdtime);
+ stats->totalresponsetimesq,
+ stats->totalconnects, &stdtime);
fprintf(f, "Response time (sec) \t%3d.%6.6d %3d.%6.6d %3d.%6.6d %3d.%6.6d\n",
- meantime.tv_sec,
- meantime.tv_usec,
- stdtime.tv_sec,
- stdtime.tv_usec,
- stats->minresponsetime.tv_sec,
- stats->minresponsetime.tv_usec,
- stats->maxresponsetime.tv_sec,
- stats->maxresponsetime.tv_usec);
+ meantime.tv_sec,
+ meantime.tv_usec,
+ stdtime.tv_sec,
+ stdtime.tv_usec,
+ stats->minresponsetime.tv_sec,
+ stats->minresponsetime.tv_usec,
+ stats->maxresponsetime.tv_sec,
+ stats->maxresponsetime.tv_usec);
/* 3rd-5th lines (response size, body size, # bytes moved */
fprintf(f, "Response size (bytes) \t%10.0lf %10.0lf %10.0lf %10.0lf\n",
- mean(stats->totalbytes, stats->totalconnects),
- stddev(stats->totalbytes, stats->totalbytessq,
- stats->totalconnects),
- stats->minbytes,
- stats->maxbytes);
+ mean(stats->totalbytes, stats->totalconnects),
+ stddev(stats->totalbytes, stats->totalbytessq, stats->totalconnects),
+ stats->minbytes,
+ stats->maxbytes);
fprintf(f, "Body size (bytes) \t%10.0lf %10.0lf %10.0lf %10.0lf\n\n",
- mean(stats->totalbody, stats->totalconnects),
- stddev(stats->totalbody, stats->totalbodysq,
- stats->totalconnects),
- stats->minbody,
- stats->maxbody);
+ mean(stats->totalbody, stats->totalconnects),
+ stddev(stats->totalbody, stats->totalbodysq, stats->totalconnects),
+ stats->minbody,
+ stats->maxbody);
fprintf(f, "%.0lf body bytes moved + %.0lf header bytes moved = %.0lf total\n",
- stats->totalbody,
- stats->totalbytes - stats->totalbody,
- stats->totalbytes);
-
+ stats->totalbody,
+ stats->totalbytes - stats->totalbody,
+ stats->totalbytes);
}
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/cgi-send.c b/ACE/apps/JAWS/clients/WebSTONE/src/cgi-send.c
index f1474d34c28..5626836f650 100644
--- a/ACE/apps/JAWS/clients/WebSTONE/src/cgi-send.c
+++ b/ACE/apps/JAWS/clients/WebSTONE/src/cgi-send.c
@@ -15,34 +15,34 @@
int
main()
{
- int filesize;
- char *str_filesize;
- char *buffer;
- int index;
+ int filesize;
+ char *str_filesize;
+ char *buffer;
+ int index;
- printf("Content-type: text/plain\r\n\r\n");
+ printf("Content-type: text/plain\r\n\r\n");
- if ( !(str_filesize = getenv("QUERY_STRING")) )
- filesize = FILE_SIZE;
- else {
- if ( !strncmp(str_filesize, "size=", 5) )
- filesize = atoi(&(str_filesize[5]));
- else
- filesize = FILE_SIZE;
- }
+ if ( !(str_filesize = getenv("QUERY_STRING")) )
+ filesize = FILE_SIZE;
+ else {
+ if ( !strncmp(str_filesize, "size=", 5) )
+ filesize = atoi(&(str_filesize[5]));
+ else
+ filesize = FILE_SIZE;
+ }
- if ( !(buffer = (char *)malloc(filesize)) ) {
- fwrite(MALLOC_FAILURE, strlen(MALLOC_FAILURE), 1, stdout);
- return -1;
- }
+ if ( !(buffer = (char *)malloc(filesize)) ) {
+ fwrite(MALLOC_FAILURE, strlen(MALLOC_FAILURE), 1, stdout);
+ return -1;
+ }
- for (index=0; index< filesize; index++)
- /* generate random characters from A-Z */
- buffer[index] = rand() %26 + 63;
+ for (index=0; index< filesize; index++)
+ /* generate random characters from A-Z */
+ buffer[index] = rand() %26 + 63;
- fwrite(buffer, filesize, 1, stdout);
+ fwrite(buffer, filesize, 1, stdout);
- free(buffer);
+ free(buffer);
- return 0;
+ return 0;
}
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/get.c b/ACE/apps/JAWS/clients/WebSTONE/src/get.c
index 8a6d9232deb..1fd5a31942c 100644
--- a/ACE/apps/JAWS/clients/WebSTONE/src/get.c
+++ b/ACE/apps/JAWS/clients/WebSTONE/src/get.c
@@ -1,15 +1,15 @@
/* $Id$ */
/**************************************************************************
- * *
- * Copyright (C) 1995 Silicon Graphics, Inc. *
- * *
- * These coded instructions, statements, and computer programs were *
- * developed by SGI for public use. If any changes are made to this code*
- * please try to get the changes back to the author. Feel free to make *
- * modifications and changes to the code and release it. *
- * *
+ *
+ * Copyright (C) 1995 Silicon Graphics, Inc.
+ *
+ * These coded instructions, statements, and computer programs were
+ * developed by SGI for public use. If any changes are made to this code
+ * please try to get the changes back to the author. Feel free to make
+ * modifications and changes to the code and release it.
+ *
**************************************************************************/
-
+
/* THIS IS WHERE WE GO OUT AND FETCH A URL */
#include <stdio.h>
@@ -51,13 +51,13 @@
/* compare two strings with max length, ignoring case */
int mystrincmp(const char *str1, const char *str2, int len) {
-register int diff;
+ register int diff;
while (*str1 && *str2 && len--) {
- if (diff = UPPER(*str1) - UPPER(*str2))
- return diff < 0 ? -1 : 1;
- str1++;
- str2++;
+ if (diff = UPPER(*str1) - UPPER(*str2))
+ return diff < 0 ? -1 : 1;
+ str1++;
+ str2++;
}
return 0;
}
@@ -85,52 +85,51 @@ get(char *loc, NETPORT port, char *url, rqst_timer_t *timer)
#ifdef ABORTIVE_CLOSE
#error don't enable this option
struct linger {
- int l_onoff;
- int l_linger;
+ int l_onoff;
+ int l_linger;
} linger_opt;
#endif /* ABORTIVE_CLOSE */
/* can you really get an error from gettimeofday?? */
if(GETTIMEOFDAY(&timer->entertime, &timer->entertimezone) != 0)
{
- returnerr("Error retrieving entertime\n");
- goto error;
+ returnerr("Error retrieving entertime\n");
+ goto error;
}
timer->valid = 1;
if(GETTIMEOFDAY(&timer->beforeconnect, &timer->beforeconnectzone) != 0)
{
- returnerr("Error retrieving beforeconnect\n");
- goto error;
+ returnerr("Error retrieving beforeconnect\n");
+ goto error;
}
sock = connectsock(loc, port, "tcp");
if (BADSOCKET(sock))
{
- D_PRINTF( "Call to connectsock returned %d (%s)\n", sock, neterrstr() );
- returnerr("Couldn't connect to WWW server: %s\n", neterrstr());
- goto error;
+ D_PRINTF( "Call to connectsock returned %d (%s)\n", sock, neterrstr() );
+ returnerr("Couldn't connect to WWW server: %s\n", neterrstr());
+ goto error;
}
-#ifdef ABORTIVE_CLOSE
+#ifdef ABORTIVE_CLOSE
#error don't enable this option
/* set up for abortive close */
linger_opt.l_onoff = 1;
linger_opt.l_linger = 0;
- if (setsockopt(sock, SOL_SOCKET, SO_LINGER,
- (char *) &linger_opt, sizeof(linger_opt)) < 0) {
- fprintf(stderr, "Can't set sockopt SO_LINGER");
- returnerr("Couldn't set SO_LINGER = 0\n");
- goto error;
+ if (setsockopt(sock, SOL_SOCKET, SO_LINGER, (char *) &linger_opt, sizeof(linger_opt)) < 0) {
+ fprintf(stderr, "Can't set sockopt SO_LINGER");
+ returnerr("Couldn't set SO_LINGER = 0\n");
+ goto error;
}
#endif /* ABORTIVE_CLOSE */
if(GETTIMEOFDAY(&timer->afterconnect, &timer->afterconnectzone) != 0)
{
- NETCLOSE(sock);
- GETTIMEOFDAY(&timer->exittime, &timer->exittimezone);
- returnerr("Error retrieving afterconnect\n");
- goto error;
+ NETCLOSE(sock);
+ GETTIMEOFDAY(&timer->exittime, &timer->exittimezone);
+ returnerr("Error retrieving afterconnect\n");
+ goto error;
}
/*
@@ -143,19 +142,19 @@ get(char *loc, NETPORT port, char *url, rqst_timer_t *timer)
status = NETWRITE(sock, getcommand, writelen);
if(status != writelen)
{
- returnerr("Error sending command line to server: %s\n",
- neterrstr());
- goto error;
+ returnerr("Error sending command line to server: %s\n",
+ neterrstr());
+ goto error;
}
- /*
- * WE HAVE NOW SENT THE REQUEST SUCCESSFULLY.
- * WAIT FOR THE REPLY AND FIND THE HEADER
+ /*
+ * WE HAVE NOW SENT THE REQUEST SUCCESSFULLY.
+ * WAIT FOR THE REPLY AND FIND THE HEADER
*/
-
+
if(GETTIMEOFDAY(&timer->beforeheader, &timer->beforeheaderzone) != 0)
{
- returnerr("Error retrieving beforeheader\n");
- goto error;
+ returnerr("Error retrieving beforeheader\n");
+ goto error;
}
/* read the header and part of the file */
@@ -166,57 +165,57 @@ get(char *loc, NETPORT port, char *url, rqst_timer_t *timer)
bytesread = NETREAD(sock, headerbuffer+totalbytesread, HEADERBUFSIZ-totalbytesread);
if (BADSOCKET(bytesread))
{
- D_PRINTF( "Did not receive full header\n" );
- D_PRINTF( "NETREAD returned %d\n", bytesread );
- returnerr("Did not receive full header: %s\n",
- neterrstr());
- goto error;
+ D_PRINTF( "Did not receive full header\n" );
+ D_PRINTF( "NETREAD returned %d\n", bytesread );
+ returnerr("Did not receive full header: %s\n",
+ neterrstr());
+ goto error;
}
totalbytesread += bytesread;
- /* search for end of header */
- headerbuffer[totalbytesread] = 0;
- if (offset = strstr(headerbuffer, "\n\n")) {
- headerlen = offset - headerbuffer + 2;
- break;
- } else if (offset = strstr(headerbuffer, "\n\r\n")) {
- headerlen = offset - headerbuffer + 3;
- break;
- }
+ /* search for end of header */
+ headerbuffer[totalbytesread] = 0;
+ if (offset = strstr(headerbuffer, "\n\n")) {
+ headerlen = offset - headerbuffer + 2;
+ break;
+ } else if (offset = strstr(headerbuffer, "\n\r\n")) {
+ headerlen = offset - headerbuffer + 3;
+ break;
+ }
}
if (headerlen == 0) {
- returnerr("Can't find the end of the header in \"%s\"\n", headerbuffer);
- goto error;
+ returnerr("Can't find the end of the header in \"%s\"\n", headerbuffer);
+ goto error;
}
/* get and check status code from the first line of the header */
count = sscanf(headerbuffer, "HTTP/%s %d", version, &status);
if (count != 2) {
- returnerr("Bad status line in get(): %s\n", headerbuffer);
- goto error;
+ returnerr("Bad status line in get(): %s\n", headerbuffer);
+ goto error;
}
if (status < 200 || status > 300) {
- returnerr("Bad status (%d) in get() for url %s\n", status, url);
- goto error;
+ returnerr("Bad status (%d) in get() for url %s\n", status, url);
+ goto error;
}
/* get the content length line from the header */
offset = headerbuffer;
while (offset < headerbuffer+headerlen && *offset) {
- if (*offset++ != '\n')
- continue;
+ if (*offset++ != '\n')
+ continue;
- if (mystrincmp(offset, CONTENT_LENGTH_STRING, strlen(CONTENT_LENGTH_STRING)) == 0) {
- sscanf(offset+strlen(CONTENT_LENGTH_STRING), "%d", &contentlength);
- D_PRINTF( "Content-Length: %d\n", contentlength );
- }
+ if (mystrincmp(offset, CONTENT_LENGTH_STRING, strlen( CONTENT_LENGTH_STRING)) == 0) {
+ sscanf(offset+strlen(CONTENT_LENGTH_STRING), "%d", &contentlength);
+ D_PRINTF( "Content-Length: %d\n", contentlength );
+ }
}
if(GETTIMEOFDAY(&timer->afterheader, &timer->afterheaderzone) != 0)
{
- returnerr("Error retrieving afterheader\n");
- goto error;
+ returnerr("Error retrieving afterheader\n");
+ goto error;
}
if(savefile)
@@ -224,57 +223,56 @@ get(char *loc, NETPORT port, char *url, rqst_timer_t *timer)
sprintf(outputfilename,"/tmp/webstone.data.%d", (int)getpid());
if((outputfile = open(outputfilename,(O_WRONLY|O_CREAT),0777)) < 0)
{
- D_PRINTF( "outputfile %d %d\n", outputfile, errno );
- returnerr("Error saving file: %s\n", strerror(errno));
- goto error;
+ D_PRINTF( "outputfile %d %d\n", outputfile, errno );
+ returnerr("Error saving file: %s\n", strerror(errno));
+ goto error;
}
- lseek(outputfile,1,SEEK_END); /* this is odd... JEF */
+ lseek(outputfile,1,SEEK_END); /* this is odd... JEF */
- /* if we have part of the file already, save that part */
- if(totalbytesread > headerlen)
- {
- write(outputfile, headerbuffer+headerlen, totalbytesread-headerlen);
- }
+ /* if we have part of the file already, save that part */
+ if(totalbytesread > headerlen)
+ {
+ write(outputfile, headerbuffer+headerlen, totalbytesread-headerlen);
+ }
}
/* read the body of the file */
do
{
- bytesread = NETREAD(sock, headerbuffer, HEADERBUFSIZ);
- D_PRINTF( "Read %d bytes from socket %d\n", bytesread, sock );
+ bytesread = NETREAD(sock, headerbuffer, HEADERBUFSIZ);
+ D_PRINTF( "Read %d bytes from socket %d\n", bytesread, sock );
- if (BADSOCKET(bytesread))
- {
- D_PRINTF( "Read returns %d, error: %s\n", bytesread,
- neterrstr() );
+ if (BADSOCKET(bytesread))
+ {
+ D_PRINTF("Read returns %d, error: %s\n", bytesread,
+ neterrstr() );
returnerr("Error during read of page body. Read "
- "returns %d on socket %d, error: %s\n",
- bytesread, sock, neterrstr());
- goto error;
- }
-
- totalbytesread += bytesread;
+ "returns %d on socket %d, error: %s\n",
+ bytesread, sock, neterrstr());
+ goto error;
+ }
- if (outputfile != -1 && bytesread)
- {
- write(outputfile, headerbuffer, bytesread);
- }
+ totalbytesread += bytesread;
+ if (outputfile != -1 && bytesread)
+ {
+ write(outputfile, headerbuffer, bytesread);
+ }
} while (bytesread);
-
+
/* done reading body */
if ( contentlength && (totalbytesread - headerlen) != contentlength)
{
- D_PRINTF( "Warning: file length (%d) doesn't match Content-length (%d)\n",
- totalbytesread - headerlen, contentlength);
+ D_PRINTF( "Warning: file length (%d) doesn't match Content-length (%d)\n",
+ totalbytesread - headerlen, contentlength);
}
-
+
bodylength = totalbytesread - headerlen;
if(GETTIMEOFDAY(&timer->afterbody, &timer->afterbodyzone) != 0)
{
- returnerr("Error retrieving afterbody\n");
- goto error;
+ returnerr("Error retrieving afterbody\n");
+ goto error;
}
NETCLOSE(sock);
@@ -283,28 +281,28 @@ get(char *loc, NETPORT port, char *url, rqst_timer_t *timer)
close(outputfile);
}
- D_PRINTF( "Read %d bytes, %d of that being body\n",
- totalbytesread, bodylength );
+ D_PRINTF("Read %d bytes, %d of that being body\n",
+ totalbytesread, bodylength );
if(GETTIMEOFDAY(&timer->exittime, &timer->exittimezone) != 0)
{
- D_PRINTF( "Error retrieving exit time: %s\n", strerror(errno) );
- returnerr("Error retrieving exit time\n");
- goto error;
+ D_PRINTF( "Error retrieving exit time: %s\n", strerror(errno) );
+ returnerr("Error retrieving exit time\n");
+ goto error;
}
timer->valid = 2;
timer->totalbytes = totalbytesread;
timer->bodybytes = bodylength;
- D_PRINTF( "get returning totalbytes %d body %d valid %d\n",
- timer->totalbytes, timer->bodybytes, timer->valid );
+ D_PRINTF("get returning totalbytes %d body %d valid %d\n",
+ timer->totalbytes, timer->bodybytes, timer->valid );
- D_PRINTF( "get returning start %d, end %d\n",
- timer->entertime.tv_sec, timer->exittime.tv_sec );
+ D_PRINTF("get returning start %d, end %d\n",
+ timer->entertime.tv_sec, timer->exittime.tv_sec );
- D_PRINTF( "get returning connect %d, request %d, header %d, body %d\n",
- timer->afterconnect.tv_sec, timer->beforeheader.tv_sec,
- timer->afterheader.tv_sec, timer->afterbody.tv_sec );
+ D_PRINTF("get returning connect %d, request %d, header %d, body %d\n",
+ timer->afterconnect.tv_sec, timer->beforeheader.tv_sec,
+ timer->afterheader.tv_sec, timer->afterbody.tv_sec );
return 0;
@@ -312,7 +310,7 @@ error:
if (!BADSOCKET(sock))
NETCLOSE(sock);
if (outputfile != -1)
- close(outputfile);
+ close(outputfile);
GETTIMEOFDAY(&timer->exittime, &timer->exittimezone); /* needed? */
return -1;
-}
+}
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/getopt.c b/ACE/apps/JAWS/clients/WebSTONE/src/getopt.c
index d04ea469aa6..a57064531ad 100644
--- a/ACE/apps/JAWS/clients/WebSTONE/src/getopt.c
+++ b/ACE/apps/JAWS/clients/WebSTONE/src/getopt.c
@@ -6,62 +6,62 @@
#include <string.h>
#define MYNULL 0
-#define ERR(s, c) if(opterr){\
- extern size_t strlen();\
- extern int write();\
- char errbuf[2];\
- errbuf[0] = c; errbuf[1] = '\n';\
- (void) write(2, argv[0], strlen(argv[0]));\
- (void) write(2, s, strlen(s));\
- (void) write(2, errbuf, 2);}
+#define ERR(s, c) if(opterr){\
+ extern size_t strlen();\
+ extern int write();\
+ char errbuf[2];\
+ errbuf[0] = c; errbuf[1] = '\n';\
+ (void) write(2, argv[0], strlen(argv[0]));\
+ (void) write(2, s, strlen(s));\
+ (void) write(2, errbuf, 2);}
-int opterr = 1;
-int optind = 1;
-int optopt;
-char *optarg;
+int opterr = 1;
+int optind = 1;
+int optopt;
+char *optarg;
int
getopt(argc, argv, opts)
-int argc;
-char **argv, *opts;
+int argc;
+char **argv, *opts;
{
- static int sp = 1;
- register int c;
- register char *cp;
+ static int sp = 1;
+ register int c;
+ register char *cp;
- if(sp == 1)
- if(optind >= argc ||
- argv[optind][0] != '-' || argv[optind][1] == '\0')
- return(EOF);
- else if(strcmp(argv[optind], "--") == MYNULL) {
- optind++;
- return(EOF);
- }
- optopt = c = argv[optind][sp];
- if(c == ':' || (cp=strchr(opts, c)) == 0) {
- ERR(": unknown option, -", c);
- if(argv[optind][++sp] == '\0') {
- optind++;
- sp = 1;
- }
- return('?');
- }
- if(*++cp == ':') {
- if(argv[optind][sp+1] != '\0')
- optarg = &argv[optind++][sp+1];
- else if(++optind >= argc) {
- ERR(": argument missing for -", c);
- sp = 1;
- return('?');
- } else
- optarg = argv[optind++];
- sp = 1;
- } else {
- if(argv[optind][++sp] == '\0') {
- sp = 1;
- optind++;
- }
- optarg = 0;
- }
- return(c);
+ if(sp == 1)
+ if(optind >= argc ||
+ argv[optind][0] != '-' || argv[optind][1] == '\0')
+ return(EOF);
+ else if(strcmp(argv[optind], "--") == MYNULL) {
+ optind++;
+ return(EOF);
+ }
+ optopt = c = argv[optind][sp];
+ if(c == ':' || (cp=strchr(opts, c)) == 0) {
+ ERR(": unknown option, -", c);
+ if(argv[optind][++sp] == '\0') {
+ optind++;
+ sp = 1;
+ }
+ return('?');
+ }
+ if(*++cp == ':') {
+ if(argv[optind][sp+1] != '\0')
+ optarg = &argv[optind++][sp+1];
+ else if(++optind >= argc) {
+ ERR(": argument missing for -", c);
+ sp = 1;
+ return('?');
+ } else
+ optarg = argv[optind++];
+ sp = 1;
+ } else {
+ if(argv[optind][++sp] == '\0') {
+ sp = 1;
+ optind++;
+ }
+ optarg = 0;
+ }
+ return(c);
}
diff --git a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-send.c b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-send.c
index 70e99d33a87..e87514934d9 100644
--- a/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-send.c
+++ b/ACE/apps/JAWS/clients/WebSTONE/src/nsapi-send.c
@@ -48,7 +48,7 @@
#define HEADERS "HTTP/1.0 200 OK\r\nContent-type: text/html\r\n\r\n"
#ifdef WIN32
-__declspec(dllexport)
+__declspec(dllexport)
#endif
int nsapi_send(pblock *pb, Session *sn, Request *rq)
@@ -63,9 +63,9 @@ int nsapi_send(pblock *pb, Session *sn, Request *rq)
* file size was specified.
*/
if ( !(query_string = pblock_findval("query", rq->reqpb)) )
- filesize = FILE_SIZE;
+ filesize = FILE_SIZE;
else {
- filesize = atoi(&(query_string[5]));
+ filesize = atoi(&(query_string[5]));
}
memcpy(&buffer, HEADERS, sizeof(HEADERS)-1);
@@ -73,16 +73,16 @@ int nsapi_send(pblock *pb, Session *sn, Request *rq)
/* Generate the output */
maxindex = sizeof(HEADERS) + filesize;
for (index=sizeof(HEADERS); index < (maxindex); index++)
- /* generate random characters from A-Z */
+ /* generate random characters from A-Z */
#ifdef IRIX
- buffer[index] = rand_r() % 26 + 63;
+ buffer[index] = rand_r() % 26 + 63;
#else
buffer[index] = rand() %26 + 63;
#endif
/* Send the output */
if (net_write(sn->csd, buffer, sizeof(HEADERS)-1+filesize, 0) == IO_ERROR)
- return REQ_EXIT;
+ return REQ_EXIT;
return REQ_PROCEED;
}