예제 #1
0
//===========================================================================
//
// Parameter:			-
// Returns:				-
// Changes Globals:		-
//===========================================================================
quakefile_t *FindQuakeFiles( char *filter ) {
	char *str;
	char newfilter[_MAX_PATH];
	char pakfilter[_MAX_PATH];
	char filefilter[_MAX_PATH];

	strcpy( newfilter, filter );
	ConvertPath( newfilter );
	strcpy( pakfilter, newfilter );

	str = StringContains( pakfilter, ".pak", false );
	if ( !str ) {
		str = StringContains( pakfilter, ".pk3", false );
	}

	if ( str ) {
		str += strlen( ".pak" );
		if ( *str ) {
			*str++ = '\0';
			while ( *str == '\\' || *str == '/' ) str++;
			strcpy( filefilter, str );
			return FindQuakeFilesWithPakFilter( pakfilter, filefilter );
		} //end if
	} //end else
	return FindQuakeFilesWithPakFilter( NULL, newfilter );
} //end of the function FindQuakeFiles
예제 #2
0
static bool LineSatisfiesArch(const std::string &line,
                              const std::string arch) {
  bool has_arch_tags = false;
  for (auto &&possible_arch : AllArches) {
    if (StringContains(line, possible_arch)) {
      has_arch_tags = true;
      break;
    }
  }
  return (has_arch_tags && StringContains(line, arch)) || !has_arch_tags;
}
예제 #3
0
bool VersionScriptParser::SymbolInArchAndApiVersion(const std::string &line,
                                                    const std::string &arch,
                                                    int api) {
  // If the tags do not have an "introduced" requirement, the symbol is
  // exported.
  if (!StringContains(line, "introduced") && LineSatisfiesArch(line, arch)) {
    return true;
  }
  if (line == "future") {
    return api == FUTURE_API;
  }
  const std::string regex_match_string1 = " *introduced-" + arch + "=([0-9]+)";
  const std::string regex_match_string2 = " *introduced=([0-9]+)";
  std::smatch matcher1;
  std::smatch matcher2;
  std::regex match_clause1(regex_match_string1);
  std::regex match_clause2(regex_match_string2);
  int matched_api = -1;
  if (std::regex_search(line, matcher1, match_clause1)) {
    matched_api = std::stoi(matcher1.str(1));
  } else if ((std::regex_search(line, matcher2, match_clause2)) &&
    LineSatisfiesArch(line, arch)) {
    matched_api = std::stoi(matcher2.str(1));
  }
  // If the arch specific tag / version specific tag was found and the api level
  // required was greater than the api level offered.
  return (matched_api <=0 || api >= matched_api);
}
예제 #4
0
LineScope VersionScriptParser::GetLineScope(std::string &line,
                                            LineScope scope) {
  if (StringContains(line, "local:")) {
    scope = LineScope::local;
  }
  return scope;
}
예제 #5
0
static int _fileSystemIsSupported( const char * fs )
{
	string_t           st  = StringGetFromVirtualFile( "/proc/filesystems" ) ;
	stringList_t       stl = StringListStringSplit( st,'\n' ) ;
	StringListIterator it  = StringListBegin( stl ) ;
	StringListIterator end = StringListEnd( stl ) ;
	string_t xt ;
	int r = 0 ;

	while( it != end ){

		xt = *it ;

		it++ ;

		if( !StringStartsWith( xt,"nodev" ) ){

			if( StringContains( xt,fs ) ){

				r = 1 ;
				break ;
			}
		}
	}

	StringDelete( &st ) ;
	StringListDelete( &stl ) ;
	return r ;
}
예제 #6
0
static int _zuluCryptUnmountVolume_0( string_t st,char ** m_point )
{
	int h ;

	stringList_t stl = StringListStringSplit( st,' ' ) ;

	StringListIterator it = StringListBegin( stl ) ;

	/*
	 * zuluCryptDecodeMountEntry() is defined in mount_volume.c
	 */
	const char * mout_point = zuluCryptDecodeMountEntry( *( it + 1 ) ) ;

	if( StringContains( *( it + 2 ),"fuse" ) ){

		/*
		 * Dont know whats going on but FUSE based file systems do not seem to work with umount()
		 */
		h = _unmount( _unmount_fuse,mout_point ) ;
	}else{
		h = _unmount( _unmount_rest,mout_point ) ;
	}

	if( h == 0 && m_point != NULL ){

		*m_point = StringCopy_2( mout_point ) ;
	}

	StringListDelete( &stl ) ;

	return h ;
}
예제 #7
0
bool VersionScriptParser::Parse() {
  std::ifstream symbol_ifstream(version_script_);
  if (!symbol_ifstream.is_open()) {
    llvm::errs() << "Failed to open version script file\n";
    return false;
  }
  std::string line = "";

  while (std::getline(symbol_ifstream, line)) {
    // Skip comment lines.
    if (line.c_str()[0] == '#') {
      continue;
    }
    if (StringContains(line, "{")) {

      if ((StringContains(line, "PRIVATE"))) {
        continue;
      }
      ParseInnerBlock(symbol_ifstream);
    }
  }
  return true;
}
  /* ovec: command line args assumed to contain all the options for the program
   * options must be in the form of key= value or key=value NOT key = value
   * both key and value may contain spaces but they have to be quoted at the 
   * command line for this to work
   */
  void CmdLineOptionsToYaml(const vector<string> &ovec, Node &options)
  {
    VecS key_val_pairs;

    StlFor(i, ovec)
    {
      if (!StringContains(ovec[i], '='))
        throw runtime_error("Unexpected token in options: " + ovec[i]);

      string key;
      string value = "";

      if (StringEndsWith(ovec[i], '='))
      {
        key = ovec[i].substr(0, ovec[i].size() - 1);

        if (i < ovec.size() - 1 && !StringContains(ovec[i+1], '='))
        {
          value = ovec[i+1];
          ++i;
        }
      }
      else // the = must be in middle like foo=bar
      {
        size_t eq_pos = ovec[i].find('=');
        key = ovec[i].substr(0, eq_pos);
        value = ovec[i].substr(eq_pos + 1);
      }

      key_val_pairs.push_back(key + ": " + value);
    }

    string yaml_str = "{" + JoinFields(key_val_pairs, ", ") + "}";

    YAML::Parse(yaml_str, options);
  }
