aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authoriceyrazor <iceyrazor@mailfence.com>2026-02-27 19:53:33 -0600
committericeyrazor <iceyrazor@mailfence.com>2026-02-27 19:53:33 -0600
commit1eb83090ac4b5a31b352a843c85304df9af1f3e0 (patch)
tree5b78d7f1a7b8281f34c980630e5b9fbdf84833ce /src/main.c
parent022a202e31157859bc0fac25479a4782514e50a9 (diff)
- changed make
- malloc with error function
Diffstat (limited to 'src/main.c')
-rwxr-xr-xsrc/main.c18
1 files changed, 3 insertions, 15 deletions
diff --git a/src/main.c b/src/main.c
index 262c504..3b2db6e 100755
--- a/src/main.c
+++ b/src/main.c
@@ -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