Exemplo n.º 1
0
/*
 * FancyDoReplace - get strings, search for one, replace with other
 */
vi_rc FancyDoReplace( void )
{
#ifdef __WIN__
    static char *lastReplace;
    vi_rc       rc;
    char        find[MAX_INPUT_LINE + 1], replace[MAX_INPUT_LINE + 1];
    fancy_find  ff;
    bool        is_forward = true;
    bool        old_ci;
    bool        old_sw;

    if( CurrentFile == NULL ) {
        // you cant search if theres no file!
        return( ERR_NO_FILE );
    }

    old_ci = EditFlags.CaseIgnore;
    old_sw = EditFlags.SearchWrap;

    if( lastFind != NULL ) {
        strcpy( find, lastFind );
        ff.use_regexp = lastFindWasRegExp;
        ff.case_ignore = lastFindWasCaseIgnore;
        ff.search_forward = is_forward;
        ff.search_wrap = lastFindWasWrap;
    } else {
        find[0] = 0;
    }
    if( lastReplace != NULL ) {
        strcpy( replace, lastReplace );
    } else {
        replace[0] = 0;
    }
    ff.find = find;
    ff.findlen = sizeof( find );
    ff.replace = replace;
    ff.replacelen = sizeof( replace );

    if( !GetReplaceStringDialog( &ff ) ) {
        return( ERR_NO_ERR );
    }
    EditFlags.CaseIgnore = ff.case_ignore;
    EditFlags.SearchWrap = ff.search_wrap;
    if( !ff.use_regexp ) {
        MakeExpressionNonRegular( find );
        // MakeExpressionNonRegular( replace );
    }
    ReplaceString( &lastReplace, replace );

    EditFlags.LastSearchWasForward = is_forward;

    /*NOTE: does not use is_forward (how about %s?this/that/?)
            does not use selection_only
    */
    rc = TwoPartSubstitute( find, replace, ff.prompt, ff.search_wrap );

    EditFlags.CaseIgnore = old_ci;
    EditFlags.SearchWrap = old_sw;
    lastFindWasRegExp = ff.use_regexp;
    lastFindWasCaseIgnore = ff.case_ignore;
    lastFindWasForward = ff.search_forward;
    lastFindWasWrap = ff.search_wrap;

    return( rc );
#else
    return( ERR_NO_ERR );
#endif

} /* FancyDoReplace */
Exemplo n.º 2
0
void AuxElement::SetSourceEntity(char *NewSourceEntity)
{
	ReplaceString(Data->SourceEntity, NewSourceEntity, 0);
	CheckData();
}
Exemplo n.º 3
0
bool cAuthenticator::AuthWithYggdrasil(AString & a_UserName, const AString & a_ServerId, AString & a_UUID, Json::Value & a_Properties)
{
	LOGD("Trying to authenticate user %s", a_UserName.c_str());

	// Create the GET request:
	AString ActualAddress = m_Address;
	ReplaceString(ActualAddress, "%USERNAME%", a_UserName);
	ReplaceString(ActualAddress, "%SERVERID%", a_ServerId);

	AString Request;
	Request += "GET " + ActualAddress + " HTTP/1.0\r\n";
	Request += "Host: " + m_Server + "\r\n";
	Request += "User-Agent: MCServer\r\n";
	Request += "Connection: close\r\n";
	Request += "\r\n";

	AString Response;
	if (!SecureGetFromAddress(StarfieldCACert(), m_Server, Request, Response))
	{
		return false;
	}

	// Check the HTTP status line:
	const AString Prefix("HTTP/1.1 200 OK");
	AString HexDump;
	if (Response.compare(0, Prefix.size(), Prefix))
	{
		LOGINFO("User %s failed to auth, bad HTTP status line received", a_UserName.c_str());
		LOGD("Response: \n%s", CreateHexDump(HexDump, Response.data(), Response.size(), 16).c_str());
		return false;
	}

	// Erase the HTTP headers from the response:
	size_t idxHeadersEnd = Response.find("\r\n\r\n");
	if (idxHeadersEnd == AString::npos)
	{
		LOGINFO("User %s failed to authenticate, bad HTTP response header received", a_UserName.c_str());
		LOGD("Response: \n%s", CreateHexDump(HexDump, Response.data(), Response.size(), 16).c_str());
		return false;
	}
	Response.erase(0, idxHeadersEnd + 4);

	// Parse the Json response:
	if (Response.empty())
	{
		return false;
	}
	Json::Value root;
	Json::Reader reader;
	if (!reader.parse(Response, root, false))
	{
		LOGWARNING("cAuthenticator: Cannot parse received data (authentication) to JSON!");
		return false;
	}
	a_UserName = root.get("name", "Unknown").asString();
	a_UUID = root.get("id", "").asString();
	a_Properties = root["properties"];

	// If the UUID doesn't contain the hashes, insert them at the proper places:
	if (a_UUID.size() == 32)
	{
		a_UUID.insert(8, "-");
		a_UUID.insert(13, "-");
		a_UUID.insert(18, "-");
		a_UUID.insert(23, "-");
	}

	return true;
}
Exemplo n.º 4
0
void
TclSetEnv(
    const char *name,		/* Name of variable whose value is to be set
				 * (UTF-8). */
    const char *value)		/* New value for variable (UTF-8). */
{
    Tcl_DString envString;
    int index, length, nameLength;
    char *p, *oldValue;
    const char *p2;

    /*
     * Figure out where the entry is going to go. If the name doesn't already
     * exist, enlarge the array if necessary to make room. If the name exists,
     * free its old entry.
     */

    Tcl_MutexLock(&envMutex);
    index = TclpFindVariable(name, &length);

    if (index == -1) {
#ifndef USE_PUTENV
	/*
	 * We need to handle the case where the environment may be changed
	 * outside our control. ourEnvironSize is only valid if the current
	 * environment is the one we allocated. [Bug 979640]
	 */

	if ((env.ourEnviron != environ) || (length+2 > env.ourEnvironSize)) {
	    char **newEnviron = (char **)
		    ckalloc(((unsigned) length + 5) * sizeof(char *));

	    memcpy(newEnviron, environ, length * sizeof(char *));
	    if ((env.ourEnvironSize != 0) && (env.ourEnviron != NULL)) {
		ckfree((char *) env.ourEnviron);
	    }
	    environ = env.ourEnviron = newEnviron;
	    env.ourEnvironSize = length + 5;
	}
	index = length;
	environ[index + 1] = NULL;
#endif /* USE_PUTENV */
	oldValue = NULL;
	nameLength = strlen(name);
    } else {
	const char *env;

	/*
	 * Compare the new value to the existing value. If they're the same
	 * then quit immediately (e.g. don't rewrite the value or propagate it
	 * to other interpreters). Otherwise, when there are N interpreters
	 * there will be N! propagations of the same value among the
	 * interpreters.
	 */

	env = Tcl_ExternalToUtfDString(NULL, environ[index], -1, &envString);
	if (strcmp(value, env + (length + 1)) == 0) {
	    Tcl_DStringFree(&envString);
	    Tcl_MutexUnlock(&envMutex);
	    return;
	}
	Tcl_DStringFree(&envString);

	oldValue = environ[index];
	nameLength = length;
    }

    /*
     * Create a new entry. Build a complete UTF string that contains a
     * "name=value" pattern. Then convert the string to the native encoding,
     * and set the environ array value.
     */

    p = ckalloc((unsigned) nameLength + strlen(value) + 2);
    strcpy(p, name);
    p[nameLength] = '=';
    strcpy(p+nameLength+1, value);
    p2 = Tcl_UtfToExternalDString(NULL, p, -1, &envString);

    /*
     * Copy the native string to heap memory.
     */

    p = ckrealloc(p, strlen(p2) + 1);
    strcpy(p, p2);
    Tcl_DStringFree(&envString);

#ifdef USE_PUTENV
    /*
     * Update the system environment.
     */

    putenv(p);
    index = TclpFindVariable(name, &length);
#else
    environ[index] = p;
#endif /* USE_PUTENV */

    /*
     * Watch out for versions of putenv that copy the string (e.g. VC++). In
     * this case we need to free the string immediately. Otherwise update the
     * string in the cache.
     */

    if ((index != -1) && (environ[index] == p)) {
	ReplaceString(oldValue, p);
#ifdef HAVE_PUTENV_THAT_COPIES
    } else {
	/*
	 * This putenv() copies instead of taking ownership.
	 */

	ckfree(p);
#endif /* HAVE_PUTENV_THAT_COPIES */
    }

    Tcl_MutexUnlock(&envMutex);

    if (!strcmp(name, "HOME")) {
	/*
	 * If the user's home directory has changed, we must invalidate the
	 * filesystem cache, because '~' expansions will now be incorrect.
	 */

	Tcl_FSMountsChanged(NULL);
    }
}
Exemplo n.º 5
0
void cWebAdmin::HandleWebadminRequest(cHTTPConnection & a_Connection, cHTTPRequest & a_Request)
{
	if (!a_Request.HasAuth())
	{
		a_Connection.SendNeedAuth("MCServer WebAdmin");
		return;
	}

	// Check auth:
	AString UserPassword = m_IniFile.GetValue("User:"******"Password", "");
	if ((UserPassword == "") || (a_Request.GetAuthPassword() != UserPassword))
	{
		a_Connection.SendNeedAuth("MCServer WebAdmin - bad username or password");
		return;
	}

	// Check if the contents should be wrapped in the template:
	AString URL = a_Request.GetBareURL();
	ASSERT(URL.length() > 0);
	bool ShouldWrapInTemplate = ((URL.length() > 1) && (URL[1] != '~'));

	// Retrieve the request data:
	cWebadminRequestData * Data = (cWebadminRequestData *)(a_Request.GetUserData());
	if (Data == NULL)
	{
		a_Connection.SendStatusAndReason(500, "Bad UserData");
		return;
	}

	// Wrap it all up for the Lua call:
	AString Template;
	HTTPTemplateRequest TemplateRequest;
	TemplateRequest.Request.Username = a_Request.GetAuthUsername();
	TemplateRequest.Request.Method = a_Request.GetMethod();
	TemplateRequest.Request.Path = URL.substr(1);

	if (Data->m_Form.Finish())
	{
		for (cHTTPFormParser::const_iterator itr = Data->m_Form.begin(), end = Data->m_Form.end(); itr != end; ++itr)
		{
			HTTPFormData HTTPfd;
			HTTPfd.Value = itr->second;
			HTTPfd.Type = "";
			HTTPfd.Name = itr->first;
			TemplateRequest.Request.FormData[itr->first] = HTTPfd;
			TemplateRequest.Request.PostParams[itr->first] = itr->second;
		}  // for itr - Data->m_Form[]

		// Parse the URL into individual params:
		size_t idxQM = a_Request.GetURL().find('?');
		if (idxQM != AString::npos)
		{
			cHTTPFormParser URLParams(cHTTPFormParser::fpkURL, a_Request.GetURL().c_str() + idxQM + 1, a_Request.GetURL().length() - idxQM - 1, *Data);
			URLParams.Finish();
			for (cHTTPFormParser::const_iterator itr = URLParams.begin(), end = URLParams.end(); itr != end; ++itr)
			{
				TemplateRequest.Request.Params[itr->first] = itr->second;
			}  // for itr - URLParams[]
		}
	}

	// Try to get the template from the Lua template script
	if (ShouldWrapInTemplate)
	{
		if (m_TemplateScript.Call("ShowPage", this, &TemplateRequest, cLuaState::Return, Template))
		{
			cHTTPResponse Resp;
			Resp.SetContentType("text/html");
			a_Connection.Send(Resp);
			a_Connection.Send(Template.c_str(), Template.length());
			return;
		}
		a_Connection.SendStatusAndReason(500, "m_TemplateScript failed");
		return;
	}

	AString BaseURL = GetBaseURL(URL);
	AString Menu;
	Template = "{CONTENT}";
	AString FoundPlugin;

	for (PluginList::iterator itr = m_Plugins.begin(); itr != m_Plugins.end(); ++itr)
	{
		cWebPlugin * WebPlugin = *itr;
		std::list< std::pair<AString, AString> > NameList = WebPlugin->GetTabNames();
		for (std::list< std::pair<AString, AString> >::iterator Names = NameList.begin(); Names != NameList.end(); ++Names)
		{
			Menu += "<li><a href='" + BaseURL + WebPlugin->GetWebTitle().c_str() + "/" + (*Names).second + "'>" + (*Names).first + "</a></li>";
		}
	}

	sWebAdminPage Page = GetPage(TemplateRequest.Request);
	AString Content = Page.Content;
	FoundPlugin = Page.PluginName;
	if (!Page.TabName.empty())
	{
		FoundPlugin += " - " + Page.TabName;
	}

	if (FoundPlugin.empty())  // Default page
	{
		Content = GetDefaultPage();
	}

	if (ShouldWrapInTemplate && (URL.size() > 1))
	{
		Content += "\n<p><a href='" + BaseURL + "'>Go back</a></p>";
	}

	int MemUsageKiB = cRoot::GetPhysicalRAMUsage();
	if (MemUsageKiB > 0)
	{
		ReplaceString(Template, "{MEM}",       Printf("%.02f", (double)MemUsageKiB / 1024));
		ReplaceString(Template, "{MEMKIB}",    Printf("%d", MemUsageKiB));
	}
	else
	{
		ReplaceString(Template, "{MEM}",       "unknown");
		ReplaceString(Template, "{MEMKIB}",    "unknown");
	}
	ReplaceString(Template, "{USERNAME}",    a_Request.GetAuthUsername());
	ReplaceString(Template, "{MENU}",        Menu);
	ReplaceString(Template, "{PLUGIN_NAME}", FoundPlugin);
	ReplaceString(Template, "{CONTENT}",     Content);
	ReplaceString(Template, "{TITLE}",       "MCServer");

	AString NumChunks;
	Printf(NumChunks, "%d", cRoot::Get()->GetTotalChunkCount());
	ReplaceString(Template, "{NUMCHUNKS}", NumChunks);

	cHTTPResponse Resp;
	Resp.SetContentType("text/html");
	a_Connection.Send(Resp);
	a_Connection.Send(Template.c_str(), Template.length());
}
void AuxEquipItem::SetActivatedEffectInstanceInfo(char * NewActivatedEffectInstanceInfo)
{
	ReplaceString(Data->ActivatedEffectInstanceInfo, NewActivatedEffectInstanceInfo, 7);
}
void AuxEquipItem::SetBuilderName(char * NewBuilderName)
{
	ReplaceString(Data->BuilderName, NewBuilderName, 9);
}
void AuxPlayerIndex::SetSectorName(char * NewSectorName)
{
    ReplaceString(Data.SectorName, NewSectorName, 14);
}
Exemplo n.º 9
0
void db_lyrdb::GetResults(window_config *wcfg, std::vector<lyric_data>* results, tstring title, tstring artist, tstring album)
{

  title = ReplaceString(_T("&"), _T("and"), title);
  artist = ReplaceString(_T("&"), _T("and"), artist);
  title = ReplaceString(_T("pt."), _T("part"), title);
  artist = ReplaceString(_T("pt."), _T("part"), artist);

  bool useFulltext = false;
  bool found = false;
  tstring out;

  if (!useFulltext)
  {
    out = _T("lookup.php?q=");
    out += CURLEncode::Encode(artist);
    out += _T("|");
    out += CURLEncode::Encode(title);
    out += _T("&for=match&agent=foo_uie_lyrics2");
  }
  else
  {
    out = _T("lookup.php?q=");
    out += CURLEncode::Encode(artist);
    out += _T(" - ");
    out += CURLEncode::Encode(title);
    out += _T("&for=fullt&agent=foo_uie_lyrics2");
  }

  out += _T("&query=plugin&type=plugin");

  tstring remoteText;

  if (!ReadInternetText(remoteText, _T("FOO_UIE_LYRICS2"), _T("webservices.lyrdb.com"), 80, out, _T(""), false, wcfg->cfg_timeout, wcfg) && remoteText != _T(""))
    return ;

  tstring::size_type ptr = 0;

  tstring::size_type end = 0;

  while (true)
  {
    if (ptr >= remoteText.size() || ptr == tstring::npos)
      break;

    end = remoteText.find(_T("\r\n"), ptr);

    if (end == tstring::npos && ptr == 0)
      end = remoteText.size() - 1;

    if (end >= remoteText.size() || end == tstring::npos)
      break;

    tstring line = remoteText.substr(ptr, end + 1 - ptr);

    // parse
    tstring::size_type pos = line.find(_T("\\"));

    if (pos != tstring::npos)
    {
      tstring line_id = line.substr(0, pos);
      tstring line_title = _T("");
      tstring line_artist = _T("");

      if (pos + 1 < line.size())
      {
        tstring::size_type pos2 = line.find(_T("\\"), pos + 1);

        if (pos2 != tstring::npos)
        {
          line_title = line.substr(pos + 1, pos2 - pos + 1);

          if (pos2 + 2 < line.size())
          {
            tstring::size_type pos3 = line.find(_T("\\"), pos2 + 1);

            if (pos3 != tstring::npos)
              line_artist = line.substr(pos2 + 1, pos3 - pos2 + 1);
          }
        }
      }

      lyric_data newData(wcfg);
      newData.SourceType = ST_INTERNET;
      newData.IsLoaded = false;
      newData.IsTimestamped = false;
      newData.matchAlbum = _T("");
      newData.matchArtist = line_artist;
      newData.matchTitle = line_title;
      newData.db = this;
      newData.OnlineService = LD_LYRDB;
      newData.Quality = Q_MEDIUM;
      newData.Source = _T("http://www.lyrdb.com/getlyr.php?q=");
      newData.Source += line_id;

      results->push_back(newData);

    }

    ptr = end + 2;
  }

  return ;
}
void AuxPlayerIndex::SetRegistrationStarbase(char * NewRegistrationStarbase)
{
    ReplaceString(Data.RegistrationStarbase, NewRegistrationStarbase, 12);
}
void AuxPlayerIndex::SetRegistrationStarbaseSector(char * NewRegistrationStarbaseSector)
{
    ReplaceString(Data.RegistrationStarbaseSector, NewRegistrationStarbaseSector, 13);
}
void AuxPlayerIndex::SetCommunityEventFlags(char * NewCommunityEventFlags)
{
    ReplaceString(Data.CommunityEventFlags, NewCommunityEventFlags, 7);
}
Exemplo n.º 13
0
bool is_hexwild(string& s)
{
	string s2=s;
	ReplaceString(s2,"?","");
	return is_hex(s2);
}
void AuxPrimaryCategory::SetName(char * NewName)
{
	ReplaceString(Data->Name, NewName, 0);
    CheckData();
}
Exemplo n.º 15
0
void db_lyricsfly::GetResults(window_config *wcfg, std::vector<lyric_data>* results, tstring title, tstring artist, tstring album)
{
  title = ReplaceString(_T("&"), _T("and"), title);
  artist = ReplaceString(_T("&"), _T("and"), artist);
  title = ReplaceString(_T("pt."), _T("part"), title);
  artist = ReplaceString(_T("pt."), _T("part"), artist);

  tstring out;
  out = _T("api/api.php?i=");
  out += _T("55562032656-reeloo.net/wordpress/lyrics-for-lastfm-radio");
  out += _T("&a=");
  out += CURLEncode::Encode(artist);
  out += _T("&t=");
  out += CURLEncode::Encode(title);

  tstring remoteText;

  if (!ReadInternetText(remoteText, _T("Mozilla/4.0 (compatible) Greasemonkey"), _T("api.lyricsfly.com"), 80, out, _T(""), false, wcfg->cfg_timeout, wcfg))
    return ;

  CMarkup xml;

  if (!xml.SetDoc(remoteText.c_str()))
    return ;

  while (xml.FindChildElem(_T("sg")))
  {
    xml.IntoElem();

    tstring info_artist, info_title, info_album, info_lyrics;

    if (xml.FindChildElem(_T("tx")))
    {
      info_lyrics = xml.GetChildData();
    }
    else
    {
      xml.OutOfElem();
      continue;
    }

    xml.ResetChildPos();

    if (xml.FindChildElem(_T("ar")))
    {
      info_artist = xml.GetChildData();
    }

    xml.ResetChildPos();

    if (xml.FindChildElem(_T("al")))
    {
      info_album = xml.GetChildData();
    }

    xml.ResetChildPos();

    if (xml.FindChildElem(_T("tt")))
    {
      info_title = xml.GetChildData();
    }

    lyric_data newData(wcfg);
    newData.SourceType = ST_INTERNET;
    newData.IsLoaded = true;
    newData.matchArtist = info_artist;
    newData.matchAlbum = info_album;
    newData.matchTitle = info_title;
    newData.db = this;
    newData.OnlineService = LD_LYRICSFLY;
    newData.Quality = Q_MEDIUM;
    newData.Source = _T("lyricsfly");

    newData.Text = info_lyrics;
    newData.Text = ReplaceString(_T("[br]"), _T(""), newData.Text);
    newData.Text = ReplaceString(_T("\r"), _T(""), newData.Text);
    newData.Text = ReplaceString(_T("\n"), _T("\r\n"), newData.Text);

    if (newData.Text.find(_T("[")) != tstring::npos)
      newData.IsTimestamped = true;
    else
      newData.IsTimestamped = false;

    results->push_back(newData);

    xml.OutOfElem();
  }

}
void AuxGroupMember::SetName(char * NewName)
{
	ReplaceString(Data->Name, NewName, 0);
	CheckData();
}
void AuxEquipItem::SetInstanceInfo(char *NewInstanceInfo)
{
	ReplaceString(Data->InstanceInfo, NewInstanceInfo, 6);
}
void AuxReputation::SetData(_Reputation *NewData)
{
	Factions.SetData(&NewData->Factions);
	ReplaceString(Data->Affiliation, NewData->Affiliation, 1);
}
void AuxEquipItem::SetEquipEffectInstanceInfo(char * NewEquipEffectInstanceInfo)
{
	ReplaceString(Data->EquipEffectInstanceInfo, NewEquipEffectInstanceInfo, 8);
}
void AuxReputation::SetAffilitation(char * NewAffiliation)
{
	ReplaceString(Data->Affiliation, NewAffiliation, 1);
}
Exemplo n.º 21
0
void cMojangAPI::CacheUUIDToProfile(const AString & a_UUID)
{
	ASSERT(a_UUID.size() == 32);
	
	// Check if already present:
	{
		if (m_UUIDToProfile.find(a_UUID) != m_UUIDToProfile.end())
		{
			return;
		}
	}
	
	// Create the request address:
	AString Address = m_UUIDToProfileAddress;
	ReplaceString(Address, "%UUID%", a_UUID);
	
	// Create the HTTP request:
	AString Request;
	Request += "GET " + Address + " HTTP/1.0\r\n";  // We need to use HTTP 1.0 because we don't handle Chunked transfer encoding
	Request += "Host: " + m_UUIDToProfileServer + "\r\n";
	Request += "User-Agent: MCServer\r\n";
	Request += "Connection: close\r\n";
	Request += "Content-Length: 0\r\n";
	Request += "\r\n";

	// Get the response from the server:
	AString Response;
	if (!SecureRequest(m_UUIDToProfileServer, Request, Response))
	{
		return;
	}

	// Check the HTTP status line:
	const AString Prefix("HTTP/1.1 200 OK");
	AString HexDump;
	if (Response.compare(0, Prefix.size(), Prefix))
	{
		LOGINFO("%s failed: bad HTTP status line received", __FUNCTION__);
		LOGD("Response: \n%s", CreateHexDump(HexDump, Response.data(), Response.size(), 16).c_str());
		return;
	}

	// Erase the HTTP headers from the response:
	size_t idxHeadersEnd = Response.find("\r\n\r\n");
	if (idxHeadersEnd == AString::npos)
	{
		LOGINFO("%s failed: bad HTTP response header received", __FUNCTION__);
		LOGD("Response: \n%s", CreateHexDump(HexDump, Response.data(), Response.size(), 16).c_str());
		return;
	}
	Response.erase(0, idxHeadersEnd + 4);
	
	// Parse the returned string into Json:
	Json::Reader reader;
	Json::Value root;
	if (!reader.parse(Response, root, false) || !root.isObject())
	{
		LOGWARNING("%s failed: Cannot parse received data (NameToUUID) to JSON!", __FUNCTION__);
		LOGD("Response body:\n%s", CreateHexDump(HexDump, Response.data(), Response.size(), 16).c_str());
		return;
	}

	/* Example response:
	{
		"id": "b1caf24202a841a78055a079c460eee7",
		"name": "xoft",
		"properties":
		[
			{
				"name": "textures",
				"value": "eyJ0aW1lc3RhbXAiOjE0MDcwNzAzMjEyNzEsInByb2ZpbGVJZCI6ImIxY2FmMjQyMDJhODQxYTc4MDU1YTA3OWM0NjBlZWU3IiwicHJvZmlsZU5hbWUiOiJ4b2Z0IiwiaXNQdWJsaWMiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS9iNzc5YmFiZjVhNTg3Zjk0OGFkNjc0N2VhOTEyNzU0MjliNjg4Mjk1YWUzYzA3YmQwZTJmNWJmNGQwNTIifX19",
				"signature": "XCty+jGEF39hEPrPhYNnCX087kPaoCjYruzYI/DS4nkL5hbjnkSM5Rh15hnUyv/FHhC8OF5rif3D1tQjtMI19KSVaXoUFXpbJM8/+PB8GDgEbX8Fc3u9nYkzOcM/xfxdYsFAdFhLQMkvase/BZLSuPhdy9DdI+TCrO7xuSTZfYmmwVuWo3w5gCY+mSIAnqltnOzaOOTcly75xvO0WYpVk7nJdnR2tvSi0wfrQPDrIg/uzhX7p0SnDqijmBU4QaNez/TNKiFxy69dAzt0RSotlQzqkDbyVKhhv9a4eY8h3pXi4UMftKEj4FAKczxLImkukJXuOn5NN15/Q+le0rJVBC60/xjKIVzltEsMN6qjWD0lQjey7WEL+4pGhCVuWY5KzuZjFvgqszuJTFz7lo+bcHiceldJtea8/fa02eTRObZvdLxbWC9ZfFY0IhpOVKfcLdno/ddDMNMQMi5kMrJ8MZZ/PcW1w5n7MMGWPGCla1kOaC55AL0QYSMGRVEZqgU9wXI5M7sHGZKGM4mWxkbEJYBkpI/p3GyxWgV6v33ZWlsz65TqlNrR1gCLaoFCm7Sif8NqPBZUAONHYon0roXhin/DyEanS93WV6i6FC1Wisscjq2AcvnOlgTo/5nN/1QsMbjNumuMGo37sqjRqlXoPb8zEUbAhhztYuJjEfQ2Rd8="
			}
		]
	}
	*/

	// Store the returned result into caches:
	AString PlayerName = root.get("name", "").asString();
	if (PlayerName.empty())
	{
		// No valid playername, bail out
		return;
	}
	Json::Value Properties = root.get("properties", "");
	Int64 Now = time(NULL);
	{
		cCSLock Lock(m_CSUUIDToProfile);
		m_UUIDToProfile[a_UUID] = sProfile(PlayerName, a_UUID, Properties, Now);
	}
	{
		cCSLock Lock(m_CSUUIDToName);
		m_UUIDToName[a_UUID] = sProfile(PlayerName, a_UUID, Properties, Now);
	}
	{
		cCSLock Lock(m_CSNameToUUID);
		m_NameToUUID[StrToLower(PlayerName)] = sProfile(PlayerName, a_UUID, Properties, Now);
	}
	NotifyNameUUID(PlayerName, a_UUID);
}
Exemplo n.º 22
0
Arquivo: mew.c Projeto: redtower/rc
BOOL SelectEmacsen( VOID )
{
  int      nIndex;
  LONG     rret;
  HKEY     hKey,hKey2;
  DWORD    i;
  char     szKeyBuf[260];
  char     szValueBuf[1024];
  DWORD    dwKeyBuf,dwValueBuf;
  FILETIME ft;
  char     *pszEDir;

  /* gathering Emacs infomation... */
  iEmacsenNum=0;
  memset( szEmacsenList, 0, sizeof(szEmacsenList) );

  /* NTEmacs/Meadow */
  pszEDir = getenv("emacs_dir");
  if (pszEDir) {
	  do {
		  /* check NTEmacs */
		  strcpy(szValueBuf, pszEDir);
		  RevConvertPathSeparator(szValueBuf);
		  if (szValueBuf[strlen(szValueBuf)-1] != '\\')
			  strcat(szValueBuf, "\\");
		  strcat(szValueBuf, "bin\\emacs.exe");
		  if (CheckFile(szValueBuf)) {
			  strcpy(szEmacsenList[iEmacsenNum], "NTEmacs (getenv)" );
			  iEmacsenNum++;
		  }
		  /* check Meadow */
		  strcpy(szValueBuf, pszEDir);
		  RevConvertPathSeparator(szValueBuf);
		  if (szValueBuf[strlen(szValueBuf)-1] != '\\')
			  strcat(szValueBuf, "\\");
		  strcat(szValueBuf, "bin\\Meadow.exe");
		  if (CheckFile(szValueBuf)) {
			  strcpy(szEmacsenList[iEmacsenNum], "Meadow (getenv)" );
			  iEmacsenNum++;
		  }
	  } while (0);
  }

  /* NTEmacs */
  rret = RegOpenKey( HKEY_LOCAL_MACHINE,
		     "SOFTWARE\\GNU\\Emacs",
		     &hKey );
  if ( rret == ERROR_SUCCESS ){
    strcpy( szEmacsenList[iEmacsenNum], "NTEmacs" );
    dwValueBuf = sizeof(szValueBuf);
    if ( RegQueryValueEx( hKey,
			  "EMACSPATH",
			  NULL,
			  NULL,
			  szValueBuf,
			  &dwValueBuf ) == ERROR_SUCCESS ){
      dwKeyBuf = sizeof(szKeyBuf);
      if ( RegQueryValueEx( hKey,
			    "emacs_dir",
			    NULL,
			    NULL,
			    szKeyBuf,
			    &dwKeyBuf ) == ERROR_SUCCESS ){
	ReplaceString( szValueBuf, "%emacs_dir%", szKeyBuf );
	RevConvertPathSeparator( szValueBuf );
	strcat( szValueBuf, "\\emacs.exe" );
	if ( CheckFile( szValueBuf ) )
	  iEmacsenNum++;
      }
    } /* if ( RegQueryValueEx( */
    RegCloseKey( hKey );
  }
  /* Meadow */
  i=0;
  rret = RegOpenKey( HKEY_LOCAL_MACHINE,
		     "SOFTWARE\\GNU\\Meadow",
		     &hKey );
  if ( rret == ERROR_SUCCESS ){
    dwKeyBuf = sizeof(szKeyBuf);
    dwValueBuf = sizeof(szValueBuf);
    rret = RegEnumKeyEx( hKey,
			 i++,
			 szKeyBuf,
			 &dwKeyBuf,
			 NULL,
			 szValueBuf,
			 &dwValueBuf,
			 &ft );
    if ( rret == ERROR_SUCCESS ){
      do {
	if ( !strcmp( szKeyBuf, "Environment" ) ){
	  /* 1.00/1.01 */
	  strcpy( szValueBuf, "SOFTWARE\\GNU\\Meadow\\Environment" );
	  strcpy( szEmacsenList[iEmacsenNum], "Meadow 1.00/1.01" );
	} else {
	  /* 1.04a1 or later */
	  sprintf( szValueBuf, "SOFTWARE\\GNU\\Meadow\\%s\\Environment",
		   szKeyBuf);
	  sprintf( szEmacsenList[iEmacsenNum], "Meadow %s", szKeyBuf );
	}
	/* "Meadow.exe" exists? */
	if ( RegOpenKey( HKEY_LOCAL_MACHINE,
			 szValueBuf,
			 &hKey2 ) == ERROR_SUCCESS ){
	  dwKeyBuf = sizeof(szKeyBuf);
	  if ( RegQueryValueEx( hKey2,
				"EMACSPATH",
				NULL,
				NULL,
				szKeyBuf,
				&dwKeyBuf ) == ERROR_SUCCESS ){
	    sprintf( szValueBuf, "%s\\Meadow.exe", szKeyBuf );
	    if ( CheckFile( szValueBuf ) )
	      iEmacsenNum++;
	  } /* if ( RegQueryValueEx( */
	  RegCloseKey( hKey2 );
	} /* if ( RegOpenKey( */
	dwKeyBuf = sizeof(szKeyBuf);
	dwValueBuf = sizeof(szValueBuf);
	if ( iEmacsenNum >= MAX_EMACS ) break;
      } while ( RegEnumKeyEx( hKey,
			      i++,
			      szKeyBuf,
			      &dwKeyBuf,
			      NULL,
			      szValueBuf,
			      &dwValueBuf,
			      &ft ) == ERROR_SUCCESS );
    }
    RegCloseKey( hKey );
  }

  /* IF NOT FOUND ANY EMACSEN */
  if ( iEmacsenNum == 0 ) return ( FALSE );

  if ( iEmacsenNum > 1 ){
    /* select dialog */
    nIndex = DialogBoxParam( hInst,
			     MAKEINTRESOURCE(IDD_SEDIALOG),
			     0,
			     SelectEmacsenDlgProc,
			     0 );
    if ( nIndex < 0 ) return ( FALSE );
  } else {
    /* only one Emacs has found */
    nIndex = 0;
  }
  if (strstr(szEmacsenList[nIndex], "getenv"))
    bNoEmacsRegistry = TRUE;
  if ( ! strncmp( szEmacsenList[nIndex], "NTEmacs", 7 ) ){
    bEmacsType = EMACS_EMACS;
  } else if ( ! strncmp( szEmacsenList[nIndex], "Meadow", 6 ) ){
    bEmacsType = EMACS_MEADOW;
    if ( ! strncmp( szEmacsenList[nIndex], "Meadow 1.00", 11 ) ){
      strcpy( szMeadowVersion, "1.00" );
    } else {
      strcpy( szMeadowVersion, szEmacsenList[nIndex]+7 );
    }
  } else {
    bEmacsType = EMACS_NONE;
  }
  
  /* refrect setting */

  return ( TRUE );
}
Exemplo n.º 23
0
void
TclUnsetEnv(
    const char *name)		/* Name of variable to remove (UTF-8). */
{
    char *oldValue;
    int length;
    int index;
#ifdef USE_PUTENV_FOR_UNSET
    Tcl_DString envString;
    char *string;
#else
    char **envPtr;
#endif /* USE_PUTENV_FOR_UNSET */

    Tcl_MutexLock(&envMutex);
    index = TclpFindVariable(name, &length);

    /*
     * First make sure that the environment variable exists to avoid doing
     * needless work and to avoid recursion on the unset.
     */

    if (index == -1) {
	Tcl_MutexUnlock(&envMutex);
	return;
    }

    /*
     * Remember the old value so we can free it if Tcl created the string.
     */

    oldValue = environ[index];

    /*
     * Update the system environment. This must be done before we update the
     * interpreters or we will recurse.
     */

#ifdef USE_PUTENV_FOR_UNSET
    /*
     * For those platforms that support putenv to unset, Linux indicates
     * that no = should be included, and Windows requires it.
     */

#ifdef WIN32
    string = ckalloc((unsigned) length+2);
    memcpy(string, name, (size_t) length);
    string[length] = '=';
    string[length+1] = '\0';
#else
    string = ckalloc((unsigned) length+1);
    memcpy(string, name, (size_t) length);
    string[length] = '\0';
#endif /* WIN32 */

    Tcl_UtfToExternalDString(NULL, string, -1, &envString);
    string = ckrealloc(string, (unsigned) Tcl_DStringLength(&envString)+1);
    strcpy(string, Tcl_DStringValue(&envString));
    Tcl_DStringFree(&envString);

    putenv(string);

    /*
     * Watch out for versions of putenv that copy the string (e.g. VC++). In
     * this case we need to free the string immediately. Otherwise update the
     * string in the cache.
     */

    if (environ[index] == string) {
	ReplaceString(oldValue, string);
#ifdef HAVE_PUTENV_THAT_COPIES
    } else {
	/*
	 * This putenv() copies instead of taking ownership.
	 */

	ckfree(string);
#endif /* HAVE_PUTENV_THAT_COPIES */
    }
#else /* !USE_PUTENV_FOR_UNSET */
    for (envPtr = environ+index+1; ; envPtr++) {
	envPtr[-1] = *envPtr;
	if (*envPtr == NULL) {
	    break;
	}
    }
    ReplaceString(oldValue, NULL);
#endif /* USE_PUTENV_FOR_UNSET */

    Tcl_MutexUnlock(&envMutex);
}
Exemplo n.º 24
0
void FMetaTable::SetMetaString (DWORD id, const char *parm)
{
	FMetaData *meta = FindMetaDef (META_String, id);
	ReplaceString (&meta->Value.String, parm);
}
Exemplo n.º 25
0
int main (int argc, char ** argv) {
	char * str = (char *)malloc(sizeof(char) * 100);
	strncpy(str, "Hello! I would Die                    ", 100);
	ReplaceString(str, 18);
	printf("%s\n", str);
}
Exemplo n.º 26
0
CDynamicString &CDynamicString::operator=(LPCTSTR pszString)
{
	ReplaceString(&m_pszString,pszString);
	return *this;
}
Exemplo n.º 27
0
void AuxElement::SetSourceObject(char *NewSourceObject)
{
	ReplaceString(Data->SourceObject, NewSourceObject, 1);
	CheckData();
}
Exemplo n.º 28
0
bool CDynamicString::Set(LPCTSTR pszString)
{
	return ReplaceString(&m_pszString,pszString);
}
Exemplo n.º 29
0
/*
 * doInitializeEditor - do just that
 */
