diff --git a/2020-2021/S3T_TP_00_REVISIONS/processus_3.c b/2020-2021/S3T_TP_00_REVISIONS/processus_3.c index f18d8ba..0d9e522 100755 --- a/2020-2021/S3T_TP_00_REVISIONS/processus_3.c +++ b/2020-2021/S3T_TP_00_REVISIONS/processus_3.c @@ -4,8 +4,8 @@ * @ Copyright: Creative Common 4.0 (CC BY 4.0) * @ Create Time: 04-09-2020 10:41:01 * @ Modified by: JunkJumper - * @ Modified time: 04-09-2020 10:58:23 - * @ Description: + * @ Modified time: 04-09-2020 11:53:50 + * @ Description: produit le même résultat qu'un set */ #include diff --git a/2020-2021/S3T_TP_01_SGF-1/myls.c b/2020-2021/S3T_TP_01_SGF-1/myls.c index 2110ebc..c2cc3db 100755 --- a/2020-2021/S3T_TP_01_SGF-1/myls.c +++ b/2020-2021/S3T_TP_01_SGF-1/myls.c @@ -1,8 +1,37 @@ +/** + * @ Author: JunkJumper + * @ Link: https://github.com/JunkJumper + * @ Copyright: Creative Common 4.0 (CC BY 4.0) + * @ Create Time: 04-09-2020 11:43:11 + * @ Modified by: JunkJumper + * @ Modified time: 04-09-2020 12:31:46 + * @ Description: code c produisant le même résultat qu'un ls. + */ + /// M311 - myls #include +#include +#include +#include -int main (int argc, char* argv[]) -{ - /// ... -} +int main(int argc, char *argv[]) +{ + DIR *dir; + struct dirent *entry; + + if (argc != 2) + { + fprintf(stderr, "Syntaxe : %s {le chemin}\n\n", argv[0]); + exit(1); + } + + dir = opendir(argv[1]); + entry = readdir(dir); + while(entry != NULL) { + printf("%s - %d", entry->d_name, entry->d_ino); + entry = readdir(dir); + } + closedir(dir); + printf("\n"); +}