diff options
Diffstat (limited to 'src/main.c')
| -rwxr-xr-x | src/main.c | 18 |
1 files changed, 3 insertions, 15 deletions
@@ -48,23 +48,11 @@ int main(int argc, char **argv){ //Set The prompt SHELL_OB shell_obj; - shell_obj.prompt = (char *)malloc(sizeof(char) * 1024); - if (!shell_obj.prompt){ - fprintf(stderr, "lsh: allocation error\n"); - exit(EXIT_FAILURE); - } - shell_obj.pre_prompt = (char *)malloc(sizeof(char) * 1024); - if (!shell_obj.pre_prompt){ - fprintf(stderr, "lsh: allocation error\n"); - exit(EXIT_FAILURE); - } + shell_obj.prompt = (char *)malloce(sizeof(char) * 1024); + shell_obj.pre_prompt = (char *)malloce(sizeof(char) * 1024); //get the hostname - char *hostname = (char *)malloc(sizeof(char) * 1024); - if (!hostname) { - fprintf(stderr, "lsh: allocation error\n"); - exit(EXIT_FAILURE); - } + char *hostname = (char *)malloce(sizeof(char) * 1024); gethostname(hostname,sizeof(char) * 1024); //set the pre_prompt |