예제 #9
0
int Launch(int arch, int java)
{
	PROCESS_INFORMATION pInfo;
	char stdMsg[] = "Attempting to run with java set for";
	BOOL result = FALSE;
	int opt = 0;
	DWORD err = 0;
	char *cmd[2]= {"-d64 -Xms1024M -Xmx2048M -jar minecraft.jar","-Xincgc -Xmx1024M -jar minecraft.jar"};
	STARTUPINFO si;
	ZeroMemory(&si, sizeof(si));
	if (arch == 64 && java == 64)
	{
		if (StringContains(javaBinPath, "(x86)") != 1)
		{
			printf("%s 64 bit architexture", stdMsg);
			opt = 0;
		}
		else
		{
			//Looks like its still stuck running in 32 bit mode
			opt = 1;
		}
	}
	else if (java == 86 )
	{
		printf("%s 86 bit architexture", stdMsg);
		opt = 1;
	}
	else if (java == 0 && (arch == 64 || arch == 86))
	{
		printf("Unable to detect java\nPlease visit %s and download the appropreite version\n", JAVA_URL);
		return 1;
	}
	else
	{
		printf("Something is f****d!\n");
		return 1;
	}
	result = CreateProcess(javaBinPath, cmd[opt], NULL, NULL, FALSE,CREATE_DEFAULT_ERROR_MODE, NULL, NULL, &si, &pInfo);
	if (!result)
	{
		err = GetLastError();
		printf("\nSomething is f****d! Error: %X\n",err);
	}
	return 0;
}
예제 #10
0
bool VersionScriptParser::ParseInnerBlock(std::ifstream &symbol_ifstream) {
  std::string line = "";
  LineScope scope = LineScope::global;

  while (std::getline(symbol_ifstream, line)) {
    if (line.find("}") != std::string::npos) {
      break;
    }
    if (line.c_str()[0] == '#') {
      continue;
    }
    scope = GetLineScope(line, scope);
    if (scope != LineScope::global || StringContains(line, "global:")) {
      continue;
    }
    ParseSymbolLine(line);
  }
  return true;
}
예제 #11
0
	void DebugMenu::Add(const String& path, IAction* action)
	{
		if (StringContains(path, "/"))
		{
			std::vector<String> paths = SplitString(path, "/");
			action->name = paths.back();
			paths.pop_back();
			PathAction* pathAction = s_Instance->CreateOrFindPaths(paths);
			SP_ASSERT(pathAction);
			if (!pathAction->ContainsAction(action->name))
				pathAction->actionList.push_back(action);
			else
				spdel action;
		}
		else
		{
			s_Instance->m_ActionList.push_back(action);
		}
		s_Instance->Refresh();
	}
