Ecrire la commande ls

Alcallee -  
 Alcallee54 -
Bonjour,
Je souhaiterais savoir si quelqu'un parmis vous saurez comment ecrire en language c, la commande "ls" ?

Je vous remercie d'avance pour vos reponses!!
A voir également:

1 réponse

Alcallee54
 
Voila, on m'a donné comme piste ceci mais je ne comprend rien!!

/*
GESTION DES OPTIONS
*/

main(int ac, char *av[])
int c;
while (c = getopt(ac,av,"ailnh = elp)! = 1)
switch (c) {case 'a' : print f ("option a positionnee \n");
break;
}

/*
GESTION DU TEMPS
*/

lstat (chemin, $info)
#include <time.h>
int m, y;
char *mois[] = {"jan", "fev",...,"dec"};
time_t tps;
struct tm *d;
tps = info.st_mtime;
d = localtime (&tps);

m = d -> tm_mon;
y = 1900 + d -> tm_year;
printf ("%d%s%d%d%d \n", d -> tm_day, mois[m], y, d -> tm_how, d -> tm_min);

struct stat info;
//tableau de pointeur
struct diremt ** contenu_rep;
int nb_entrees, i, b;
nb_entrees = scandir(".", &contenu_rep, 0, alphasort);
for(i = 0; i < nb_entrees; i++)
{
b = lstat (contenu_rep[i] -> d_name, &info);
}

if(S_ISREG(info.st_mode))
/*...*/
if(S_ISREG(info.st_mode))
S_ISLNK
S_ISCHR
S_ISBLK
S_ISFIFO
S_ISSOCK
0
Alcallee54
 
Merci pour les réponses!! Il ne fallait pas!!!!!
0