|
@@ -1,7 +1,10 @@
|
|
|
#define _DEFAULT_SOURCE
|
|
|
|
|
|
#include <dirent.h>
|
|
|
+#include <sys/types.h>
|
|
|
+#include <sys/stat.h>
|
|
|
#include <unistd.h>
|
|
|
+#include <string.h>
|
|
|
#include "parser.h"
|
|
|
#include "error.h"
|
|
|
#include "color.h"
|
|
@@ -10,6 +13,8 @@
|
|
|
void lsBasics(int argc, char* argv[]){
|
|
|
char buffer[BUFFER_SIZE];
|
|
|
struct dirent** contentsDir;
|
|
|
+ struct stat info;
|
|
|
+ char path[BUFFER_SIZE];
|
|
|
int i = 0, nbFile;
|
|
|
|
|
|
//Recuperation chemin actuel
|
|
@@ -33,7 +38,13 @@ void lsBasics(int argc, char* argv[]){
|
|
|
|
|
|
//Affiche les fichiers
|
|
|
while(i < nbFile){
|
|
|
- printf("%s\n", contentsDir[i]->d_name);
|
|
|
+ strcpy(path, buffer);
|
|
|
+ strcat(path, "/");
|
|
|
+ strcat(path, contentsDir[i]->d_name);
|
|
|
+ printf("%s\n", path);
|
|
|
+ if(stat(path, &info) == ERR)
|
|
|
+ addperror("Erreur stat");
|
|
|
+ printf("%d %ld %s\n", info.st_mode, info.st_size, contentsDir[i]->d_name);
|
|
|
i++;
|
|
|
}
|
|
|
|