I'm a student in CS@Illinois and I took this class last semester. For assignment one, they gave us a library and the following where we had to make a working shell (sorry for formatting):
/ @file shell.c / #include <stdio.h> #include <unistd.h> #include <stdlib.h> #include <string.h> #include <sys/types.h> #include <sys/wait.h> #include <unistd.h> #include "log.h"
log_t Log;
/**
* * Starting point for shell.
* */
int main(int argc, char ** argv) {
/**
* * Analyze command line arguments
* */
while(1)
{
/**
* * Print a command prompt
* */
/**
* * Read the commands
* */
/**
* * Print the PID of the process executing the command
* */
/**
* * Decide which actions to take based on the command (exit, run program, etc.)
* */
}
return 0;
}
The provided code is rather sparse (by design), but the University holds copyright on it.