Skip to content

Commit 33539a9

Browse files
committed
Use readLine library for user input
1 parent b913d13 commit 33539a9

File tree

5 files changed

+10
-328
lines changed

5 files changed

+10
-328
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
bin/wish
1+
bin/*
22
**/posix_concepts
33
**/test
44

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ CDIR=src
66
BDIR=bin
77
LDIR =lib
88

9-
LIBS=
9+
LIBS=-lreadLine
1010

1111
DEPS = $(wildcard $(IDIR)/*.h)
1212

include/readline.h

-62
This file was deleted.

src/readline.c

-259
This file was deleted.

src/shell.c

+8-5
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
1-
#include "readline.h"
2-
#include <dirent.h> //for directory related syscalls
3-
#include "stack.h"
1+
#include <readLine/readline.h>
2+
#include <string.h>
3+
#include <dirent.h>
4+
#include <sys/types.h>
45
#include <signal.h>
56
#include <time.h>
7+
8+
#include "stack.h"
69
#include "execute.h"
710
#include "w_parser.h"
811
#include "w_env.h"
@@ -77,7 +80,7 @@ int wish_init()
7780
//setting up signal handler for Parent process that is wish shell
7881
memset(&act, 0, sizeof(act));
7982
act.sa_handler = sighandler;
80-
act.sa_flags=0;//not SA_RESTART
83+
act.sa_flags=0;//not SA_RESTART
8184
sigaction(SIGINT, &act, 0);//should work only for parent process
8285
sigaction(SIGTSTP, &act, 0);//
8386

@@ -87,7 +90,7 @@ int wish_init()
8790

8891
init_stack(&HISTSTACK);
8992

90-
initreadLine(INPUTSIZE);
93+
//initreadLine(INPUTSIZE);
9194

9295
STD_IN_DUP =0;//0
9396
STD_OUT_DUP =1;//1

0 commit comments

Comments
 (0)