opSys-shell/scanner.h

38 lines
755 B
C

#ifndef SCANNER_H
#define SCANNER_H
#define INITIAL_STRING_SIZE 10
// This enum denotes what type of variable a token is.
enum Type {
EXECUTABLE, // a command in either $CWD or $PATH
OPTION, // any options to pass to an executable or builtin
COMPOSITION, // '&&', '||', ';', '\n'
BUILTIN, // one of a few pre-defined builtin executables
PIPELINE, // '|'
REDIRECT, // '<' or '>'
BACKGROUND, // '&'
FILENAME // a file (for redirection)
};
typedef struct ListNode *List;
typedef struct ListNode {
char *t;
enum Type type;
List next;
} ListNode;
char *readInputLine();
List getTokenList(char *s);
bool isEmpty(List l);
void printList(List l);
void freeTokenList(List l);
#endif