From e3254263204f17b8bdeddf89733614fad5ef6361 Mon Sep 17 00:00:00 2001 From: Krystian Rzepa Date: Wed, 19 Dec 2018 18:28:05 +0000 Subject: [PATCH] Zaktualizuj 'microshell/microshell.c' --- microshell/microshell.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/microshell/microshell.c b/microshell/microshell.c index 54715a5..edf6922 100644 --- a/microshell/microshell.c +++ b/microshell/microshell.c @@ -7,6 +7,14 @@ #define space " \n" #define max_c 500 +#define BRIGHT 1 +#define RED 31 +#define GREEN 32 +#define YELLOW 33 +#define BLUE 34 +#define PINK 35 +#define CYAN 36 +#define WHITE 37 int help() { printf ("microshell v1.0. © 2018 Krystian Rzepa\n"); @@ -37,12 +45,23 @@ int main() pw = getpwuid (uid); char line[max_c], lend[max_c], * commands[max_c], ** command; + + void domyslny_kolor() + { + printf("%c[%dm",0x1B,0); + } while (1) { gethostname(hostName, 99); getcwd(cwd, 999); - printf("%s@%s %s $ ", pw->pw_name, hostName, cwd); + printf("%c[%dm%s",0x1B, YELLOW, pw->pw_name); + domyslny_kolor(); + printf("@"); + printf("%c[%dm%s ",0x1B, YELLOW, hostName); + printf("%c[%dm%s",0x1B, CYAN, cwd); + printf("%c[%dm $ ",0x1B, GREEN); + domyslny_kolor(); fflush(stdout); if (fgets(line, max_c, stdin )) {