Browse Source

Utilisation constante couleur

Loquicom 6 years ago
parent
commit
e76940f507
2 changed files with 4 additions and 3 deletions
  1. 1 1
      makefile
  2. 3 2
      mysh.c

+ 1 - 1
makefile

@@ -113,6 +113,6 @@ ipc.o: ipc.c ipc.h constante.h sem.h shm.h subdiv.h variable.h
 expreg.o: expreg.c expreg.h constante.h
 variable.o: variable.c str.h expreg.h constante.h variable.h subdiv.h
 mysh.o: mysh.c error.h str.h parser.h constante.h mysh.h command.h ipc.h \
- sem.h shm.h subdiv.h execute.h
+ sem.h shm.h subdiv.h execute.h color.h
 myls.o: myls.c error.h color.h constante.h
 myps.o: myps.c error.h color.h constante.h

+ 3 - 2
mysh.c

@@ -20,6 +20,7 @@
 #include "mysh.h"
 #include "ipc.h"
 #include "execute.h"
+#include "color.h"
 
 /* --- Extern --- */
 extern Error error;
@@ -94,7 +95,7 @@ int main(int argc, char* argv[], char* envp[]) {
         error.exit_err();
     }
     //Preparation affichage
-    sprintf(before, "\x1b[32m%s:\x1b[36m", getlogin());
+    sprintf(before, GREEN "%s:" CYAN, getlogin());
     //Traitement des signeaux
     result = sigemptyset(&sigs_new);
     if(result == ERR){	
@@ -129,7 +130,7 @@ int main(int argc, char* argv[], char* envp[]) {
                 job--;
     	}
         //Affichage repertoire
-        show_current_dir(before, ">\x1b[0m ");      
+        show_current_dir(before, ">" RESET " ");      
         //Lecture ligne
         if(get_line(line) == SHELL_ERR){
             //error.print("Impossible de lire les commandes\n");