From 649a779c831f59d1e8acf7aadf1b380c53fbc56e Mon Sep 17 00:00:00 2001 From: Eduardo Machado <emm14@inf.ufpr.br> Date: Wed, 2 Dec 2015 19:24:07 -0200 Subject: [PATCH] duplicado --- miniShellSRC/miniShell.cpp | 81 -------------------------------------- 1 file changed, 81 deletions(-) delete mode 100644 miniShellSRC/miniShell.cpp diff --git a/miniShellSRC/miniShell.cpp b/miniShellSRC/miniShell.cpp deleted file mode 100644 index fdcbfec..0000000 --- a/miniShellSRC/miniShell.cpp +++ /dev/null @@ -1,81 +0,0 @@ -/* Implementado por: Eduardo Machado e Victor Perszel */ -/* 2015 */ - -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <errno.h> -#include <dirent.h> -#include <unistd.h> -#include <sys/stat.h> -#include <sys/types.h> - -#include <iostream> -#include <string> -#include <fstream> -#include <map> -#include <cstdlib> -#include <cmath> -#include <vector> - -using namespace std; - -int lsParameter(string parameter){ - if(parameter == ".") return 1; - else if(parameter == "-a") return 2; - else if(parameter == "-l") return 3; - else if(parameter == "-la") return 4; - else return -1; -} - -int lsMini(string parameter, char* currentPath){ - string mostra, temp, path, lsAux, fileName; - ifstream lsFile; - - path = currentPath; - /* Para dar um ls apenas, é necessário escrever "ls ." */ - /* Precisamos pensar em um jeito de concertar isso. */ - switch(lsParameter(parameter)){ - case 1: - lsAux = "ls > " + path + "/ls.txt"; - system(lsAux.c_str()); - break; - case 2: - lsAux = "ls -a > " + path + "/ls.txt"; - system(lsAux.c_str()); - break; - case 3: - lsAux = "ls -l > " + path + "/ls.txt"; - system(lsAux.c_str()); - break; - case 4: - lsAux = "ls -la > " + path + "/ls.txt"; - system(lsAux.c_str()); - break; - case -1: - puts("Parâmetro de ls inválido."); - return -1; - break; - } - printf("\n"); - - // Abertura do arquivo de entrada. - fileName = path + "/ls.txt"; - lsFile.open(fileName.c_str(), ios::in); - lsFile.seekg (0); - // Leitura do arquivo. - while(getline(lsFile, temp)) { - mostra += temp + "\n"; - } - // Remove arquivo ls.txt - remove(fileName.c_str()); - - cout << "mostra:" << mostra << endl; - return 0; -} - -int cdMini(string intendedDirectory){ - int errorTest; - errorTest = chdir(intendedDirectory.c_str()); - return errorTest; -} -- GitLab