aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.c')
-rwxr-xr-xsrc/main.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index a107950..59f474b 100755
--- a/src/main.c
+++ b/src/main.c
@@ -1,7 +1,5 @@
#include <stdio.h>
#include <stdlib.h>
-#include <string.h>
-#include <sys/wait.h>
#include <unistd.h>
#include "lsh_main_func.c"
@@ -30,15 +28,17 @@ void lsh_loop(SHELL_OB *shell_obj)
int main(int argc, char **argv){
SHELL_OB shell_obj;
+ shell_obj.prompt = (char *)malloc(sizeof(char) * 1024);
//get the hostname
char *hostname = (char *)malloc(sizeof(char) * 1024);
gethostname(hostname,sizeof(char) * 1024);
- shell_obj.prompt=strcat(strcat(strcat(getenv("USER"), "@"), (char *)hostname), "> ");
+ snprintf(shell_obj.prompt,sizeof(char) * 1024,"%s@%s> ",getenv("USER"),hostname);
lsh_loop(&shell_obj);
free(hostname);
+ free(shell_obj.prompt);
return EXIT_SUCCESS;
}