This commit is contained in:
hexplor
2026-05-23 03:06:15 +02:00
parent dec4ff6a3a
commit 35d6ab93fe
3 changed files with 46 additions and 0 deletions
+4
View File
@@ -53,4 +53,8 @@ dkms.conf
# debug information files
*.dwo
# nuisible
C/Grace/tmp_Grace
C/Sully/Sully_*
C/Sully/Sully
+20
View File
@@ -0,0 +1,20 @@
.PHONY: all clean fclean re test
all: Sully
Sully: Sully.o
cc -g3 -o Sully Sully.o
Sully.o: Sully.c
cc -c -g3 Sully.c
clean:
rm -f Sully.o
fclean: clean
rm -f Sully
re: fclean all
test:
./Sully > tmp_Sully ; diff tmp_Sully Sully.c
+22
View File
@@ -0,0 +1,22 @@
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
int main(void){
int index = 5;
char filename[8];
char filename_source[10];
char* base_name_file = "Sully_";
char exec_filename[50];
snprintf(filename, 100, "%s%d", base_name_file, index);
snprintf(filename_source, 100, "%s.c", filename);
snprintf(exec_filename, 100, "cc %s -o %s", filename_source, filename);
if (index >= 0){
int fd = open(filename_source, O_CREAT, O_RDWR | S_IRWXU);
int ret_exec = execl(exec_filename, exec_filename, NULL);
//Compiler Sully_X.c ---> Sully_X
//Lancer le Sully_X.c
close(fd);
}
return 0;
}