Esempio n. 1
0
int
MHL7Compare::findSegment(HL7MSG* mMsg, const MString& segName)
{
  if (!mMsg)
    return 0;

  if (!segName.size())
    return 0;
  
  char *seg = segName.strData();

  int iResult = HL7FindSegm(mMsg, seg);
  delete [] seg;
  if ((iResult != HL7_OK) && (iResult != HL7_END_OF_STRUCT))
  {
    cout << "HL7Compare: Cannot find the segment: " << segName << endl;
    cout << HL7ErrTxt(mMsg, iResult) << endl;
    return 0;
  }

  if (iResult == HL7_END_OF_STRUCT)
    return 0;

  return 1;
}
Esempio n. 2
0
void SMOnlineRoom::CreateRoom(PacketFunctions& Packet) {
    bool origional_name = true;
    SMOnlineRoom* tmp = NULL;
    int type = Packet.Read1();
    MString title = Packet.ReadNT();
    MString sub = Packet.ReadNT();
    MString passwd = Packet.ReadNT();

    if (!title.empty())
    {
        if (title.size() > m_roomNameLength)
            title = title.substr(0, m_roomNameLength);

        for (unsigned int x = 0; (x < m_joinrooms.size()) && origional_name; ++x)
            if (title == m_joinrooms[x]->m_title)
                origional_name = false;

        if (origional_name) {
            if (type) {
                tmp = new SMOnlineGameRoom(title, sub);
            } else {
                tmp = new SMOnlineRoom(title, sub);
            }

            if (tmp) {
                LOG->Write("Created room");
                if (!passwd.empty())
                    tmp->m_passwd = passwd;
                SERVER->GetRooms().push_back(tmp);
                JoinToRoom(tmp);
                SendRoomList();
            }
        }
    }
}
Esempio n. 3
0
int
MAMessenger::logMsg (MHL7Msg& message, const MString& event, char* hl7Type)
{
  int logdirLen = mLogDir.size() + 1;
  int eventLen = event.size() + 1;
  char logdir[logdirLen];
  char eventstr[eventLen];
  event.safeExport(eventstr, eventLen);
  mLogDir.safeExport(logdir, logdirLen);

  sprintf (mStream, "%s/msg%d_%s.%s", logdir, ++gMsgNumber, eventstr, hl7Type);
  ofstream msgFile (mStream, ios::out | ios::trunc | ios::binary);
  {
    MLogClient logClient;
    char x[512];
    sprintf(x, "Log %s message to: %s", hl7Type, mStream);
    logClient.log(MLogClient::MLOG_VERBOSE, "<no peer>",
		  "MAMessenter::logMsg", __LINE__, x);
  }

  int length=0;
  message.exportToWire (mStream, mStreamSize, length);
  msgFile << mStream << endl;  
  
  return 0;
}
Esempio n. 4
0
MStringS::MStringS(const MString string){
	int size=string.size();
	if (!size) {data=0; return ;}
	data=(short*)new char[size*2+2];
	//MString ret; ret.Reserv(size);
	for(int i=0; i<size; i++) data[i]=ctos(string[i]);
	sz=size; data[sz]=0;
	return ;
}
int BlsChild::send(const MString &data)
{
    if ((m_socket->write(data)) != data.size()) {
        log_error("write to master failed");
        return -1;
    }

    return E_SUCCESS;
}
Esempio n. 6
0
static MString getUrlField(const MString &url, enum http_parser_url_fields field, const http_parser_url &hpu)
{
    int offset  = hpu.field_data[field].off;
    int len     = hpu.field_data[field].len;

    if ( (offset + len) > url.size()) {
        return "";
    }

    return url.substr(offset, len);
}
Esempio n. 7
0
int
MHL7Compare::compareComponents(const MString& segName, const MString& fldExist, const MString& fldNew)
{
  MString fld(fldExist);
  char *Exist = fld.strData();
  fld = fldNew;
  char *New = fld.strData();

  // position pointers at the last element of the fields
  char *pExist = &Exist[fldExist.size()-1]; 
  char *pNew = &New[fldNew.size()-1];

  // move to the last non empty component
  for (; pExist != Exist; pExist--)
    if (*pExist != '^')
      break;

  for (; pNew != New; pNew--)
    if (*pNew != '^')
      break;
  
  while ((pExist > Exist) && (pNew > New))
  {
    if (*pExist != *pNew)
      break;
    pExist--;
    pNew--;
  }

  if (*pExist != *pNew)
  {
    delete [] Exist;
    delete [] New;
    return 0;
  }
    
  delete [] Exist;
  delete [] New;
  return 1;
}
int BlsHttpClient::run()
{
    int ret = E_SUCCESS;
    MString body;

    if ((ret = readHttpHeader(*m_parser, body, *m_socket)) != E_SUCCESS) {
        log_error("BlsHttpClient read Http Header failed, ret=%d", ret);
        return ret;
    }

    // get http host
    MString host = m_parser->host();
    if (host.empty()) {
        log_error("BlsHttpClient Http Header error");\
        return -1;
    }

    MString vhost;
    MString tempStr = "HTTP://" + host + "" + m_parser->url();
    MUrl tempUrl(tempStr);

    if (MUrl::stringIsIp(host)) {
        vhost = tempUrl.queryByKey("vhost");
    }

    if (vhost.empty()) {
        vhost = tempUrl.host();
    }

    if (tempUrl.path().endWith(HTTP_LIVE_FLV_SUFFIX)) {
        MString rtmpStr = "rtmp://" + vhost + ":1935" + tempUrl.path();
        int suffixLen = sizeof(HTTP_LIVE_FLV_SUFFIX);
        rtmpStr = rtmpStr.substr(0, rtmpStr.size() - suffixLen + 1);

        int ret = sendHttpLiveFlv(rtmpStr);
        if (ret != E_SUCCESS) {
            log_trace("Http Live Flv finished.");
        }
    }

    else {

    }

end:
    clean();

    return ret;
}
int BlsChild::processCommand(MString &line)
{
    if (line.empty()) return E_SUCCESS;

    if (line.endWith("\n")) {
        line.erase(line.size()-1, 1);
    }
    log_trace("BlsMasterChannel get line %s", line.c_str());

    MStringList temp = line.split(Internal_CMD_Delimer);
    MString key = temp.at(0);
    MString value = temp.at(1);

    if (key == Internal_CMD_PID) {
        m_pid = value.toInt();
        gs_childs[m_pid] = this;
    } else if (key == Internal_CMD_InternalPort) {
        m_internalPort = value.toInt();
    } else if (key == Internal_CMD_WhoHasBackSource) {
        MRtmpUrl rtmpUrl(value);
        MString url = rtmpUrl.url();

        int port = 0;
        if (gs_sources.contains(url)) {
            port = gs_sources[url]->internalPort();
        }

        if (sendLine(Internal_CMD_WhoHasBackSourceRes, MString::number(port)) != E_SUCCESS) {
            return -1;
        }

        log_trace("--%s:%d", url.c_str(), port);

        if (port == 0) {
            gs_sources[url] = this;
        }
    } else if (key == Internal_CMD_IHasBackSourced) {
        log_warn("%s insert into backsource queue", value.c_str());
        gs_sources[value] = this;
    } else if (key == Internal_CMD_RemoveHasBackSourceRes) {
        log_warn("%s removed from backsource queue", value.c_str());
        gs_sources.erase(value);
    }

    return E_SUCCESS;
}
Esempio n. 10
0
int
MAMessenger::logMsg (MHL7Msg& message, const MString& event, char* hl7Type)
{
  int logdirLen = mLogDir.size() + 1;
  int eventLen = event.size() + 1;
  char logdir[logdirLen];
  char eventstr[eventLen];
  event.safeExport(eventstr, eventLen);
  mLogDir.safeExport(logdir, logdirLen);

  sprintf (mStream, "%s/msg%d_%s.%s", logdir, ++gMsgNumber, eventstr, hl7Type);
  ofstream msgFile (mStream, ios::out | ios::trunc | ios::binary);

  int length=0;
  message.exportToWire (mStream, mStreamSize, length);
  msgFile << mStream << endl;  
  
  cout << "(Analysis Messenger) Logged " << hl7Type << " message to file.\n";

  return 0;
}
Esempio n. 11
0
bool MDir::createDir(const MString &dirName)
{
    // process multi "//" to one "/"
    MString dn = dirName;
    dn.push_back('/');
    dn.replace("//", "/");

    int index = dn.startWith("/") ? 1 : 0;
    for (unsigned int i = index; i < dn.size(); ++i) {
        char &c = dn[i];

        if (c == '/') {
            c = '\0';
            int ret = access(dn.c_str(), F_OK);
            if (ret == 0) {
                c = '/';
                continue;
            }

            ret = mkdir(dn.c_str(), 0744);
            if (ret == 0) {
                c = '/';
                continue;
            }

//            if (errno == ENOENT) {
//                ret = mkdir(dn.c_str(), 0744);
//                if (ret == 0) {
//                    continue;
//                }
//            }

            merrno = errno;
            return false;
        }
    }

    return true;
}
Esempio n. 12
0
MStringList MString::split(const MString &sep)
{
    MString temp(*this);
    MStringList ret;
    if (sep.isEmpty()) {
        return ret;
    }

    while (temp.contains(sep)) {
        size_type index = temp.find(sep);

        MString ss = temp.substr(0, index);
        if (!ss.isEmpty()) {
            ret << ss;
        }
        temp = temp.substr(index + sep.size(), temp.size() - 1);
    }
    if (!temp.isEmpty()) {
        ret << temp;
    }

    return ret;
}
Esempio n. 13
0
int
evaluate(const MString& tstFile, const MString& stdFile,
	 const MString& maskName, bool verbose, int logLevel,
	 const MString& language)
{
  char buf[1024];
  maskName.safeExport(buf, sizeof(buf));

  ifstream  f(buf);
  if (!f) {
    cout << "ERR: Unable to open mask file: " << maskName << endl;
    ::exit(1);
  }

  MDICOMWrapper tstWrapper(tstFile);
  MDICOMWrapper stdWrapper(stdFile);
  MDICOMElementEval eval;

  int rtnValue = 0;

  while (f.getline(buf, sizeof(buf))) {
    if ((buf[0] == '#' || buf[0] == '\n' || buf[0] == '\0'))
      continue;

    int gggg = 0, eeee = 0;
    int seqGGGG = 0, seqEEEE = 0;
    char c = ' ';
    if (::sscanf(buf, "%x %x %x %x %c", &seqGGGG, &seqEEEE, &gggg, &eeee, &c) != 5) {
      seqGGGG = seqEEEE = 0;
      if (::sscanf(buf, "%x %x %c", &gggg, &eeee, &c) != 3) {
	cout << "ERR: Mask file lines should be <gggg eeee c>: " << buf << endl;
	cout << "ERR:  or <gggg eeee gggg eeee c>" << buf << endl;
	::exit(1);
      }
    }
    DCM_TAG seqTag = DCM_MAKETAG(seqGGGG, seqEEEE);
    DCM_TAG tag = DCM_MAKETAG(gggg, eeee);
    MString tstString;
    MString stdString;

    bool attributePresent = false;
    DCM_ELEMENT e;
    ::memset(&e, 0, sizeof(e));
    e.tag = tag;
    ::DCM_LookupElement(&e);
    ::COND_PopCondition(TRUE);

    if (seqGGGG == 0x0000) {
      if (tstWrapper.attributePresent(tag))
	attributePresent = true;

      tstString = tstWrapper.getString(tag);
      stdString = stdWrapper.getString(tag);
    } else {
      tstString = tstWrapper.getString(seqTag, tag);
      stdString = stdWrapper.getString(seqTag, tag);
    }
    if (logLevel >= 3) {
      if (e.representation == DCM_PN) {
	cout << "CTX: " << buf << ":" << tstString << endl;
	cout << "CTX: " << buf << ":" << stdString << endl;
      } else {
	cout << "CTX: " << buf << ":" << tstString << ":" << stdString << endl;
      }
    }

    switch (c) {
    case '=':
      if (seqGGGG == 0x0000) {
	int tmp = 0;
	tmp = eval.evalElement(logLevel, tstWrapper, stdWrapper, tag, language);
	if (tmp != 0) {
	  rtnValue = 1;
	}
      } else {
	if (tstString != stdString) {
	  cout << "ERR: C-Find response failed for an attribute: " << buf << endl;
	  cout << "ERR:  Your value: " << tstString << endl;
	  cout << "ERR:  Expected v: " << stdString << endl;
	  rtnValue = 1;
	}
      }
      break;
    case 'O':
      if (tstString.size() == 0) {
	cout << "WARN: C-Find response examined for optional attribute: " << buf << endl;
	cout << "WARN:  Your response did not contain the value or it was 0-length" << endl;
	cout << "WARN:  This is merely an informative message." << endl;
      }
      break;
    case 'P':
      if (tstString.size() == 0) {
	cout << "ERR: C-Find response expected to find a value for: " << buf << endl;
	cout << "ERR:  Your response did not contain the value or it was 0-length" << endl;
	rtnValue = 1;
      }
      break;
    case 'Z':	// Test for present, but attribute can be zero length
      if (! attributePresent) {
	cout << "ERR: C-Find response expected to find a value for: " << buf << endl;
	cout << "ERR:  Your response did not contain the value" << endl;
	rtnValue = 1;
      }
      break;
    default:
      break;
    }
  }
  return rtnValue;
}
Esempio n. 14
0
void
MHL7Compare::compareFieldValues(const MString& segment, int fldNum,
                                int compNum, int subCompNum)
{
  if (!segment.size())
    return;

  if (subCompNum) {
    // get the sub component

    MString existValue;
    char* pExist = HL7GetSub(mMsgExist, fldNum, 1, compNum, subCompNum);
    if (pExist)
      existValue = pExist;
    else
      existValue = "";

    MString newValue;
    char* pNew   = HL7GetSub(mMsgNew, fldNum, 1, compNum, subCompNum);
    if (pNew)
      newValue = pNew;
    else
      newValue = "";

    if (mLogLevel >= 3) {
      cout << segment << " " << setw(3) << fldNum << " "
	   << setw(3) << compNum << " " << setw(3) << subCompNum << " "
	   << "<" << existValue << "> "
	   << "<" << newValue << "> "
	   << endl;
    }

    if (existValue != newValue) {
      DIFF diff;
      diff.fldNum = fldNum;
      diff.existValue = existValue;
      diff.newValue = newValue;
      diff.comment = "Sub components do not match";
      mDiff.insert (MDiff::value_type (segment, diff) );
      mCount++;
    }
  } else if (compNum) {
    // get the component

    MString existValue;
    char* pExist = HL7GetComp(mMsgExist, fldNum, 1, compNum);
    if (pExist) {
      for (int i = strlen(pExist)-1; i >=0; i--) {
        if (pExist[i] == '\\')
          pExist[i] = 0;
        else
          break;
      }
      existValue = pExist;
    }
    else
      existValue = "";

    MString newValue;
    char* pNew   = HL7GetComp(mMsgNew, fldNum, 1, compNum);
    if (pNew) {
      for (int i = strlen(pNew)-1; i >=0; i--) {
        if (pNew[i] == '\\')
          pNew[i] = 0;
        else
          break;
      }
      newValue = pNew;
    } else {
      newValue = "";
    }

    if (mLogLevel >= 3) {
      cout << segment << " " << setw(3) << fldNum << " "
	   << setw(3) << compNum << " " << setw(3) << subCompNum << " "
	   << "<" << existValue << "> "
	   << "<" << newValue << "> "
	   << endl;
    }

    if (existValue != newValue) {
      DIFF diff;
      diff.fldNum = fldNum;
      diff.existValue = existValue;
      diff.newValue = newValue;
      diff.comment = "Components do not match";
      mDiff.insert (MDiff::value_type (segment, diff) );
      mCount++;
    }
  } else if (fldNum) {
    // get the entire field

    MString existValue;
    char* pExist = HL7GetFld(mMsgExist, fldNum);
    if (pExist) {
      for (int i = strlen(pExist)-1; i >=0; i--) {
        if (pExist[i] == '^' || pExist[i] == '\\')
          pExist[i] = 0;
        else
          break;
      }
      existValue = pExist;
    } else
      existValue = "";

    MString newValue;
    char* pNew   = HL7GetFld(mMsgNew, fldNum);
    if (pNew) {
      for (int i = strlen(pNew)-1; i >=0; i--) {
        if (pNew[i] == '^' || pNew[i] == '\\')
          pNew[i] = 0;
        else
          break;
      }
      newValue = pNew;
    } else {
      newValue = "";
    }

    if (mLogLevel >= 3) {
      cout << segment << " " << setw(3) << fldNum << " "
	   << setw(3) << compNum << " " << setw(3) << subCompNum << " "
	   << "<" << existValue << "> "
	   << "<" << newValue << "> "
	   << endl;
    }

    if (existValue != newValue) {
      DIFF diff;
      diff.fldNum = fldNum;
      diff.existValue = existValue;
      diff.newValue = newValue;
      diff.comment = "Fields do not match";
      mDiff.insert (MDiff::value_type (segment, diff) );
      mCount++;
    }
  } else {
    compareFields(segment);  // compare all the fields
  }
}
Esempio n. 15
0
void
MHL7Compare::initializeFormat(const MString& fileName)
{
  // read the ini file and add segment/field information in the multimap
  // MSegmentInfo (mSegInfo)

  if (!fileName.size())
    return;

  char* fn = fileName.strData();
  ifstream f(fn);
  delete [] fn;

  char buf[1024];
  char *p;
  MString segName;

  memset(buf, 0, sizeof(buf));

  while (f.getline(buf, sizeof(buf)))
  {
    // ignore comments
    if ((buf[0] == '#') || (buf[0] == ' '))
      continue;

    p = buf;
    if (buf[0] == '[') //found a new section
    {
      // get segment name
      p++;
      char *tmp = strchr(p, ']');
      if (tmp != NULL)
      {
        *tmp = 0;
        segName = p;
        *tmp = ']';
      }
    } // endif
    else if (isdigit(buf[0]))
    {
      // get field specific information
      FIELD_INFO fldInfo;
      // get information on a particular field
      int  fldnum = -1, compnum = -1, subcompnum = -1;
      char num[1024];
      memset(num, 0, sizeof(num));
      int i = 0;
 //   while (*p != 0)
      while (1)
      {
        if (!isdigit(*p)) 
        {
          num[i] = 0;
          if (fldnum < 0)
            fldnum = atoi(num);
          else if (compnum < 0)
            compnum = atoi(num);
          else
            subcompnum = atoi(num);

          if (*p == ';')
            break;
          if (*p == 0)
            break;

          i = 0;
          memset(num, 0, sizeof(num));
        }
        else
        {
          num[i] = *p;
          i++;
        }

        if (*p == '.')
          p++;  // move to the next character
        else if ( !isdigit(*p) )
          break;
        else
          p++;
      } // endwhile

      if ( fldnum >  0 )
        fldInfo.fldNum = fldnum;
      else
        fldInfo.fldNum = 0;
      if (compnum > 0)
        fldInfo.compNum = compnum;
      else
        fldInfo.compNum = 0;
      if (subcompnum > 0)
        fldInfo.subCompNum = subcompnum;
      else
        fldInfo.subCompNum = 0;

    // now that we have complete information about a particular field, we can insert
    if (segName.size())
      mSegInfo.insert (MSegmentInfo::value_type (segName, fldInfo) );

    //reinitialize FIELD_INFO struct
    fldInfo.fldNum = 0;
    fldInfo.compNum = 0;
    fldInfo.subCompNum = 0;
 
    memset(buf, 0, sizeof(buf));

    }  // endif
  }  //endwhile
  
  if (!f.eof())
    cout << "Could Not Read From File" << endl;
}
Esempio n. 16
0
bool MString::endWith(const MString &str) const
{
    return find_last_of(str) == (size() - str.size());
}
Esempio n. 17
0
int
MHL7Compare::compare(const MString& existFile, const MString& newFile, int logLevel) 
{
  mLogLevel = logLevel;
  MHL7Factory factory(mBase, mDefinition);

  MHL7Msg* msgExisting = factory.readFromFile(existFile);
  MHL7Msg* msgNew = factory.readFromFile(newFile);

  mMsgExist = msgExisting->getNativeMsg();
  mMsgNew   = msgNew->getNativeMsg();

  compareHL7();

  delete msgExisting;
  delete msgNew;

  return 0;

#if 0
  int baseLen = mBase.size()+1;
  int defLen = mDefinition.size()+1;
  char hl7Base[1024];
  char hl7Definition[30];
  mBase.safeExport(hl7Base, sizeof(hl7Base)-1);
  mDefinition.safeExport(hl7Definition, sizeof(hl7Definition)-1);
 
  if ( !existFile.size() || !newFile.size()) {
    cout << "File Names not properly specified" << endl;
    return -1;
  }

  cout << "Comparing Files: " << existFile << " and " << newFile << endl;

  int fd = 0;
  MString file(existFile);
  char *FullName = file.strData();

  fd = ::open(FullName, O_RDONLY);
  if (fd < 0) {
    cout << "Cannot open file: " << FullName << endl;
    delete [] FullName;
    return -1;
  } 

  // both file extensions should be in "v##" format where ## denotes the version number. e.g ".v22"
//   char *ver = strchr(FullName, '.');
//   if (!ver)
//   {
//     memset(FullName, 0, existFile.size());
//     strcpy(FullName, ".ihe");
//     ver = hl7Definition;
//   }
  
  mFlavorExist = HL7Init(hl7Base, hl7Definition);
  delete [] FullName;
  if (!mFlavorExist) {
    cout << "HL7Init Failed for the Existing Message" << endl;
    return -1;
  }
  mMsgExist = HL7Alloca(mFlavorExist);
  if (!mMsgExist) {
    cout << "HL7Alloca Failed for the Existing Message" << endl;
    HL7Drop(mFlavorExist);
    return -1;
  }
  
  char wire[16384];
  memset(wire, 0, sizeof(wire));
  int bytes = read(fd, wire, sizeof(wire));
  wire[bytes] = 0;

  close (fd);

  while (wire[strlen(wire)-1] != 13)
    wire[strlen(wire)-1] = 0;

  int iResult = HL7ReadMesg(mMsgExist, wire, strlen(wire));
  if (iResult != HL7_OK) {
    cout << "MHL7Compare: Failed to read the Existing message" << endl;
    cout << HL7ErrTxt(mMsgExist, iResult) << endl;
    HL7Free(mMsgExist);
    HL7Drop(mFlavorExist);
    mMsgExist = NULL;
    mFlavorExist = NULL;
    return -1;
  }

  // now read the new file
  fd = 0;
  file = newFile;
  FullName = file.strData();

  fd = open(FullName, O_RDONLY);
  if (fd < 0) {
    cout << "Cannot open file: " << FullName << endl;
    delete [] FullName;
    return -1;
  } 

  // file extension should be in "v##" format where ## denotes the version number. e.g ".v22"

//   ver = strchr(FullName, '.');
//   if (!ver)
//   {
//     memset(FullName, 0, existFile.size());
//     strcpy(FullName, ".ihe");
//     ver = FullName;
//   }

  // ver = hl7Definition;

  mFlavorNew = HL7Init(hl7Base, hl7Definition);
  delete [] FullName;
  if (!mFlavorNew)
  {
    cout << "HL7Init Failed for the New Message" << endl;
    HL7Free(mMsgExist);
    HL7Drop(mFlavorExist);
    return -1;
  }
  mMsgNew = HL7Alloca(mFlavorNew);
  if (!mMsgNew)
  {
    cout << "HL7Alloca Failed for the New Message" << endl;
    HL7Drop(mFlavorNew);
    HL7Free(mMsgExist);
    HL7Drop(mFlavorExist);
    return -1;
  }
  
  memset(wire, 0, sizeof(wire));
  bytes = read(fd, wire, sizeof(wire));
  wire[bytes] = 0;

  close (fd);

  while (wire[strlen(wire)-1] != 13)
    wire[strlen(wire)-1] = 0;

  iResult = HL7ReadMesg(mMsgNew, wire, strlen(wire));
  if (iResult != HL7_OK)
  {
    cout << "MHL7Compare: Failed to read the New message" << endl;
    cout << HL7ErrTxt(mMsgNew, iResult) << endl;
    HL7Free(mMsgExist);
    HL7Drop(mFlavorExist);
    mMsgExist = NULL;
    mFlavorExist = NULL;
    HL7Free(mMsgNew);
    HL7Drop(mFlavorNew);
    mMsgNew = NULL;
    mFlavorNew = NULL;
    return -1;
  }

  // now that we have allocated both messages, compare them
  compareHL7();
#endif
}
Esempio n. 18
0
int main(int argc, char **argv)
{
  MLogClient logClient;
  MLogClient::LOGLEVEL logLevel = MLogClient::MLOG_ERROR;
  int reportLevel = 1;
  bool verbose = false;
  MString tmp;
  int testNumber = 1;
  char logTxt[512] = "";

  while (--argc > 0 && (*++argv)[0] == '-') {
    switch (*(argv[0] + 1)) {
    case 'l':
      argc--; argv++;
      if (argc < 1)
	usage();
      logLevel = (MLogClient::LOGLEVEL)atoi(*argv);
      break;
    case 'r':
      argc--; argv++;
      if (argc < 1)
	usage();
      reportLevel = atoi(*argv);
      break;
    default:
      break;
    }
  }

  if (argc < 1)
    usage();

  //logClient.initialize(logLevel, "mesa_pdi_eval.log");
  logClient.initialize(logLevel, "");
  int rtnStatus = 0;
  MPDIEval e;

  MString directoryName = *argv;
  if (directoryName.size() == 2) {
    if (directoryName.subString(1, 1) == ":") {
      directoryName += "\\";
    }
  }

  strstream s0(logTxt, sizeof(logTxt));
  s0 << "mesa_pdi_eval test number: " << testNumber
     << ", directory: " << directoryName << '\0';
  logClient.log(MLogClient::MLOG_CONVERSATION, MString(logTxt));

  if (e.initialize(directoryName) != 0) {
    logClient.log(MLogClient::MLOG_ERROR,
	MString("Unable to initialize evaluation class; will continue with testing"));
    //return 1;
  }

  testNumber = atoi(argv[1]);

  MString testComment = "";
  MString testDescription = "";
  rtnStatus = e.runTest(testNumber, reportLevel, testDescription, testComment);

  strstream s1(logTxt, sizeof(logTxt));
#if 0
  if (reportLevel >= 3) {
    cout << testDescription << endl;
  }
#endif
  if (rtnStatus == 0) {
    s1 << "mesa_pdi_eval test number: " << testNumber << ": PASS" << '\0';
  } else {
    s1 << "mesa_pdi_eval test number: " << testNumber << ": FAIL" << '\0';
  }
  if (rtnStatus != 0) {
    cout << testComment << endl;
  }
  cout << logTxt << endl;
  //logClient.log(MLogClient::MLOG_CONVERSATION, MString(logTxt));

  return rtnStatus;
}