Helper functions for shell implementations. More...
Go to the source code of this file.
Classes | |
| struct | COMMAND |
| The COMMAND structure contains a parsed command. More... | |
Functions | |
| COMMAND * | parseCommandLine (char *cmdLine) |
| Parses a command line. | |
| void | printStat (const char *cmdLine, int status) |
| Prints the status of a terminated or stopped child process. | |
| void | prompt () |
| Prints a prompt symbol including the working directory. | |
Helper functions for shell implementations.
| COMMAND* parseCommandLine | ( | char * | cmdLine | ) |
Parses a command line.
This function parses a command line string that may contain & (for background execution) and > for stdout redirection. parseCommand will generate the argv array for the given commandline and return a COMMAND structure containing the result. The COMMAND structure is dynamically allocated and needs to be free'd by the caller (i.e., YOU).
| cmdLine | the cmdLine to be parsed. cmdLine is tokenized during parseCommandLine. |
| void printStat | ( | const char * | cmdLine, | |
| int | status | |||
| ) |
Prints the status of a terminated or stopped child process.
| cmdLine | command line of the child process | |
| status | process status as returned by wait(2) |
1.7.1