Commit 4d0024a9 authored by Lindsay Knupp's avatar Lindsay Knupp
Browse files

End of lab

parent 59304f7c
CC = gcc -lreadline
CFLAGS = -std=gnu99 -Wall -g #-DDEBUG
EXECS = ishell
all: $(EXECS)
ishell: ishell.c
$(CC) $(CFLAGS) -o $@ $<
.PHONY: clean
clean:
/bin/rm -f *.o $(EXECS)
/* Lindsay Knupp
* 11/16/21
* Lab 9 - ishell.c
*/
/*
*First try get the user input, parse the input, fork, if parent wait, if child execlp or execvp
*
*/
#include <stdlib.h>
#include <stdio.h>
#include <readline/readline.h>
#include <readline/history.h>
#include <string.h>
int main (int argc, char *argv[]){
char* user_string = readline("ishell> ");
//printf("user input: %s\n",user_input);
char* word = strtok(user_string, " ");
printf("word: %s\n",word);
while (word != NULL){
word = strtok(NULL," ");
printf("word: %s\n",word);
}
path = "/usr/bin/cat";
execlp(path,"cat",filename,(char*)NULL);
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment