Helper functions for shell implementations. More...
#include <stdbool.h>Go to the source code of this file.
Data Structures | |
| struct | ShCommand |
Functions | |
| void | shPrompt (void) |
| Prints a prompt symbol including the working directory. | |
| ShCommand * | shParseCmdLine (char cmdLine[]) |
| Parses a command line. | |
| void | shPrintStatus (const char cmdLine[], int status) |
| Prints the status of a terminated or stopped child process. | |
Helper functions for shell implementations.
| ShCommand* shParseCmdLine | ( | char | cmdLine[] | ) |
Parses a command line.
This function parses a command-line string that may contain '&' (for background execution) as well as '<' and '>' for stdin and stdout redirection, respectively. shParseCmdLine() will generate the argv array for the given command line and return an ShCommand structure containing the result. The ShCommand structure is dynamically allocated and needs to be free'd by the caller.
| cmdLine | The command line to be parsed. cmdLine is tokenized during parseCommandLine. |
| void shPrintStatus | ( | 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 waitpid(). |
| void shPrompt | ( | void | ) |
Prints a prompt symbol including the working directory.
1.7.1