Untitled

 avatar
unknown
plain_text
12 days ago
906 B
4
Indexable
std::vector<std::string*> entries;

void checkWildCardExpansion(char * arg) {
	// printf("Expanding WildCards!!!\n");
  	std::string* arg_str = new std::string(arg);
	entries.clear();

	if (strchr(arg, '*') || strchr(arg, '?')) {
		expandWildCards(NULL, arg);
		// printf("expandWildCards Funtion Done!!\n");
		std::sort(entries.begin(), entries.end(), compare_func);
		// printf("Sorting Done\n");
		// fflush(stdout);
		// for (int i = 0; i < entries.size(); i++) {
		// 	printf("%s\n", entries[i]->c_str());
		// }
		// printf("Sorting Done\n");
		for (int i = 0; i < entries.size(); i++){
			Command::_currentSimpleCommand->insertArgument(entries[i]);
			// Command::_currentSimpleCommand->print();
		}
	}
	else {
		Command::_currentSimpleCommand->insertArgument(arg_str);
	}
	return;
}

int compare_func(std::string *file1, std::string* file2){
	return *file1 < *file2;
}
Editor is loading...
Leave a Comment