(feat): plus beau ❤

This commit is contained in:
guamss 2023-06-29 17:11:24 +02:00
parent ca22f2c9d0
commit 858a4a9456

View File

@ -37,12 +37,24 @@ static char* get_prompt(lst** env)
strcpy(cwd, "~"); strcpy(cwd, "~");
strcat(cwd, cwd + strlen(home)); strcat(cwd, cwd + strlen(home));
} }
size = snprintf(NULL, 0, "%s@%s>%s $ ",user, hostname_buff, cwd) + 10; if (strcmp(user, "root") == 0)
out = malloc(size*sizeof(char)); {
if(out == NULL) size = snprintf(NULL, 0, "[%s@%s] > %s # ",user, hostname_buff, cwd) + 10;
return NULL; out = malloc(size*sizeof(char));
sprintf(out, "%s@%s > %s $ ",user, hostname_buff, cwd); if(out == NULL)
return out; return NULL;
sprintf(out, "[%s@%s] > %s # ",user, hostname_buff, cwd);
return out;
}
else
{
size = snprintf(NULL, 0, "[%s@%s] >%s $ ",user, hostname_buff, cwd) + 10;
out = malloc(size*sizeof(char));
if(out == NULL)
return NULL;
sprintf(out, "[%s@%s] > %s $ ",user, hostname_buff, cwd);
return out;
}
} }
char *get_user_input(lst** env) char *get_user_input(lst** env)