diff options
| -rw-r--r-- | include/job.h | 24 | ||||
| -rw-r--r-- | src/main.cc | 16 |
2 files changed, 19 insertions, 21 deletions
diff --git a/include/job.h b/include/job.h index e94bda6..293feb7 100644 --- a/include/job.h +++ b/include/job.h @@ -15,17 +15,31 @@ #define MAXJOBS 16 /* max jobs at any point in time */ #define MAXJID 1<<16 /* max job ID */ -#define UNDEF 0 /* undefined */ -#define FG 1 /* running in foreground */ -#define BG 2 /* running in background */ -#define ST 3 /* stopped */ - namespace ov4 { extern struct job_t jobs[]; extern int nextjid; + + +/* + * Jobs states: FG (foreground), BG (background), ST (stopped) + * Job state transitions and enabling actions: + * FG -> ST : ctrl-z + * ST -> FG : fg command + * ST -> BG : bg command + * BG -> FG : fg command + * At most 1 job can be in the FG state. + */ + +enum job_status +{ + UNDEF, + FG, + BG, + ST +}; struct job_t { /* The job struct */ pid_t pid; /* job PID */ diff --git a/src/main.cc b/src/main.cc index 4b6c1f7..5a2bd71 100644 --- a/src/main.cc +++ b/src/main.cc @@ -28,22 +28,6 @@ using namespace ov4; -/* Job states */ -#define UNDEF 0 /* undefined */ -#define FG 1 /* running in foreground */ -#define BG 2 /* running in background */ -#define ST 3 /* stopped */ - -/* - * Jobs states: FG (foreground), BG (background), ST (stopped) - * Job state transitions and enabling actions: - * FG -> ST : ctrl-z - * ST -> FG : fg command - * ST -> BG : bg command - * BG -> FG : fg command - * At most 1 job can be in the FG state. - */ - /* Global variables */ char prompt[] = "$ "; /* command line prompt (DO NOT CHANGE) */ char sbuf[MAXLINE]; /* for composing sprintf messages */ |
