-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcommand.h
More file actions
26 lines (19 loc) · 1 KB
/
command.h
File metadata and controls
26 lines (19 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
// UCLA CS 111 Lab 1 command interface
#include <stdbool.h>
typedef struct command *command_t;
typedef struct command_stream *command_stream_t;
/* Create a command stream from GETBYTE and ARG. A reader of
the command stream will invoke GETBYTE (ARG) to get the next byte.
GETBYTE will return the next input byte, or a negative number
(setting errno) on failure. */
command_stream_t make_command_stream (int (*getbyte) (void *), void *arg, int noClobber);
/* Read a command from STREAM; return it, or NULL on EOF. If there is
an error, report the error and exit instead of returning. */
command_t read_command_stream (command_stream_t stream);
/* Print a command to stdout, for debugging. */
void print_command (command_t);
/* Execute a command. Use "time travel" if the flag is set. */
void execute_command (command_t, bool);
/* Return the exit status of a command, which must have previously
been executed. Wait for the command, if it is not already finished. */
int command_status (command_t);