<commit_before>#include <iostream>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>

#include <vector>
#include <string>

using namespace std;

int main(int argc, char** argv)
{
	bool aFlag = false;
	bool lFlag = false;
	bool RFlag = false;	
	vector<string> fileParam;
	
	// Loops through arguments looking for flags/files/directories
	for(int i = 1; i < argc; ++i)
	{
		// Is a flag if first char of c-string is '-'
		if(argv[i][0] == '-')
		{
			// Accounts for flags like -laR, -lR, etc.
			for(int j = 1; argv[i][j] != '\n'; ++j)
			{
				if(argv[i][j] == 'a')
				{
					aFlag = true;
				}
				else if(argv[i][j] == 'l')
				{
					lFlag = true;
				}
				else if(argv[i][j] == 'R')
				{
					RFlag = true;
				}
				else
				{
					// If flag is neither 'l', 'a', nor 'R'
					cerr << "Error: Invalid flag" << endl;
					exit(1);
				}
			}
		}
		else
		{
			// Adds directories/files to vector
			fileParam.push_back(argv[i]); 
		}
	}
	if(fileParam.size() == 0)
	{
		fileParam.push_back("."); // Current directory, if no others specified
	}
	
	for(auto str : fileParam)
	{
		DIR* dirp;
		if(-1 == (dirp = opendir(str.c_str())))
		{
			perror("Error in opening directory");
			exit(1);
		}
	}

	return 0;
}<commit_msg>Updated ls<commit_after>#include <iostream>
#include <sys/types.h>
#include <dirent.h>
#include <errno.h>

#include <vector>
#include <string>
#include <stack>
#include <algorithm>

using namespace std;

int main(int argc, char** argv)
{
	bool aFlag = false;
	bool lFlag = false;
	bool RFlag = false;	
	vector<string> fileParam;
	
	// Loops through arguments looking for flags/files/directories
	for(int i = 1; i < argc; ++i)
	{
		// Is a flag if first char of c-string is '-'
		if(argv[i][0] == '-')
		{
			// Accounts for flags like -laR, -lR, etc.
			for(int j = 1; argv[i][j] != '\n'; ++j)
			{
				if(argv[i][j] == 'a')
				{
					aFlag = true;
				}
				else if(argv[i][j] == 'l')
				{
					lFlag = true;
				}
				else if(argv[i][j] == 'R')
				{
					RFlag = true;
				}
				else
				{
					// If flag is neither 'l', 'a', nor 'R'
					cerr << "Error: Invalid flag" << endl;
					exit(1);
				}
			}
		}
		else
		{
			// Adds directories/files to vector
			fileParam.push_back(argv[i]); 
		}
	}
	if(fileParam.size() == 0)
	{
		fileParam.push_back("."); // Current directory, if no others specified
	}

	sort(fileParam.begin(), fileParam.end());
	
	for(auto str : fileParam)
	{
		vector<dirent*> dirEntries;
		DIR* dirp;
		if(-1 == (dirp = opendir(str.c_str())))
		{
			perror("Error in opening directory");
			exit(1);
		}

		dirent* tempDirEnt;
		errno = 0;
		while(NULL != (tempDirEnt = readdir(dirp)))
		{
			dirEntries.push_back(tempDirEnt);
		}

		if(errno != 0)
		{
			perror("Error in reading directory");
			exit(1);
		}
	}

	return 0;
}
{'fraction_non_alphanumeric': 0.1808091657715718, 'fraction_numerical': 0.006802721088435374, 'mean_word_length': 2.559235668789809, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 20, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1291532', 'n_tokens_mistral': 1331, 'n_tokens_neox': 1109, 'n_words': 274}