sophuwu.site > bashprompt
push to test on server :/
sophuwu sophie@skisiel.com
Thu, 25 Apr 2024 01:45:19 +0200
commit

316c00dcdf29cfc55c8fea15448ab749913705f6

parent

cb2b76c59acd5e8847ace61b4c15b29634b5428f

1 files changed, 1 insertions(+), 2 deletions(-)

jump to
M src/prompt.cppsrc/prompt.cpp

@@ -65,9 +65,8 @@ char ip[8];

pipe("hostname -I | awk -F '.' ' { printf(\"%X%X%X%X\",int($1),int($2),int($3),int($4)); } ' ", ip); unsigned char ipaddr[4]; for (int i = 0; i < 4; i++)ipaddr[i] = unhex(ip[2*i])<<4 | unhex(ip[2*i+1]); - for (int i = 0; i < 4; i++)printf("\033[38;5;%dm%c", ipaddr[i] & 0xFF, host[host.length()-4+i]); + for (int i = 0; i < 4; i++)printf("\033[1;38;5;%dm%c", ipaddr[i] , host[i*(host.length()/4)]); printf("\033[0m\n"); - int h, m;