From 6dfbc2f055d1b443a3fa27ebf604945b83fde715 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Laure=CE=B7t?= Date: Sat, 24 Apr 2021 17:32:54 +0200 Subject: [PATCH] functionnel mais spaghet un peu --- .vscode/settings.json | 3 +- Q1 | Bin 0 -> 29352 bytes Q1.c | 67 ++++++++++++++ Q3.c | 71 ++++++++++++++ Q4 | Bin 0 -> 29816 bytes Q4.c | 93 +++++++++++++++++++ Q5 | Bin 0 -> 32160 bytes Q5.c | 115 +++++++++++++++++++++++ Q6 | Bin 0 -> 33104 bytes Q6.c | 204 ++++++++++++++++++++++++++++++++++++++++ jobs | Bin 32928 -> 33272 bytes jobs.c | 62 ++++++++++--- jobs.h | 10 +- list.c | 83 +++++++++++++++++ list.h | 25 +++++ minishell | Bin 32984 -> 33632 bytes minishell copy.c | 207 +++++++++++++++++++++++++++++++++++++++++ minishell.c | 171 +++++++++++++++++++++------------- minishell2.c | 210 ++++++++++++++++++++++++++++++++++++++++++ readcmd | Bin 32872 -> 33480 bytes test.sh | 4 +- 21 files changed, 1238 insertions(+), 87 deletions(-) create mode 100755 Q1 create mode 100644 Q1.c create mode 100644 Q3.c create mode 100755 Q4 create mode 100644 Q4.c create mode 100755 Q5 create mode 100644 Q5.c create mode 100755 Q6 create mode 100644 Q6.c create mode 100644 list.c create mode 100644 list.h create mode 100644 minishell copy.c create mode 100644 minishell2.c diff --git a/.vscode/settings.json b/.vscode/settings.json index fcac5ac..3f0c39b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -3,6 +3,7 @@ "signal.h": "c", "readcmd.h": "c", "stdlib.h": "c", - "wait.h": "c" + "wait.h": "c", + "*.bak": "c" } } \ No newline at end of file diff --git a/Q1 b/Q1 new file mode 100755 index 0000000000000000000000000000000000000000..38fd48833c95dbb6518168ebfc5b2bc27779a60a GIT binary patch literal 29352 zcmeHw3w%`7x$oXHSu;EDNkT#Zl|e+XN)i+!D31gfm>_86p$OtI$xM>bBopTm!6Std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oE5I#b5>Ap15fc^`Ot?9#Z>7JQbmyz92V#)@l*Bx3izbIOvT!746D9Z>M6*-8>^H7ZRWLa+Vs`_Rl%<-1!=>E@=xZi z<*WN11q&@@Q`X*p{~Kteui~%v?Fz0UrX{KVr$|pBW7Svpp9(&t1SPbW{}Y@3@H`=? z;Qgj!f^IMW=OEKNymHu?&nwjLdfDX_uHdhsTWrx+_u<3zfCWj(32YQs^pjvv-%;hO z`*rm@ZG$p?vRj+>R6D*8T@q3H>i2YxF9i{4jsWIWm8;-K;8^v|`}{hg^028XGD=TD z2b8V)>VENIsjvK0W|W?ZLz!sG|Nch7d9qGGzX0adYvx3zP?ld~qbq&;Jq7tnNx=%K zFQ}u}7wbfR-zbUal%68b8b^O~y^#17J>at>yZ*d!^lL8@N;$R;Z`WTsj{e2#gnotU zIMN5Z{-sji9>2z`g~9`>VQl)!4nf-x~RE`SNY +#include +#include +#include +#include +#include +#include +#include +#include "readcmd.h" + +extern int errno; + +struct cmdline *cmd; + +int pid_fils; + +int main(int argc, char *argv[]) +{ + // loop principal + while (1) + { + printf(">>> "); + cmd = readcmd(); + + if (cmd == NULL) + { // EOF + break; + } + else if (cmd->seq[0] == NULL) + { // empty + continue; + } + + pid_fils = fork(); + if (pid_fils == -1) + { // fork fail ? + fprintf(stderr, "ERROR: forking failed, (%d) %s\n", errno, strerror(errno)); + exit(errno); + } + + if (pid_fils == 0) + { // instructions du fils + execvp(cmd->seq[0][0], cmd->seq[0]); + exit(errno); // si execlp échoue on exit avec une erreur + } + else + { // instructions du père + int wait_code; + pid_t id = waitpid(pid_fils, &wait_code, 0); // on attend la fin de l'exec du fils + + if (id == -1) + { // wait fail ? + fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", wait_code, errno, strerror(errno)); + exit(errno); + } + + if (wait_code) + { // execvp fail ? + fprintf(stderr, "ERROR: %d's execution failed, (%d) %s\n", pid_fils, wait_code, strerror(wait_code)); + } + } + } + + return EXIT_SUCCESS; +} diff --git a/Q3.c b/Q3.c new file mode 100644 index 0000000..41c967e --- /dev/null +++ b/Q3.c @@ -0,0 +1,71 @@ +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include "readcmd.h" + +extern int errno; + +struct cmdline *cmd; + +int pid_fils; + +int main(int argc, char *argv[]) +{ + // loop principal + while (1) + { + printf(">>> "); + cmd = readcmd(); + + if (cmd == NULL) + { // EOF + break; + } + else if (cmd->seq[0] == NULL) + { // empty + continue; + } + else if (!strcmp(cmd->seq[0][0], "exit")) + { // "exit" + break; + } + + pid_fils = fork(); + if (pid_fils == -1) + { // fork fail ? + fprintf(stderr, "ERROR: forking failed, (%d) %s\n", errno, strerror(errno)); + exit(errno); + } + + if (pid_fils == 0) + { // instructions du fils + execvp(cmd->seq[0][0], cmd->seq[0]); + exit(errno); // si execlp échoue on exit avec une erreur + } + else + { // instructions du père + int wait_code; + pid_t id = waitpid(pid_fils, &wait_code, 0); // on attend la fin de l'exec du fils + + if (id == -1) + { // wait fail ? + fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", wait_code, errno, strerror(errno)); + exit(errno); + } + + if (wait_code) + { // execvp fail ? + fprintf(stderr, "ERROR: %d's execution failed, (%d) %s\n", pid_fils, wait_code, strerror(wait_code)); + } + } + } + + return EXIT_SUCCESS; +} diff --git a/Q4 b/Q4 new file mode 100755 index 0000000000000000000000000000000000000000..46a2261880a73d520a9b233a26ed8c4444d5b04d GIT binary patch literal 29816 zcmeHw34B}CneV-lk956hvEwBPiy#ET5<7&DCXmGrQ6h(gm@Hrtf}%*Wt>6tUCgDMo z#({@wOcPoP?WBb+L$|P$X-i%R#SjKFeXngO{7A~ssmlZ^H_&Ic88fu#{lBwZOBbu{ z^u3w)e(&d#_&9M^NS z8JYul5vK`$g8<-)bi$So4N12Hl3p!kCV;02vZkQ&kRa(5N~0x$qoC#yIO#FUO56&o zDutYaif@)TNANWZd`vo{V6Gm;CbL-RW!B`wVHuYe?i6^^FCvrPnA97SdI}E9Kq#o<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hb z3RlmaD=4>}JjS{HOS9SlG89v#?~@f&a8wGa@~!p1PwFp|a_TvH1&3vaBYoVZeIkBe z1C2zKeQY*Gl2CoWKvF-^{s+Lw)%Qs~1^IW8l`^2ky!I`NzWTj81@E<-ODKJ1k{)5m zEnnT2DOj!qCA9Y6zmxhZ{^~wK!8S6UlT`c_=}BZrMCq&hV+Fsd1SPbV{|^>@&s-s> zpz8n1jJ5oiz`)%!9|I(#?%UPxtXbt1uHdhs8W;nA2bqC`s(+IPAny9JcT8Ic~$xfeh5ykzIhJOAXMnwC^soR z1#M8y)mQhYhZ=;I@>AJRdL|BKqACA}n+4~E1_8IKjv-LZC!qr6viv!UAfeK?-rJC` zloYI%`hq%seYHX4_l=WyPU$J~%mVt`8->IrmH}kdzqo+@SFRHJ<(3X_)n8gb|GV;j z>w493q{CMIE2X|QevVB-;c?Y47JX&sngZn?+9DLJc9otq$J@cu#GI9p`Y%ZT&j!_p rKh=NK`c({?#YIr?K(;)P;6LujDdJ)+pQgu&^rvhW@)3)I1=ao+w8jSC literal 0 HcmV?d00001 diff --git a/Q4.c b/Q4.c new file mode 100644 index 0000000..3801065 --- /dev/null +++ b/Q4.c @@ -0,0 +1,93 @@ +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include "readcmd.h" + +extern int errno; + +struct cmdline *cmd; + +int pid_fils; + +char initcd[256], currentcd[256]; + +int main(int argc, char *argv[]) +{ + getcwd(initcd, sizeof(initcd)); + + // loop principal + while (1) + { + getcwd(currentcd, sizeof(currentcd)); + printf("%s >>> ", currentcd); + cmd = readcmd(); + + if (cmd == NULL) + { // EOF + break; + } + else if (cmd->seq[0] == NULL) + { // empty + continue; + } + else if (!strcmp(cmd->seq[0][0], "exit")) + { // "exit" + break; + } + else if (!strcmp(cmd->seq[0][0], "cd")) + { // "cd" + int ret = 0; + if (cmd->seq[0][1] == NULL) + { // no path + ret = chdir(initcd); + } + else + { // with path + ret = chdir(cmd->seq[0][1]); + } + if (ret) + { // wrong path + fprintf(stderr, "ERROR: cd failed, (%d) %s\n", errno, strerror(errno)); + } + continue; + } + + pid_fils = fork(); + if (pid_fils == -1) + { // fork fail ? + fprintf(stderr, "ERROR: forking failed, (%d) %s\n", errno, strerror(errno)); + exit(errno); + } + + if (pid_fils == 0) + { // instructions du fils + execvp(cmd->seq[0][0], cmd->seq[0]); + exit(errno); // si execlp échoue on exit avec une erreur + } + else + { // instructions du père + int wait_code; + pid_t id = waitpid(pid_fils, &wait_code, 0); // on attend la fin de l'exec du fils + + if (id == -1) + { // wait fail ? + fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", wait_code, errno, strerror(errno)); + exit(errno); + } + + if (wait_code) + { // execvp fail ? + fprintf(stderr, "ERROR: %d's execution failed, (%d) %s\n", pid_fils, wait_code, strerror(wait_code)); + } + } + } + + return EXIT_SUCCESS; +} diff --git a/Q5 b/Q5 new file mode 100755 index 0000000000000000000000000000000000000000..3871ccb06e0e4557bd23796d69e2b731dcebb00b GIT binary patch literal 32160 zcmeHw33$}ix%ZiwoXLN(OeTBSM-;_{1W+j|O9BK3g^DaTN^u;LNivwNnHhw-aS7O_ z5es&+z1&K*w~J!0cI7H6E}x-(SBtl;(CtcFY$v4)t@eItZJYc1onTukh4IM-G08*}okul(8O%@hf3kfMVUN}*xQ!Eq#jZ;oCYVce*qeAmp zXw%dA&DQB62Oc-ZSePkC-=r35xzws`C``GV$i!gmqPs{MHgdy8&cYMM5f)m1(hUC1 zH+pknJ<=HJ)m4aGxvfSn7cMjW7BUZpwXY{y{yX`tHgfHAw4PjeK$C@qHot2jXI*7j z-VxYpUSskbuO4bl`?S!wSJZXHHqE=FuA^mEN31Kkb=KDT^JdMvq&D7NJ6GjPyVw-i zrmlSVdg0zK4wGi(UBZ=xyA2K&70AmbN4Hac#;x@it$F?6_f9^)TwksrVz0@{cPhwhN(3MSAP{NZ_*H4cKl3N_O})(6Vfj!q$vKFCK?p z4g-QpGW+u2IQ)ypp*N31pEwTv>*LUG8;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&-UAfx@b0$uA2#`0IMcA>b{Z9O?T>(ppTX1Rx6kKUD2zVZ$R&W4 z$4}QP#Be2x&EG!nXQ6$*PjkQB|L;QrpQW?%^(KQfG=kQC%V!~O>k)i5&*IySyoF{N zt$dtmzqMyKBJ`=1x6cP!c-k=9{Bz6y2_wJ6@Y&}LEvz?+DUV&P$d&&LXtc}f=h9yV z1KGYaLvH==Lt>_U(8yV+-qn(!AVhi^`E8j)>^Vyd3&B<;Q`BNU~c~3%#p8|s~IgkY!w^%-2A@{I__Yy z-6VbfWWPt7%WrWDUxRE(hP*xRI?V$!1k0zfQQXo`A%Shjbkp?ti~YXv3FANZUj{2@ z>+wy{$YSN~cN32x@r-r%mbHm)W=N&S~(u@{7ljf1VQy!i6~w&y~O0$mja+ zH$1>ac*Y*cX*BIOtLM6L@_*DEaOCQ>az>rfm(xX6(g`EqW9**}Y7l?6IClQ>ftJ%m eK*8~2mjdGFf5m^Sp0VWL71#1DIR@vT;=cf;UT)+7 literal 0 HcmV?d00001 diff --git a/Q5.c b/Q5.c new file mode 100644 index 0000000..6b5d26a --- /dev/null +++ b/Q5.c @@ -0,0 +1,115 @@ +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include "readcmd.h" + +extern int errno; +struct cmdline *cmd; +int pid_fils; +int prompting = 0; +jmp_buf goto_prompt; +char initcd[256], currentcd[256]; + +void handler_sigchld(int sig_num) +{ + if (prompting) + { + printf("\n"); + siglongjmp(goto_prompt, sig_num); + } +} + +int main(int argc, char *argv[]) +{ + getcwd(initcd, sizeof(initcd)); + + // gestion des signaux + struct sigaction action; + sigemptyset(&action.sa_mask); + action.sa_flags = SA_SIGINFO | SA_RESTART; + action.sa_handler = handler_sigchld; + sigaction(SIGCHLD, &action, NULL); + + // loop principal + while (1) + { + sigsetjmp(goto_prompt, 1); + + prompting = 1; + getcwd(currentcd, sizeof(currentcd)); + printf("%s >>> ", currentcd); + cmd = readcmd(); + prompting = 0; + + if (cmd == NULL) + { // EOF + break; + } + else if (cmd->seq[0] == NULL) + { // empty + continue; + } + else if (!strcmp(cmd->seq[0][0], "exit")) + { // "exit" + break; + } + else if (!strcmp(cmd->seq[0][0], "cd")) + { // "cd" + int ret = 0; + if (cmd->seq[0][1] == NULL) + { // no path + ret = chdir(initcd); + } + else + { // with path + ret = chdir(cmd->seq[0][1]); + } + if (ret) + { // wrong path + fprintf(stderr, "ERROR: cd failed, (%d) %s\n", errno, strerror(errno)); + } + continue; + } + + pid_fils = fork(); + if (pid_fils == -1) + { // fork fail ? + fprintf(stderr, "ERROR: forking failed, (%d) %s\n", errno, strerror(errno)); + exit(errno); + } + + if (pid_fils == 0) + { // instructions du fils + execvp(cmd->seq[0][0], cmd->seq[0]); + exit(errno); // si execlp échoue on exit avec une erreur + } + else + { // instructions du père + if (!cmd->backgrounded) + { // background + int wait_code; + pid_t id = waitpid(pid_fils, &wait_code, 0); // on attend la fin de l'exec du fils + + if (id == -1) + { // wait fail ? + fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", wait_code, errno, strerror(errno)); + exit(errno); + } + + if (wait_code) + { // execvp fail ? + fprintf(stderr, "ERROR: %d's execution failed, (%d) %s\n", pid_fils, wait_code, strerror(wait_code)); + } + } + } + } + + return EXIT_SUCCESS; +} diff --git a/Q6 b/Q6 new file mode 100755 index 0000000000000000000000000000000000000000..949d4a9418ff9adb5b7b3b7546b2f70ef8805690 GIT binary patch literal 33104 zcmeHw3wV^(ng2I4Ig@X4o!k=;7(oy(1W=*KH6VdOK_eFpco{-6Nk(%sGsDFdp#)}oy(+NM?8Y-^kS{my0b&6w$ScmK~m z|NrxFAoHI0J@5OT_q^wRzT1x4mCM{Nmt}&-T4)g)EK-yjolv(`M*wQ9IaWS?&$A|3 zUf@}hrqXK^K&lES-Ko&lbPpiqDj69Co}Gg}mS5qN6O3v+9fm6v zpMfSlncobRZl%F}QmJJb=#-;x5(|`EVpS>(=yGo*6N9#k?jmVO%MEEc15as37-;-S zpYU&v)|(D%kj79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file mode 100644 index 0000000..0122400 --- /dev/null +++ b/Q6.c @@ -0,0 +1,204 @@ +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include "readcmd.h" +#include "jobs.h" + +extern int errno; + +struct cmdline *cmd; + +int pid_fils, state_fils; + +list jobs; + +int prompting = 0; +jmp_buf goto_prompt; + +char initcd[256], currentcd[256]; + +void handler_sigchld(int sig_num) +{ + pid_fils = waitpid(-1, &state_fils, WNOHANG | WUNTRACED | WCONTINUED); + cell *job = trouver(&jobs, pid_fils); + + if (prompting) + { + printf("\n"); + } + + if (WIFSTOPPED(state_fils)) + { + printf("[%d] %d suspended: %s\n", job->id, job->pid, job->cmd); + } + else if (WIFCONTINUED(state_fils)) + { + printf("[%d] %d continued: %s\n", job->id, job->pid, job->cmd); + //attendre(job->pid); + } + else if (WIFEXITED(state_fils)) + { + printf("[%d] %d done: %s\n", job->id, job->pid, job->cmd); + supprimer(&jobs, job->pid); + } + // else if (WIFSIGNALED(state_fils)) + // { + // /* traiter signal */ + // } + + if (prompting) + { + siglongjmp(goto_prompt, sig_num); + } +} + +void handler_sigint(int sig_num) +{ + printf("\n"); + siglongjmp(goto_prompt, sig_num); +} + +void attendre(int pid) +{ + int wait_code; + pid_t id = waitpid(pid, &wait_code, 0); // on attend la fin de l'exec du fils + + if (id == -1) + { // wait fail ? + fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", wait_code, errno, strerror(errno)); + exit(errno); + } + + if (wait_code) + { // execvp fail ? + fprintf(stderr, "ERROR: %d's execution failed, (%d) %s\n", pid, wait_code, strerror(wait_code)); + } +} + +int main(int argc, char *argv[]) +{ + initialiser(&jobs); + getcwd(initcd, sizeof(initcd)); + + // gestion des signaux + struct sigaction action; + sigemptyset(&action.sa_mask); + action.sa_flags = SA_SIGINFO | SA_RESTART; + action.sa_handler = handler_sigchld; + sigaction(SIGCHLD, &action, NULL); + action.sa_handler = handler_sigint; + sigaction(SIGINT, &action, NULL); + sigaction(SIGTSTP, &action, NULL); + + // loop principal + while (1) + { + sigsetjmp(goto_prompt, 1); + + prompting = 1; + getcwd(currentcd, sizeof(currentcd)); + printf("%s >>> ", currentcd); + cmd = readcmd(); + prompting = 0; + + if (cmd == NULL) + { // EOF + break; + } + else if (cmd->seq[0] == NULL) + { // empty + continue; + } + else if (!strcmp(cmd->seq[0][0], "exit")) + { // "exit" + break; + } + else if (!strcmp(cmd->seq[0][0], "cd")) + { // "cd" + int ret = 0; + if (cmd->seq[0][1] == NULL) + { // no path + ret = chdir(initcd); + } + else + { // with path + ret = chdir(cmd->seq[0][1]); + } + if (ret) + { // wrong path + fprintf(stderr, "ERROR: cd failed, (%d) %s\n", errno, strerror(errno)); + } + continue; + } + else if (!strcmp(cmd->seq[0][0], "jobs")) + { // "jobs" + afficher(&jobs); + continue; + } + else if (!strcmp(cmd->seq[0][0], "bg")) + { // "bg" + kill(pid_fils, SIGCONT); + continue; + } + else if (!strcmp(cmd->seq[0][0], "fg")) + { // "fg" + cell *job; + if (cmd->seq[0][1] == NULL) + { // no id + fprintf(stderr, "ERROR: fg id error\n"); + continue; + } + else + { // id specified + job = &(jobs[atoi(cmd->seq[0][1]) - 1]); + } + kill(job->pid, SIGCONT); + + continue; + } + pid_fils = fork(); + if (pid_fils == -1) + { // fork fail ? + fprintf(stderr, "ERROR: forking failed, (%d) %s\n", errno, strerror(errno)); + exit(errno); + } + + if (pid_fils == 0) + { // instructions du fils + action.sa_handler = SIG_DFL; + sigaction(SIGTSTP, &action, NULL); // on default SIGTSTP + sigaction(SIGCONT, &action, NULL); // on default SIGCONT + + if (cmd->backgrounded) + { // background + action.sa_handler = SIG_IGN; + sigaction(SIGINT, &action, NULL); // on ignore SIGINT + sigaction(SIGTSTP, &action, NULL); // on ignore SIGTSTP + } + + execvp(cmd->seq[0][0], cmd->seq[0]); + exit(errno); // si execlp échoue on exit avec une erreur + } + else + { // instructions du père + if (cmd->backgrounded) + { // background + int id_fils = ajouter(&jobs, pid_fils, *(cmd->seq)); + printf("[%d] %d\n", id_fils, pid_fils); + } + else + { // foreground + attendre(pid_fils); + } + } + } + + return EXIT_SUCCESS; +} diff --git a/jobs b/jobs index 3eed0f9098bf235cc79798832f0673fcc6f01ece..6c9e998a0a7278ce3b241c162bb0fc651248c537 100755 GIT binary patch literal 33272 zcmeHw3wV^(we~kN*^_T_o!k>HG72bO2p5H-f+R>_P^id7173!ZOp?*unwjBZRgi#f z8d1<*tmRj%J+^wV+Wxim;0-UwP)}R&)B;*tsR!(&Xn$I@Cv9!>zwf?Gz8Nw-J?A{n zd7l6I*^qDTwf0(Tuf6tt&v)5Ww|Ifu<+4ohSeIDDP82ChjZPTcpd$b^)+{R@*9q2m z%L_b9(o}kl0!UTiusapnn(hIlTqPqTz%hz!8E7mdq+F)3KTo9?X!#XRIl-vL)8WUJ ziqAlkp3HBmO1IMB6H=*V8R(RwZxVBqTw+No4Cr!iAQOYOi|!(6P|FQ!IRlSqM;K`Q zNuTgn1y=vUPp`Dxo2`AM8F`oGO2OS42a62kEyW+*P5Fo3-MIFbb5>8h_PeEvCw%s< z1NOQd2g$>7P$zj9NaLRgH2)0zkw^N+6|gp2mMj(N%_|%H7yiD_bR$qwLpB79Q%Mp# z7uS*Kp$zo=4D|D$KY+CK@B$)uD(73+IYF^(RiG`U*L!(sK5bKOs>l-4mt_V`Qx+5L2X6SF+&=6{lbTqU@ zZUQ$HD!r(VT(kLlryb`ixxhh~2e=<(d{B74cCnzy^$9=5y07j_5{oLeJNRzQZ)G^!B3h!&fMM?00%8 zAqhtubdIeiBph_3nrSB-^s$B+aL_>yIOwKbGf!u~FzuT3@ecmVr3%Rg&@PaKfP?OK z@K18k^^!uSPIb_o^Vlp0oxU)k#zAM^CIlUH<7=iZb!XnF-%=(8~=G z@CgUK!a;w^LDx%RnYzzGuX6D3chETpn{dEEA8m+$haGh1V&sT}ewu?n;h>Lm&`&t% zr#tAUqNhA?$^-v-4}4g7+Mj|w@7uvX@#b913U1pMa}ON|_PlJrB$W-#co*cMiA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-j50d2jtGqfsZTj=7rP>lXYxPF0O&(u8L_01otS%T< zG8oc$%t5k;k-ba|;QBMizo}n79#ZXFs=cV%1pVqTSd3hSSPtt>o^K4JEKeS93`{7- zVd=YmcX+c&PaZ;X`ccn3&^@qbmEJW0Z`h2`WU@tMGe{pnQk>TxtRlqK?ol$2n=;Aj zlRN>H$#>QUwEs{tubVR0e(}NBTf{9sYjUsup5t?qe*Je6e^cK5WWRU_azYU%k1UtW z0ThBxqq{y=lT}pXa`M%mm{+WNr3qV*4J?&}JZe4}Ns{I=x@J<=qfiWH_N*{T%F-$X{sjMl$T zOxACiv5{J6_SQQnH*$*>mJe?(^cLazM^6$q$qzx@YfeHE z&XB<^h0f%+#c?5T-7?ORgNq71IkI!h_|zB7$uFAkl^<@2ieqNMmfF^U+_=@7`UQA$ z_0{?0o~~qvJHI?2Jy+vgJF`Y0iBn>rkf5Z5!uUhU*qR56H^4@y;(R z4D4|s_q2_3K3Hv_noWKL*&nYk&^B3Z%aS*28|chgX;6@u#oNX?*g6B9EFa!B-Z^=L Lfz=|2yZZiL0hk #include "jobs.h" -void ajouter(list *l_ptr, int pid, int id, char **seq, int state) +int ajouter(list *l_ptr, int pid, char **seq) { - cell *new_cell = malloc(sizeof(*new_cell)); char *cmd; @@ -19,26 +18,45 @@ void ajouter(list *l_ptr, int pid, int id, char **seq, int state) strcat(cmd, " "); } + new_cell->id = 1; new_cell->pid = pid; - new_cell->id = id; new_cell->cmd = cmd; - new_cell->state = state; + new_cell->next = NULL; - if (*l_ptr == NULL) + cell *cursor = *l_ptr; + if (cursor == NULL) { - new_cell->next = NULL; + *l_ptr = new_cell; + } + else if (cursor->id > 1) + { + new_cell->next = cursor; + *l_ptr = new_cell; } else { - new_cell->next = *l_ptr; + while (cursor->next != NULL) + { + new_cell->id++; + if (new_cell->id < cursor->next->id) + { + new_cell->next = cursor->next; + cursor->next = new_cell; + break; + } + cursor = cursor->next; + } + if (cursor->next == NULL) + { + new_cell->id++; + cursor->next = new_cell; + } } - - *l_ptr = new_cell; + return new_cell->id; } void supprimer(list *l_ptr, int pid) { - cell *cursor = *l_ptr; if (cursor->pid == pid) @@ -68,12 +86,10 @@ void supprimer(list *l_ptr, int pid) void afficher(list *l_ptr) { - cell *cursor = *l_ptr; - while (cursor != NULL) { - printf("[%d] %d\n", cursor->id, cursor->pid); + printf("[%d] %d : %s\n", cursor->id, cursor->pid, cursor->cmd); cursor = cursor->next; } } @@ -85,8 +101,8 @@ void initialiser(list *l_ptr) void liberer(list *l_ptr) { - cell* cursor2free; - cell* cursor = *l_ptr; + cell *cursor2free; + cell *cursor = *l_ptr; while (cursor != NULL) { cursor2free = cursor; @@ -111,5 +127,21 @@ cell *trouver(list *l_ptr, int pid) cursor = cursor->next; } + return NULL; // erreur +} + +cell *trouver_id(list *l_ptr, int id) +{ + cell *cursor = *l_ptr; + + while (cursor != NULL) + { + if (cursor->id == id) + { + return cursor; + } + cursor = cursor->next; + } + return NULL; // erreur } \ No newline at end of file diff --git a/jobs.h b/jobs.h index e843816..20259ba 100644 --- a/jobs.h +++ b/jobs.h @@ -8,16 +8,18 @@ struct cell int pid; char *cmd; cell *next; - int state; }; typedef cell *list; -void ajouter(cell **list, int pid, int id, char **cmd, int state); -void supprimer(cell **list, int pid); -void afficher(cell **list); void initialiser(list *list); void liberer(list *list); +void afficher(cell **list); + +int ajouter(cell **list, int pid, char **cmd); +void supprimer(cell **list, int pid); + cell *trouver(list *l_ptr, int pid); +cell *trouver_id(list *l_ptr, int id); #endif \ No newline at end of file diff --git a/list.c b/list.c new file mode 100644 index 0000000..0a788a4 --- /dev/null +++ b/list.c @@ -0,0 +1,83 @@ +#include +#include +#include "list.h" + +#define INIT_LIMIT 8 + +void init(list *l_ptr) +{ + l_ptr->limit = INIT_LIMIT; + l_ptr->jobs = malloc(l_ptr->limit * sizeof(job)); + if (l_ptr->jobs == NULL) + { + printf(stderr, "ERROR: malloc failed\n"); + exit(1); + } +} + +job add(list *l_ptr, int pid, char **cmd, int state) +{ + job new_job; + new_job.pid = pid; + new_job.cmd = cmd; + new_job.used = 1; + + for (int i = 0; i < l_ptr->size; i++) + { + if (!l_ptr->jobs[i].used) + { + l_ptr->jobs[i] = new_job; + return new_job; + } + } + + l_ptr->limit = l_ptr->limit * 2; + l_ptr->jobs = realloc(l_ptr->jobs, l_ptr->limit * sizeof(job)); + if (l_ptr->jobs == NULL) + { + printf(stderr, "ERROR: realloc failed\n"); + exit(1); + } + l_ptr->jobs[l_ptr->limit / 2] = new_job; + return new_job; +} + +int is_empty(list l_ptr) +{ + return l_ptr.size == 0; +} + +job remove(list *l_ptr, int pid) +{ + if (is_empty(*l_ptr)) + { + printf(stderr, "ERROR: jobs is empty, cannot remove\n"); + exit(1); + } + + for (int i = 0; i < l_ptr->size; i++) + { + if (l_ptr->jobs[i].pid == pid) + { + job job = l_ptr->jobs[i]; + job.used = 0; + return l_ptr->jobs[i]; + } + } +} + +job top(list l_ptr) +{ + return l_ptr.jobs[l_ptr.size - 1]; +} + +job get(list l_ptr, int index) +{ + return l_ptr.jobs[index]; +} + +void free(list *l_ptr) +{ + free(l_ptr->jobs); + l_ptr->jobs = NULL; +} \ No newline at end of file diff --git a/list.h b/list.h new file mode 100644 index 0000000..7dae76f --- /dev/null +++ b/list.h @@ -0,0 +1,25 @@ +#ifndef __LIST_H +#define __LIST_H + +typedef struct job +{ + int pid; + char *cmd; + int used; +} job; + +typedef struct list { + job *jobs; + int size; + int limit; +} list; + + +void init(list *list); +void free(list *list); +void print(list *list); + +job add(list *list, int pid, char **cmd, int state); +job remove(list *list, int pid); + +#endif \ No newline at end of file diff --git a/minishell b/minishell index 4ef753f9263845c9ac4a5238bb28bd565dbefce1..b5bc3d75c5c973824720fea8c2ab22c5df1fba38 100755 GIT binary patch delta 12123 zcmbVS3w#vS)t{N&yP4hWCi}=^Hwnpx5QHcpiGn;sVhL<8NP?-9!+o5oJEb^j^fQkJH1Wog_g z=UcocjrE%N968@yV9?l&e4G4Lc2beX4X3YbV(E2$uW}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|BJwRL*DJ9xI#4NOQ{OFnjxf5=E z=2skDjDOk14>6Pk>4aG^4Ede>?Io$+h44y568cx6Riu?46zxRb-k2&sA?yzt_Wi$B zy+Yc;cMNU+?@wn8dH-)k7X-dW_!S>u+B7fo{$$QK9de4$EG}n^_y<8w^9}c#Z-I#R z7SY~Ct-6#FDt=zmv(!4=rFigR(*Q9@NQ~{o%YiO1bGn24z0VpER2mti3QpG{((+x) zSfF%|2F=Kh|4RPx6c!X{RLrfjwbP)jao&- zz%UD;S@IJwxD&DT-xukSQ(pVuNqxM1d1}RthPMBQ&LYTZmCR=Xu;RMKugSkeBoI|8{_bNQ6O`kY!- z#m!Fq&`QS5Y(;8zA$alAD&z6Q9DkxAFYT;YIbGognmM1b>Rn#6`rr7`)t(f+)Jgp- zJ7=$X(jpgdd40aigZn65CavdXkhU1(m~2)lXW@vj8qT5gqh^0L-czP-ic z`j;Qp@nbFdu0=QKv6|G=DF?>Oa+sF|viST~r` +#include +#include +#include +#include +#include +#include +#include +#include "readcmd.h" +#include "jobs.h" + +extern int errno; + +struct cmdline *cmd; + +int pid_fils; + +list jobs; + +int prompting = 0; +jmp_buf goto_prompt; + +char initcd[256], currentcd[256]; + +void handler_sigchld(int sig_num, siginfo_t *info) +{ + cell *job = trouver(&jobs, info->si_pid); + if (job) + { + if (prompting) + { + printf("\n"); + } + + printf("[%d] %d done: %s\n", job->id, job->pid, job->cmd); + supprimer(&jobs, job->pid); + + if (prompting) + { + siglongjmp(goto_prompt, sig_num); + } + } +} + +void handler_sigint(int sig_num) +{ + printf("\n"); + siglongjmp(goto_prompt, sig_num); +} + +void handler_sigtstp(int sig_num) +{ + if (!prompting) + { + kill(pid_fils, SIGTSTP); + int id_fils = ajouter(&jobs, pid_fils, *(cmd->seq)); + printf("[%d] %d suspended\n", id_fils, pid_fils); + siglongjmp(goto_prompt, sig_num); + } + else + { + handler_sigint(sig_num); + } +} + +void attendre(int pid) +{ + int wait_code; + pid_t id = waitpid(pid, &wait_code, 0); // on attend la fin de l'exec du fils + + if (id == -1) + { // wait fail ? + fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", wait_code, errno, strerror(errno)); + exit(errno); + } + + if (wait_code) + { // execvp fail ? + fprintf(stderr, "ERROR: %d's execution failed, (%d) %s\n", pid, wait_code, strerror(wait_code)); + } +} + +int main(int argc, char *argv[]) +{ + initialiser(&jobs); + getcwd(initcd, sizeof(initcd)); + + // gestion des signaux + struct sigaction action; + sigemptyset(&action.sa_mask); + action.sa_flags = SA_SIGINFO | SA_RESTART; + action.sa_handler = handler_sigchld; + sigaction(SIGCHLD, &action, NULL); + action.sa_handler = handler_sigint; + sigaction(SIGINT, &action, NULL); + action.sa_handler = handler_sigtstp; + sigaction(SIGTSTP, &action, NULL); + + // loop principal + while (1) + { + sigsetjmp(goto_prompt, 1); + + prompting = 1; + getcwd(currentcd, sizeof(currentcd)); + printf("%s >>> ", currentcd); + cmd = readcmd(); + prompting = 0; + + if (cmd == NULL) + { // EOF + break; + } + else if (cmd->seq[0] == NULL) + { // empty + continue; + } + else if (!strcmp(cmd->seq[0][0], "exit")) + { // "exit" + break; + } + else if (!strcmp(cmd->seq[0][0], "cd")) + { // "cd" + int ret = 0; + if (cmd->seq[0][1] == NULL) + { // no path + ret = chdir(initcd); + } + else + { // with path + ret = chdir(cmd->seq[0][1]); + } + if (ret) + { // wrong path + fprintf(stderr, "ERROR: cd failed, (%d) %s\n", errno, strerror(errno)); + } + continue; + } + else if (!strcmp(cmd->seq[0][0], "jobs")) + { // "jobs" + afficher(&jobs); + continue; + } + else if (!strcmp(cmd->seq[0][0], "bg")) + { // "bg" + kill(pid_fils, SIGCONT); + continue; + } + else if (!strcmp(cmd->seq[0][0], "fg")) + { // "fg" + cell *job; + if (cmd->seq[0][1] == NULL) + { // no id + fprintf(stderr, "ERROR: fg id error"); + continue; + } + else + { // id specified + job = &(jobs[atoi(cmd->seq[0][1]) - 1]); + } + kill(job->pid, SIGCONT); + printf("[%d] %d continued: %s\n", job->id, job->pid, job->cmd); + supprimer(&job, job->pid); + attendre(job->pid); + continue; + } + pid_fils = fork(); + if (pid_fils == -1) + { // fork fail ? + fprintf(stderr, "ERROR: forking failed, (%d) %s\n", errno, strerror(errno)); + exit(errno); + } + + if (pid_fils == 0) + { // instructions du fils + action.sa_handler = SIG_DFL; + sigaction(SIGTSTP, &action, NULL); // on default SIGTSTP + sigaction(SIGCONT, &action, NULL); // on default SIGCONT + + if (cmd->backgrounded) + { // background + action.sa_handler = SIG_IGN; + sigaction(SIGINT, &action, NULL); // on ignore SIGINT + sigaction(SIGTSTP, &action, NULL); // on ignore SIGTSTP + } + + execvp(cmd->seq[0][0], cmd->seq[0]); + exit(errno); // si execlp échoue on exit avec une erreur + } + else + { // instructions du père + if (cmd->backgrounded) + { // background + int id_fils = ajouter(&jobs, pid_fils, *(cmd->seq)); + printf("[%d] %d\n", id_fils, pid_fils); + } + else + { // foreground + attendre(pid_fils); + } + } + } + + return EXIT_SUCCESS; +} diff --git a/minishell.c b/minishell.c index 5efdfe7..623c806 100644 --- a/minishell.c +++ b/minishell.c @@ -15,9 +15,8 @@ extern int errno; struct cmdline *cmd; -int pid_fils; +int pid_fils, wait_code; -int job_id = 0; list jobs; int prompting = 0; @@ -25,62 +24,86 @@ jmp_buf goto_prompt; char initcd[256], currentcd[256]; - - -void handler_sigchld(int sig_num, siginfo_t *info) +void handler_sigchld(int sig_num) { - cell *job = trouver(&jobs, info->si_pid); - if (job) + do { - if (prompting) - { - printf("\n"); + pid_fils = waitpid(-1, &wait_code, WNOHANG | WUNTRACED | WCONTINUED); + if ((pid_fils == -1) && (errno != ECHILD)) + { // wait fail ? + fprintf(stderr, "ERROR: waiting for child failed, (%d) %s\n", errno, strerror(errno)); + exit(errno); } - printf("[%d] %d done: %s\n", job->id, job->pid, job->cmd); - supprimer(&jobs, job->pid); - job_id--; - - if (prompting) + cell *job = trouver(&jobs, pid_fils); + if (job != NULL) { - siglongjmp(goto_prompt, sig_num); + if (prompting) + { + printf("\n"); + } + + if (WIFSTOPPED(wait_code)) + { + printf("[%d] %d suspended: %s\n", job->id, job->pid, job->cmd); + } + else if (WIFCONTINUED(wait_code)) + { + printf("[%d] %d continued: %s\n", job->id, job->pid, job->cmd); + } + else if (WIFEXITED(wait_code)) + { + printf("[%d] %d done: %s\n", job->id, job->pid, job->cmd); + supprimer(&jobs, job->pid); + } + + if (prompting) + { + siglongjmp(goto_prompt, sig_num); + } } - } + } while (pid_fils > 0); } - - void handler_sigint(int sig_num) { printf("\n"); + if (!prompting) + { + kill(pid_fils, SIGKILL); + pause(); + } siglongjmp(goto_prompt, sig_num); } - - void handler_sigtstp(int sig_num) { + printf("\n"); if (!prompting) { - kill(pid_fils, SIGTSTP); - ajouter(&jobs, pid_fils, ++job_id, *(cmd->seq), 1); - printf("[%d] %d suspended\n", job_id, pid_fils); - siglongjmp(goto_prompt, sig_num); - } - else - { - handler_sigint(sig_num); + ajouter(&jobs, pid_fils, *(cmd->seq)); + kill(pid_fils, SIGSTOP); + pause(); } + siglongjmp(goto_prompt, sig_num); } - - -void handler_sigcont(int sig_num) +void attendre(int pid) { + pid_t id = waitpid(pid, &wait_code, 0); // on attend la fin de l'exec du fils + if (id == -1) + { // wait fail ? + fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", wait_code, errno, strerror(errno)); + exit(errno); + } + + if (wait_code) + { // execvp fail ? + fprintf(stderr, "ERROR: %d's execution failed, (%d) %s\n", pid, wait_code, strerror(wait_code)); + } } - int main(int argc, char *argv[]) { initialiser(&jobs); @@ -97,7 +120,7 @@ int main(int argc, char *argv[]) action.sa_handler = handler_sigtstp; sigaction(SIGTSTP, &action, NULL); - // loop principal + // main loop while (1) { sigsetjmp(goto_prompt, 1); @@ -120,11 +143,6 @@ int main(int argc, char *argv[]) { // "exit" break; } - else if (!strcmp(cmd->seq[0][0], "jobs")) - { // "jobs" - afficher(&jobs); - continue; - } else if (!strcmp(cmd->seq[0][0], "cd")) { // "cd" int ret = 0; @@ -142,6 +160,49 @@ int main(int argc, char *argv[]) } continue; } + else if (!strcmp(cmd->seq[0][0], "jobs")) + { // "jobs" + afficher(&jobs); + continue; + } + else if (!strcmp(cmd->seq[0][0], "bg")) + { // "bg" + cell *job; + if (cmd->seq[0][1] == NULL) + { // no id + fprintf(stderr, "ERROR: fg id error\n"); + continue; + } + else + { // id specified + job = trouver_id(&jobs, atoi(cmd->seq[0][1])); + } + kill(job->pid, SIGCONT); + pause(); + continue; + } + else if (!strcmp(cmd->seq[0][0], "fg")) + { // "fg" + cell *job; + if (cmd->seq[0][1] == NULL) + { // no id + fprintf(stderr, "ERROR: fg id error\n"); + continue; + } + else + { // id specified + job = trouver_id(&jobs, atoi(cmd->seq[0][1])); + } + kill(job->pid, SIGCONT); + pause(); + attendre(job->pid); + continue; + } + else if (!strcmp(cmd->seq[0][0], "pid")) + { // "pid" + printf("pid=%d\n", getpid()); + continue; + } pid_fils = fork(); if (pid_fils == -1) @@ -152,18 +213,10 @@ int main(int argc, char *argv[]) if (pid_fils == 0) { // instructions du fils - action.sa_handler = SIG_DFL; - sigaction(SIGTSTP, &action, NULL); // on default SIGTSTP - sigaction(SIGCONT, &action, NULL); // on default SIGCONT + action.sa_handler = SIG_IGN; + sigaction(SIGTSTP, &action, NULL); // on igonre SIGTSTP + sigaction(SIGINT, &action, NULL); // on ignore SIGINT - if (cmd->backgrounded) - { // background - action.sa_handler = SIG_IGN; - sigaction(SIGINT, &action, NULL); // on ignore SIGINT - sigaction(SIGTSTP, &action, NULL); // on ignore SIGTSTP - - } - execvp(cmd->seq[0][0], cmd->seq[0]); exit(errno); // si execlp échoue on exit avec une erreur } @@ -171,24 +224,12 @@ int main(int argc, char *argv[]) { // instructions du père if (cmd->backgrounded) { // background - ajouter(&jobs, pid_fils, ++job_id, *(cmd->seq), 0); - printf("[%d] %d\n", job_id, pid_fils); + int id_fils = ajouter(&jobs, pid_fils, *(cmd->seq)); + printf("[%d] %d\n", id_fils, pid_fils); } else { // foreground - int wait_code; - pid_t id_fils = waitpid(pid_fils, &wait_code, 0); // on attend la fin de l'exec du fils - - if (id_fils == -1) - { // wait fail ? - fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", wait_code, errno, strerror(errno)); - exit(errno); - } - - if (wait_code) - { // execvp fail ? - fprintf(stderr, "ERROR: %d's execution failed, (%d) %s\n", pid_fils, wait_code, strerror(wait_code)); - } + attendre(pid_fils); } } } diff --git a/minishell2.c b/minishell2.c new file mode 100644 index 0000000..d829781 --- /dev/null +++ b/minishell2.c @@ -0,0 +1,210 @@ +#define _GNU_SOURCE + +#include +#include +#include +#include +#include +#include +#include +#include +#include "readcmd.h" +#include "jobs.h" + +extern int errno; + +struct cmdline *cmd; + +int pid_fils; + +int job_id = 0; +list jobs; + +int prompting = 0; +jmp_buf goto_prompt; + +char initcd[256], currentcd[256]; + +void handler_sigchld(int sig_num, siginfo_t *info) +{ + cell *job = trouver(&jobs, info->si_pid); + if (job && !job->state) + { + if (prompting) + { + printf("\n"); + } + + printf("[%d] %d done: %s\n", job->id, job->pid, job->cmd); + supprimer(&jobs, job->pid); + job_id--; + + if (prompting) + { + siglongjmp(goto_prompt, sig_num); + } + } +} + +void handler_sigint(int sig_num) +{ + printf("\n"); + siglongjmp(goto_prompt, sig_num); +} + +void handler_sigtstp(int sig_num) +{ + if (!prompting) + { + kill(pid_fils, SIGTSTP); + cell *job = ajouter(&jobs, pid_fils, ++job_id, *(cmd->seq), 1); + printf("[%d] %d suspended: %s\n", job_id, pid_fils, job->cmd); + siglongjmp(goto_prompt, sig_num); + } + else + { + handler_sigint(sig_num); + } +} + +void attendre(int pid) +{ + int wait_code; + pid_t id = waitpid(pid, &wait_code, 0); // on attend la fin de l'exec du fils + + if (id == -1) + { // wait fail ? + fprintf(stderr, "ERROR: waiting for %d failed, (%d) %s\n", wait_code, errno, strerror(errno)); + exit(errno); + } + + if (wait_code) + { // execvp fail ? + fprintf(stderr, "ERROR: %d's execution failed, (%d) %s\n", pid, wait_code, strerror(wait_code)); + } +} + +int main(int argc, char *argv[]) +{ + initialiser(&jobs); + getcwd(initcd, sizeof(initcd)); + + // gestion des signaux + struct sigaction action; + sigemptyset(&action.sa_mask); + action.sa_flags = SA_SIGINFO | SA_RESTART; + action.sa_handler = handler_sigchld; + sigaction(SIGCHLD, &action, NULL); + action.sa_handler = handler_sigint; + sigaction(SIGINT, &action, NULL); + action.sa_handler = handler_sigtstp; + sigaction(SIGTSTP, &action, NULL); + + // loop principal + while (1) + { + sigsetjmp(goto_prompt, 1); + + prompting = 1; + getcwd(currentcd, sizeof(currentcd)); + printf("%s >>> ", currentcd); + cmd = readcmd(); + prompting = 0; + + if (cmd == NULL) + { // EOF + break; + } + else if (cmd->seq[0] == NULL) + { // empty + continue; + } + else if (!strcmp(cmd->seq[0][0], "exit")) + { // "exit" + break; + } + else if (!strcmp(cmd->seq[0][0], "cd")) + { // "cd" + int ret = 0; + if (cmd->seq[0][1] == NULL) + { // no path + ret = chdir(initcd); + } + else + { // with path + ret = chdir(cmd->seq[0][1]); + } + if (ret) + { // wrong path + fprintf(stderr, "ERROR: cd failed, (%d) %s\n", errno, strerror(errno)); + } + continue; + } + else if (!strcmp(cmd->seq[0][0], "jobs")) + { // "jobs" + afficher(&jobs); + continue; + } + else if (!strcmp(cmd->seq[0][0], "bg")) + { // "bg" + kill(pid_fils, SIGCONT); + continue; + } + else if (!strcmp(cmd->seq[0][0], "fg")) + { // "fg" + cell *job; + if (cmd->seq[0][1] == NULL) + { // no id + fprintf(stderr, "ERROR: fg id error"); + continue; + } + else + { // id specified + job = &(jobs[atoi(cmd->seq[0][1]) - 1]); + } + kill(job->pid, SIGCONT); + printf("[%d] %d continued: %s\n", job->id, job->pid, job->cmd); + supprimer(&job, job->pid); + job_id--; + attendre(job->pid); + continue; + } + pid_fils = fork(); + if (pid_fils == -1) + { // fork fail ? + fprintf(stderr, "ERROR: forking failed, (%d) %s\n", errno, strerror(errno)); + exit(errno); + } + + if (pid_fils == 0) + { // instructions du fils + action.sa_handler = SIG_DFL; + sigaction(SIGTSTP, &action, NULL); // on default SIGTSTP + sigaction(SIGCONT, &action, NULL); // on default SIGCONT + + if (cmd->backgrounded) + { // background + action.sa_handler = SIG_IGN; + sigaction(SIGINT, &action, NULL); // on ignore SIGINT + sigaction(SIGTSTP, &action, NULL); // on ignore SIGTSTP + } + + execvp(cmd->seq[0][0], cmd->seq[0]); + exit(errno); // si execlp échoue on exit avec une erreur + } + else + { // instructions du père + if (cmd->backgrounded) + { // background + ajouter(&jobs, pid_fils, ++job_id, *(cmd->seq), 0); + printf("[%d] %d\n", job_id, pid_fils); + } + else + { // foreground + attendre(pid_fils); + } + } + } + + return EXIT_SUCCESS; +} diff --git a/readcmd b/readcmd index 6ee49c7ced48f923814a75361e80c81d16667339..ab3506042937fec2369c4a928f40ad84bb57c9e0 100755 GIT binary patch literal 33480 zcmeHw37AyXmH(@%zSXaKsjl9;Sxb<`g$5T86{JC03IxT4*nnCz-PPTty``%P8Y6-> zIH|N4Fq<(XnmFSYOf>V?__?AcHe)tSjNpu!Fpiq)pb17zI*F#|_q$8=tFkMT`Oo*w zH{buyg?{IrbI&>V+;jK)UcI-iVdVvGm&-E2W1VM7tV~hrb;5xyhQqSzt@&0lt|wYk zEicG<_^a2++3>JiB^YRHJ`W(}Y8V*;gl1MYCIdR8K?LR zH0kO5=BRWl3)*x5f`LvsCZ!h2WGl5Q6VBA-?$h!{j_x99Sj!D-IRlSqM;K`QNuTg< zzSf%!>ygG#FR!pyLnGH`?8$;lHJ^dxXSnRmcnjm%`53&OObGSzI-1{VEqCJSDj^$w zPxBjS^1B3b##Nf-uL4uem+Jg-)kBSLp9X68TC+Q%8|R%lyQ5`RN3<)^H>+>{yjkbxF?xy@7PVai4Z`&oyPCXc$ zP}F_O)5!&A{)#*-2X&H%fi(V^K=Y^Kk37;puAsHuvSg`9Z(Y+AIQw@4rW=8h8T=5` zT|Fb=6kub~TXWFa-NxcS1NwtV%MMS2Fc$yf9Q4a_&^PCxvpbKa|CJo{-8tw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#`g z)G*usuW5Y~f3xo~@S|D&oA?{Eyfc#`M&F!!82G#q)G)jJm$LL57AZjkt91W2X0pqF z6%0P(XvEBUjQL&VY9o*?i3I9kc^zdCU8SP2?qO)Dc_tEncvAC(edN> zWiooE9p3?sB1Yf*KIicjl*Z!|3Zy@czJdP+j$1!{zEr1FPNg+f#^@QyU!QU7oBjDI zt*;*hOsU#fJF|@6B=v+eqQVUU6upc`sag?O{0~*jmp-eSsgxGmgfZ7G-}S?tn{zS z3V62cm0CYLe!Wdf-=Ch?6mIklQ&ilbMUD-+2t35KAFDFo6V8_qxJ9q0Z$^o00000 diff --git a/test.sh b/test.sh index 1c0a797..fe779ba 100644 --- a/test.sh +++ b/test.sh @@ -1,2 +1,2 @@ -sleep 5 -printf "\n\nbonjourr\n\n" \ No newline at end of file +sleep 3 +printf "\n\n\n\n bonjour \n\n\n\n" \ No newline at end of file