예제 #12
0
bool VersionScriptParser::ParseSymbolLine(const std::string &line) {
  //The symbol lies before the ; and the tags are after ;
  std::string::size_type pos = line.find(";");
  if (pos == std::string::npos) {
    llvm::errs() << "Couldn't find end of symbol" << line <<"\n";
    return false;
  }
  std::string symbol = line.substr(0, pos);
  std::string::size_type last_space = symbol.find_last_of(' ');
  symbol = symbol.substr(last_space + 1, pos);
  std::string tags = line.substr(pos + 1);
  if (SymbolExported(tags, arch_, api_)) {
    if (StringContains(tags, "var")) {
      AddToVars(symbol);
    } else {
      AddToFunctions(symbol);
    }
  }
  return true;
}
예제 #13
0
	void DebugMenu::Remove(const String& path)
	{
		if (StringContains(path, "/"))
		{
			std::vector<String> paths = SplitString(path, "/");
			String name = paths.back();
			paths.pop_back();
			PathAction* pathAction = s_Instance->CreateOrFindPaths(paths);
			SP_ASSERT(pathAction);
			if (pathAction->ContainsAction(name))
			{
				if (pathAction->actionList.size() == 1)
				{
					PathAction* parent = pathAction->parent;
					if (parent)
					{
						parent->DeleteChild(pathAction);
					}
					else
					{
						for (uint i = 0; i < s_Instance->m_ActionList.size(); i++)
						{
							if (s_Instance->m_ActionList[i] == pathAction)
							{
								spdel s_Instance->m_ActionList[i];
								s_Instance->m_ActionList.erase(s_Instance->m_ActionList.begin() + i);
								break;
							}
						}
					}
					while (parent)
					{
						spdel pathAction;
						pathAction = pathAction->parent;
					}
				}
				else
				{
					ActionList& actionList = pathAction->actionList;
					for (uint i = 0; i < actionList.size(); i++)
					{
						if (actionList[i]->name == name)
						{
							actionList.erase(actionList.begin() + i);
							break;
						}
					}
				}
			}
		}
		else
		{
			ActionList& actions = s_Instance->m_ActionList;
			for (uint i = 0; i < actions.size(); i++)
			{
				if (actions[i]->name == path)
				{
					spdel actions[i];
					actions.erase(actions.begin() + i);
					break;
				}
			}
		}
		s_Instance->Refresh();
	}