static void doInitializeEditor( int argc, char *argv[] )
{
    int         i, arg, cnt, ocnt, startcnt = 0;
    srcline     sline;
    int         k, j;
    char        tmp[FILENAME_MAX], c[1];
    char        buff[MAX_STR], file[MAX_STR], **list;
    char        cmd[MAX_STR * 2];
    char        *parm;
    char        *startup[MAX_STARTUP];
    char        *startup_parms[MAX_STARTUP];
    vi_rc       rc;
    vi_rc       rc1;

    /*
     * Make sure WATCOM is setup and if it is not, make a best guess.
     */
    watcom_setup_env();

    /*
     * If EDPATH is not set, use system default %WATCOM%\EDDAT.
     */
    if( getenv( "EDPATH" ) == NULL ) {
        char *watcom;

        watcom = getenv( "WATCOM" );
        if( watcom != NULL ) {
            char edpath[FILENAME_MAX];

            sprintf( edpath, "%s%c%s", watcom, FILE_SEP, "eddat" );

            if( setenv( "EDPATH", edpath, 0 ) != 0 ) {
                /*
                 * Bail out silently on error, as we will get error message later on.
                 */
            }
        }
    }

    /*
     * misc. set up
     */
    MaxMemFree = MemSize();
    StaticStart();
    FTSInit();
    BoundDataInit();
    EditFlags.Starting = true;
    InitCommandLine();
    ChkExtendedKbd();
    SSInitBeforeConfig();

    GetCWD1( &HomeDirectory );
    GetCWD1( &CurrentDirectory );
    SetCWD( HomeDirectory );
    if( cfgFN == NULL ){
        cfgFN = DupString( CFG_NAME );
    }

    checkFlags( &argc, argv, startup, startup_parms, &startcnt );
    ScreenInit();
    SetWindowSizes();
    EditFlags.ClockActive = false;
    SetInterrupts();
#ifdef __WIN__
    InitClrPick();
    InitFtPick();
    SubclassGenericInit();
    CursorOp( COP_INIT );
#else
    InitColors();
#endif
    InitSavebufs();
    InitKeyMaps();

    /*
     * initial configuration
     */
    EditVars.Majick = MemStrDup( "()~@" );
    EditVars.FileEndString = MemStrDup( "[END_OF_FILE]" );
    MatchInit();
    SetGadgetString( NULL );
    WorkLine = MemAlloc( sizeof( line ) + EditVars.MaxLine + 2 );
    WorkLine->len = -1;

    sline = 0;
    if( cfgFN[0] != '\0' ) {
        c[0] = '\0';
        rc = Source( cfgFN, c, &sline );
        if( rc == ERR_FILE_NOT_FOUND ) {
#ifdef __WIN__
            CloseStartupDialog();
            MessageBox( NO_WINDOW, "Could not locate configuration information; please make sure your EDPATH environment variable is set correctly",
                        EditorName, MB_OK );
            ExitEditor( -1 );
#else
            rc = ERR_NO_ERR;
#endif
        }
    } else {
        rc = ERR_NO_ERR;
    }
    if( wantNoReadEntireFile ) {
        EditFlags.ReadEntireFile = false;
    }
    VerifyTmpDir();
    while( LostFileCheck() );
    HookScriptCheck();

    if( EditFlags.Quiet ) {
        EditFlags.Spinning = false;
        EditFlags.Clock = false;
    }
    ExtendedMemoryInit();

    /*
     * more misc. setup
     */
    if( EditVars.WordDefn == NULL ) {
        EditVars.WordDefn = DupString( &WordDefnDefault[6] );
        InitWordSearch( EditVars.WordDefn );
    }
    if( EditVars.WordAltDefn == NULL ) {
        EditVars.WordAltDefn = DupString( WordDefnDefault );
    }
    if( EditVars.TagFileName == NULL ) {
        EditVars.TagFileName = DupString( "tags" );
    }
    DotBuffer = MemAlloc( (maxdotbuffer + 2) * sizeof( vi_key ) );
    AltDotBuffer = MemAlloc( (maxdotbuffer + 2) * sizeof( vi_key ) );
    DotCmd = MemAlloc( (maxdotbuffer + 2) * sizeof( vi_key ) );
    SwapBlockInit( EditVars.MaxSwapBlocks );
    ReadBuffer = MemAlloc( MAX_IO_BUFFER + 6 );
    WriteBuffer = MemAlloc( MAX_IO_BUFFER + 6 );
    FindHistInit( EditVars.FindHist.max );
    FilterHistInit( EditVars.FilterHist.max );
    CLHistInit( EditVars.CLHist.max );
    LastFilesHistInit( EditVars.LastFilesHist.max );
    GetClockStart();
    GetSpinStart();
    SelRgnInit();
    SSInitAfterConfig();
#if defined( VI_RCS )
    ViRCSInit();
#endif

    /*
     * create windows
     */
    StartWindows();
    InitMouse();
    rc1 = NewMessageWindow();
    if( rc1 != ERR_NO_ERR ) {
        FatalError( rc1 );
    }
    DoVersion();
    rc1 = InitMenu();
    if( rc1 != ERR_NO_ERR ) {
        FatalError( rc1 );
    }
    EditFlags.SpinningOurWheels = true;
    EditFlags.ClockActive = true;
    EditFlags.DisplayHold = true;
    rc1 = NewStatusWindow();
    if( rc1 != ERR_NO_ERR ) {
        FatalError( rc1 );
    }
    EditFlags.DisplayHold = false;

    MaxMemFreeAfterInit = MemSize();

    /*
     * look for a tag: if there is one, set it up as the file to start
     */
    EditFlags.WatchForBreak = true;
    if( cTag != NULL && !EditFlags.NoInitialFileLoad ) {
#if defined( __NT__ ) && !defined( __WIN__ )
        {
            if( !EditFlags.Quiet ) {
                SetConsoleActiveScreenBuffer( OutputHandle );
            }
        }
#endif
        rc1 = LocateTag( cTag, file, buff );
        cFN = file;
        if( rc1 != ERR_NO_ERR ) {
            if( rc1 == ERR_TAG_NOT_FOUND ) {
                Error( GetErrorMsg( rc1 ), cTag );
                ExitEditor( 0 );
            }
            FatalError( rc1 );
        }
    }

    /*
     * start specified file(s)
     */
    cmd[0] = 'e';
    cmd[1] = '\0';

    arg = argc - 1;
    k = 1;
    while( !EditFlags.NoInitialFileLoad ) {

        if( cFN == nullFN && !EditFlags.UseNoName ) {
            break;
        }

#ifdef __NT__
        {
            int     k2;
            int     arg2;
            char    path[_MAX_PATH];
            int     found;
            int     fd;
            size_t  len;
            size_t  len1;
            char    *p;

            /*
             * check for the existence of a file name containing spaces, and open it if
             * there is one
             */
            len = _MAX_PATH - 1;
            found = 0;
            p = path;
            arg2 = arg;
            for( k2 = k; argv[k2] != NULL; ) {
                len1 = strlen( argv[k2] );
                if( len1 > len )
                    break;
                memcpy( p, argv[k2], len1 );
                p += len1;
                *p = '\0';
                len -= len1;
                --arg2;
                ++k2;
                fd = open( path, O_RDONLY );
                if( fd != -1 ) {
                    close( fd );
                    k = k2;
                    arg = arg2;
                    found = 1;
                    break;
                }
                *p++ = ' ';
            }
            if( found ) {
#ifndef __UNIX__
                len1 = strlen( path );
                if( path[len1 - 1] == '.' )
                    path[len1 - 1] = '\0';
#endif
                rc1 = NewFile( path, false );
                if( rc1 != ERR_NO_ERR ) {
                    FatalError( rc1 );
                }
                cFN = argv[k];
                if( arg < 1 ) {
                    break;
                }
                continue;
            }
        }
#endif

        strcat( cmd, SingleBlank );
        strcat( cmd, cFN );
        ocnt = cnt = ExpandFileNames( cFN, &list );
        if( cnt == 0 ) {
            cnt = 1;
        } else {
            cFN = list[0];
        }

        for( j = 0; j < cnt; j++ ) {
            rc1 = NewFile( cFN, false );
            if( rc1 != ERR_NO_ERR && rc1 != NEW_FILE ) {
                FatalError( rc1 );
            }
            if( EditFlags.BreakPressed ) {
                break;
            }
            if( cnt > 0 && j < cnt - 1 ) {
                cFN = list[j + 1];
            }
        }
        if( ocnt > 0 ) {
            MemFreeList( ocnt, list );
        }
        if( EditFlags.BreakPressed ) {
            ClearBreak();
            break;
        }
        k++;
        arg--;
        if( cTag != NULL || arg < 1 ) {
            break;
        }
        cFN = argv[k];
    }
    if( EditFlags.StdIOMode ) {
        rc1 = NewFile( "stdio", false );
        if( rc1 != ERR_NO_ERR ) {
            FatalError( rc1 );
        }
    }
    EditFlags.WatchForBreak = false;
    EditFlags.Starting = false;

    /*
     * if there was a tag, do the appropriate search
     */
    if( cTag != NULL && !EditFlags.NoInitialFileLoad ) {
        if( buff[0] != '/' ) {
            i = atoi( buff );
            rc1 = GoToLineNoRelCurs( i );
        } else {
            rc1 = FindTag( buff );
        }
        if( rc1 > 0 ) {
            Error( GetErrorMsg( rc1 ) );
        }
    }

    /*
     * try to run startup file
     */
    if( EditFlags.RecoverLostFiles ) {
        startcnt = 0;
    }
    for( i = 0; i < startcnt; i++ ) {
        GetFromEnv( startup[i], tmp );
        ReplaceString( &cfgFN, tmp );
        if( cfgFN[0] != '\0' ) {
            if( startup_parms[i] != NULL ) {
                parm = startup_parms[i];
            } else {
                c[0] = '\0';
                parm = c;
            }
#if defined( __NT__ ) && !defined( __WIN__ )
            {
                if( !EditFlags.Quiet ) {
                    SetConsoleActiveScreenBuffer( OutputHandle );
                }
            }
#endif
            sline = 0;
            rc = Source( cfgFN, parm, &sline );
        }
    }
    if( rc > ERR_NO_ERR ) {
        Error( "%s on line %u of \"%s\"", GetErrorMsg( rc ), sline, cfgFN );
    }
    if( argc == 1 ) {
        LoadHistory( NULL );
    } else {
        LoadHistory( cmd );
    }
    if( EditVars.GrepDefault == NULL ) {
        EditVars.GrepDefault = DupString( "*.(c|h)" );
    }
    if( goCmd[0] != '\0' ) {
        KeyAddString( goCmd );
    }
    if( keysToPush != NULL ) {
        KeyAddString( keysToPush );
    }
#ifdef __WIN__
    if( lineToGoTo != 0 ) {
        SetCurrentLine( lineToGoTo );
        NewCursor( current_window_id, EditVars.NormalCursorType );
    }
#endif
    AutoSaveInit();
    HalfPageLines = WindowAuxInfo( current_window_id, WIND_INFO_TEXT_LINES ) / 2 - 1;
#if defined( _M_X64 )
    VarAddGlobalStr( "OSX64", "1" );
#elif defined( _M_IX86 ) && !defined( _M_I86 )
    VarAddGlobalStr( "OS386", "1" );
#endif
    if( EditVars.StatusString == NULL ) {
        EditVars.StatusString = DupString( "L:$6L$nC:$6C" );
    }
    UpdateStatusWindow();
#ifdef __WIN__
    if( CurrentInfo == NULL ) {
        // no file loaded - screen is disconcertenly empty - reassure
        DisplayFileStatus();
    }
#endif
    NewCursor( current_window_id, EditVars.NormalCursorType );
#if defined( __NT__ ) && !defined( __WIN__ )
    {
        SetConsoleActiveScreenBuffer( OutputHandle );
    }
#endif

} /* doInitializeEditor */
Exemplo n.º 30
0
/*
 * SetLastFind - set the last find string
 */
void SetLastFind( const char *newLastFind )
{
    ReplaceString( &lastFind, newLastFind );

} /* SetLastFind */