#include #include #include #include #include #include "lsh_main_func.c" #include "lsh_builtins.c" typedef struct{ char *prompt; } SHELL_OB; void lsh_loop(SHELL_OB *shell_obj) { char *line; char **args; int status; do { printf("%s",shell_obj->prompt); line = lsh_read_line(); args = lsh_split_line(line); status = lsh_execute(args); free(line); free(args); } while (status); } int main(int argc, char **argv){ SHELL_OB shell_obj; //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), "> "); lsh_loop(&shell_obj); free(hostname); return EXIT_SUCCESS; }