예제 #14
0
void Webserver::ParseClientLine()
{ 
  if(StringStartsWith(clientLine, "GET"))
  {
    ParseGetPost();
    postSeen = false;
    getSeen = true;
    if(!clientRequest[0])
      strncpy(clientRequest, INDEX_PAGE, STRING_LENGTH);
    return;
  }
  
  if(StringStartsWith(clientLine, "POST"))
  {
    ParseGetPost();
    InitialisePost();
    postSeen = true;
    getSeen = false;
    if(!clientRequest[0])
      strncpy(clientRequest, INDEX_PAGE, STRING_LENGTH);
    return;
  }
  
  int bnd;
  
  if(postSeen && ( (bnd = StringContains(clientLine, "boundary=")) >= 0) )
  {
    if(strlen(&clientLine[bnd]) >= POST_LENGTH - 4)
    {
      platform->Message(HOST_MESSAGE, "Post boundary buffer overflow.\n");
      return;
    }
    postBoundary[0] = '-';
    postBoundary[1] = '-';
    strncpy(&postBoundary[2], &clientLine[bnd], POST_LENGTH - 3);
    strncat(postBoundary, "--", POST_LENGTH);
    //Serial.print("Got boundary: ");
    //Serial.println(postBoundary);
    return;
  }
  
  if(receivingPost && StringStartsWith(clientLine, "Content-Disposition:"))
  {
    bnd = StringContains(clientLine, "filename=\"");
    if(bnd < 0)
    {
      platform->Message(HOST_MESSAGE, "Post disposition gives no filename.\n");
      return;
    }
    int i = 0;
    while(clientLine[bnd] && clientLine[bnd] != '"')
    {
      postFileName[i++] = clientLine[bnd++];
      if(i >= POST_LENGTH)
      {
        i = 0;
        platform->Message(HOST_MESSAGE, "Post filename buffer overflow.\n");
      }
    }
    postFileName[i] = 0;
    //Serial.print("Got file name: ");
    //Serial.println(postFileName);    
    return;
  }  
}
예제 #15
0
//===========================================================================
//
// Parameter:			-
// Returns:				-
// Changes Globals:		-
//===========================================================================
quakefile_t *FindQuakeFilesWithPakFilter(char *pakfilter, char *filter)
{
#ifdef _WIN32
	WIN32_FIND_DATA filedata;
	HWND handle;
	struct _stat statbuf;
	int done;
#else
	glob_t globbuf;
	struct stat statbuf;
	int j;
#endif
	quakefile_t *qfiles, *lastqf, *qf;
	char pakfile[_MAX_PATH], filename[_MAX_PATH], *str;

	qfiles = NULL;
	lastqf = NULL;
	if (pakfilter && strlen(pakfilter))
	{
#ifdef _WIN32
		handle = FindFirstFile(pakfilter, &filedata);
		done = (handle == INVALID_HANDLE_VALUE);
		while(!done)
		{
			_splitpath(pakfilter, pakfile, NULL, NULL, NULL);
			_splitpath(pakfilter, NULL, &pakfile[strlen(pakfile)], NULL, NULL);
			AppendPathSeperator(pakfile, _MAX_PATH);
			strcat(pakfile, filedata.cFileName);
			_stat(pakfile, &statbuf);
#else
		glob(pakfilter, 0, NULL, &globbuf);
		for (j = 0; j < globbuf.gl_pathc; j++)
		{
			strcpy(pakfile, globbuf.gl_pathv[j]);
			stat(pakfile, &statbuf);
#endif
			//if the file with .pak or .pk3 is a folder
			if (statbuf.st_mode & S_IFDIR)
			{
				strcpy(filename, pakfilter);
				AppendPathSeperator(filename, _MAX_PATH);
				strcat(filename, filter);
				qf = FindQuakeFilesWithPakFilter(NULL, filename);
				if (lastqf) lastqf->next = qf;
				else qfiles = qf;
				lastqf = qf;
				while(lastqf->next) lastqf = lastqf->next;
			} //end if
			else
			{
#ifdef _WIN32
				str = StringContains(pakfile, ".pk3", false);
#else
				str = StringContains(pakfile, ".pk3", true);
#endif
				if (str && str == pakfile + strlen(pakfile) - strlen(".pk3"))
				{
					qf = FindQuakeFilesInZip(pakfile, filter);
				} //end if
				else
				{
					qf = NULL;
				} //end else
				//
				if (qf)
				{
					if (lastqf) lastqf->next = qf;
					else qfiles = qf;
					lastqf = qf;
					while(lastqf->next) lastqf = lastqf->next;
				} //end if
			} //end else
			//
#ifdef _WIN32
			//find the next file
			done = !FindNextFile(handle, &filedata);
		} //end while
#else
		} //end for
		globfree(&globbuf);
#endif
	} //end if
	else
	{
#ifdef _WIN32
		handle = FindFirstFile(filter, &filedata);
		done = (handle == INVALID_HANDLE_VALUE);
		while(!done)
		{
			_splitpath(filter, filename, NULL, NULL, NULL);
			_splitpath(filter, NULL, &filename[strlen(filename)], NULL, NULL);
			AppendPathSeperator(filename, _MAX_PATH);
			strcat(filename, filedata.cFileName);
#else
		glob(filter, 0, NULL, &globbuf);
		for (j = 0; j < globbuf.gl_pathc; j++)
		{
			strcpy(filename, globbuf.gl_pathv[j]);
#endif
			//
			qf = malloc(sizeof(quakefile_t));
			if (!qf) Error("out of memory");
			memset(qf, 0, sizeof(quakefile_t));
			strcpy(qf->pakfile, "");
			strcpy(qf->filename, filename);
			strcpy(qf->origname, filename);
			qf->length = 0;
			qf->type = QuakeFileType(filename);
			//add the file ot the list
			qf->next = NULL;
			if (lastqf) lastqf->next = qf;
			else qfiles = qf;
			lastqf = qf;
#ifdef _WIN32
			//find the next file
			done = !FindNextFile(handle, &filedata);
		} //end while
#else
		} //end for
		globfree(&globbuf);
#endif
	} //end else
	return qfiles;
} //end of the function FindQuakeFilesWithPakFilter
예제 #16
0
//===========================================================================
//
// Parameter:			-
// Returns:				-
// Changes Globals:		-
//===========================================================================
int FileFilter(char *filter, char *filename, int casesensitive)
{
	char buf[1024];
	char *ptr;
	int i, found;

	while(*filter)
	{
		if (*filter == '*')
		{
			filter++;
			for (i = 0; *filter; i++)
			{
				if (*filter == '*' || *filter == '?') break;
				buf[i] = *filter;
				filter++;
			} //end for
			buf[i] = '\0';
			if (strlen(buf))
			{
				ptr = StringContains(filename, buf, casesensitive);
				if (!ptr) return false;
				filename = ptr + strlen(buf);
			} //end if
		} //end if
		else if (*filter == '?')
		{
			filter++;
			filename++;
		} //end else if
		else if (*filter == '[' && *(filter+1) == '[')
		{
			filter++;
		} //end if
		else if (*filter == '[')
		{
			filter++;
			found = false;
			while(*filter && !found)
			{
				if (*filter == ']' && *(filter+1) != ']') break;
				if (*(filter+1) == '-' && *(filter+2) && (*(filter+2) != ']' || *(filter+3) == ']'))
				{
					if (casesensitive)
					{
						if (*filename >= *filter && *filename <= *(filter+2)) found = true;
					} //end if
					else
					{
						if (toupper(*filename) >= toupper(*filter) &&
							toupper(*filename) <= toupper(*(filter+2))) found = true;
					} //end else
					filter += 3;
				} //end if
				else
				{
					if (casesensitive)
					{
						if (*filter == *filename) found = true;
					} //end if
					else
					{
						if (toupper(*filter) == toupper(*filename)) found = true;
					} //end else
					filter++;
				} //end else
			} //end while
			if (!found) return false;
			while(*filter)
			{
				if (*filter == ']' && *(filter+1) != ']') break;
				filter++;
			} //end while
			filter++;
			filename++;
		} //end else if
		else
		{
			if (casesensitive)
			{
				if (*filter != *filename) return false;
			} //end if
			else
			{
				if (toupper(*filter) != toupper(*filename)) return false;
			} //end else
			filter++;
			filename++;
		} //end else
	} //end while
	return true;
} //end of the function FileFilter
예제 #17
0
static string_t set_mount_options( m_struct * mst )
{
	/*
	 * zuluCryptGetMountOptionsFromFstab() is defined in parse_fstab.c
	 */
	string_t opt = zuluCryptGetMountOptionsFromFstab( mst->device,MOUNTOPTIONS,mst->uid ) ;

	int fsFamily = fs_family( mst->fs ) ;

	const char * f[] = { "nouser","users","user","defaults","noauto","auto","nodev","dev",
		"noexec","exec","nosuid","suid","bind","mandlock","move","noatime","nodiratime","remount","silent",
		"synchronous",NULL } ;

	const char ** z = f ;
	const char * e ;

	if( opt == StringVoid ){
		opt = String( "" ) ;
		StringAppend( opt,mst->fs_flags ) ;
	}else{
		if( StringContains( opt,"ro" ) ){
			mst->m_flags |= MS_RDONLY ;
		}
		StringMultipleAppend( opt,",",mst->fs_flags,END ) ;
	}

	_get_file_system_options_from_config_file( mst->device,opt ) ;

	if( fsFamily == 1 ){
		if( !StringContains( opt,"dmask=" ) ){
			StringAppend( opt,",dmask=0000" ) ;
		}
		if( !StringContains( opt,"umask=" ) ){
			StringAppend( opt,",umask=0000" ) ;
		}
		if( !StringContains( opt,"uid=" ) ){
			StringAppend( opt,",uid=" ) ;
			StringAppendInt( opt,mst->uid ) ;
		}
		if( !StringContains( opt,"gid=" ) ){
			StringAppend( opt,",gid=" ) ;
			StringAppendInt( opt,mst->uid ) ;
		}
		if( !StringContains( opt,"fmask=" ) ){
			StringAppend( opt,",fmask=0111" ) ;
		}
		if( StringsAreEqual( mst->fs,"vfat" ) ){
			if( !StringContains( opt,"flush" ) ){
				StringAppend( opt,",flush" ) ;
			}
			if( !StringContains( opt,"shortname=" ) ){
				StringAppend( opt,",shortname=mixed" ) ;
			}
		}
	}else if( fsFamily == 2 ){
		if( !StringContains( opt,"uid=" ) ){
			StringAppend( opt,",uid=" ) ;
			StringAppendInt( opt,mst->uid ) ;
		}
		if( !StringContains( opt,"gid=" ) ){
			StringAppend( opt,",gid=" ) ;
			StringAppendInt( opt,mst->uid ) ;
		}
	}else if( fsFamily == 3 ){
		mst->m_flags |= MS_RDONLY ;
	}else{
		/*
		 * ext file systems and raiserfs among others go here
		 * we dont set any options for them.
		 */
		;
	}

	/*
	 * remove mount options to leave only file system options
	 */
	while( 1 ){
		e = *z ;
		z++ ;
		if( e == NULL ){
			break ;
		}else{
			StringRemoveString( opt,e ) ;
		}
	}
	/*
	 * remove below two now because we are going to add them below,reason for removing them
	 * and readding them is because we want to make sure they are at the beginning of the string
	 */
	StringRemoveString( opt,"ro" ) ;
	StringRemoveString( opt,"rw" ) ;

	if( mst->m_flags & MS_RDONLY ){
		StringPrepend( opt,"ro," ) ;
	}else{
		StringPrepend( opt,"rw," ) ;
	}

	mst->opts = _remove_duplicates( opt ) ;
	return opt;
}
예제 #18
0
파일: ezlog.cpp 프로젝트: Pr0Wolf29/ezlog
int main(int argc, char* argv[])
{
	for(int b = 1; b < argc; b++)
	{
		if(strcmp(argv[b], "--help") == 0)
		{
			return PrintHelp();
		}
	}

	for(int a = 1; a < argc; a++)
	{
		if(strcmp(argv[a], "-b") == 0)
		{
			a++;
			if(a < argc)
			{
				back = std::stoi(argv[a]);
			}
		}

		else if(strcmp(argv[a], "-f") == 0)
		{
			a++;
			if(a < argc)
			{
				front = std::stoi(argv[a]);
				front++;
			}
		}

		else if(strcmp(argv[a], "-l") == 0)
		{
			line = true;
		}

		else { argz.push_back(argv[a]); }
	}

	//If front and back numbers are set, keep file into memory.
	if((front > 0) or (back > 0))
	{
		keep = true;
	}

	if(argz.size() < 2)
	{
		printf("No file or not enough words.\n");
		return PrintHelp();
	}

	//Load first file.
	std::ifstream tfstream(argz[0]);
	if(tfstream.is_open())
	{
		size_t file_index = -1;
		std::string temptxt;
		while(std::getline(tfstream, temptxt))
		{
			file_index++;
			if(StringContains(temptxt, argz[1]))
			{
				index_l.push_back(file_index);
				lines.push_back(temptxt);
			}

			if(keep)
			{
				file_v.push_back(temptxt);
			}
		}
		tfstream.close();
	}

	else
	{
		std::cout << "No such file '" << argz[0] << "'." << std::endl;
		return 1;
	}

	//Erase first two values.
	argz.erase(argz.begin(), argz.begin() + 1);

	//Remove and duplicate search items.
	std::sort(argz.begin(), argz.end());
	argz.erase(std::unique(argz.begin(), argz.end()), argz.end());

	if(!argz.empty())
	{
		//Go through each arg and then
		for(const std::string &arg : argz)
		{
			std::vector<std::string> temp_v;
			std::vector<size_t> temp_v_index;

			for(size_t line_index = 0; line_index < lines.size(); line_index++)
			{
				if(StringContains(lines[line_index], arg))
				{
					temp_v.push_back(lines[line_index]);
					temp_v_index.push_back(index_l[line_index]);
				}
			}

			lines = temp_v;
			index_l = temp_v_index;

			if(lines.empty())
			{
				return 0;
			}
		}
	}

	for(size_t z = 0; z < index_l.size(); z++)
	{
		size_t f_index = -1;
		size_t b_index = -1;

		if(keep)
		{
			f_index = index_l[z] + front;
			b_index = index_l[z] - back;

			if(b_index < 0) { b_index = 0; }
			if(f_index > file_v.size())
			{
				f_index = file_v.size();
				f_index--;
			}
		}

		if(b_index != -1)
		{
			for(size_t t = b_index; t < index_l[z]; t++)
			{
				pline(t, file_v[t]);
			}
		}

		pline(index_l[z], lines[z]);

		if(f_index != -1)
		{
			bool first = true; //Weird hack required for a line skip.
			for(size_t t = index_l[z]; t < f_index; t++)
			{
				if(first)
				{
					first = false;
				}

				else
				{
					pline(t, file_v[t]);
				}
			}
		}

		if(keep)
		{
			printf("\n");
		}
	}

	return 0;
}