Merge pull request #2216 from jwillemsen/jwi-cxxversionchecks
[ACE_TAO.git] / ACE / apps / JAWS / stress_testing / util.cpp
blobf94aab5c8a93b1bc3053200801a69bc36cf4db04
1 #include "util.h"
3 URL::URL(char *input_buf) {
4 char *buffer = new char[BUFSIZ];
6 ACE_OS::strcpy(buffer,input_buf);
7 if(buffer == 0)
8 return;
10 char *temp;
11 char *lasts;
13 if((temp = ACE_OS::strtok_r(buffer,": ",&lasts))) {
14 protocol_ = (char *) ACE_OS::malloc(ACE_OS::strlen(temp) + 1);
15 ACE_OS::strcpy(protocol_, temp);
18 if((temp = ACE_OS::strtok_r(0,"/",&lasts))) {
19 hostname_ = (char *) ACE_OS::malloc(ACE_OS::strlen(temp) + 1);
20 ACE_OS::strcpy(hostname_, temp);
22 if((temp = ACE_OS::strtok_r(0,"\0",&lasts))) {
23 filename_ = (char *) ACE_OS::malloc(ACE_OS::strlen(temp) + 1);
24 ACE_OS::strcpy(filename_, temp);
26 else {
27 filename_ = (char *) ACE_OS::malloc(ACE_OS::strlen(INDEX_NAME) + 1);
28 ACE_OS::strcpy(filename_,INDEX_NAME);
32 char *URL::get_protocol() {
33 return protocol_;
36 char *URL::get_hostname() {
37 return hostname_;
40 char *URL::get_filename() {
41 return filename_;
47 void cleanup() {
48 ACE_OS::unlink(TEMPORARY_FILE_NAME);
49 ACE_OS::unlink(INCOMING_FILE_NAME);
52 void sigint(int) {
53 cleanup();