Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying pull request #3

Open
wants to merge 7 commits into
base: riscv
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ UPROGS=\
$U/_grind\
$U/_wc\
$U/_zombie\
$U/_hello\

fs.img: mkfs/mkfs README $(UPROGS)
mkfs/mkfs fs.img README $(UPROGS)
Expand Down Expand Up @@ -171,3 +172,24 @@ qemu-gdb: $K/kernel .gdbinit fs.img
@echo "*** Now run 'gdb' in another window." 1>&2
$(QEMU) $(QEMUOPTS) -S $(QEMUGDB)

qemu-no-debug-echos: $K/kernel fs.img
clear
$(QEMU) $(QEMUOPTS)

reboot:
clear
make clean qemu-no-debug-echos
clear

delete:
make clean
clear

start:
clear
make qemu-no-debug-echos

start-temp:
clear
make qemu-no-debug-echos
clear
28 changes: 28 additions & 0 deletions user/hello.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#include "kernel/types.h"
#include "kernel/stat.h"
#include "user/user.h"


void sendOutput(char* message){
write(1, message, strlen(message));
}

char* getInput(){
char * inputMessage = malloc(sizeof(char) * 60);
gets(inputMessage, sizeof(inputMessage));
return inputMessage;
}

int
main(int argc, char *argv[])
{

char* inputMessage;
sendOutput("Hello how can I help you?\n");

while((strcmp((inputMessage = getInput()), "q\n") != 0) && (strcmp(inputMessage, "Q\n") != 0)){
sendOutput(inputMessage);
}

exit(0);
}