-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.c
39 lines (32 loc) · 959 Bytes
/
main.c
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
27
28
29
30
31
32
33
34
35
36
37
38
39
/*
main.c for use with dispatcher.c
Do not edit the contents of this file.
*/
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include "dscheduler.h"
int main(int argc, char **argv) {
enum POLICIES policy;
switch(argc) {
case 2:
if ( strcmp(argv[1], "FCFS") == 0 ){
policy = FCFS;
} else if ( strcmp(argv[1], "SSTF") == 0 ){
policy = SSTF;
} else if ( strcmp(argv[1], "SCAN") == 0 ){
policy = SCAN;
} else if ( strcmp(argv[1], "C-SCAN") == 0 ){
policy = C_SCAN;
} else {
fprintf(stderr, "Invalid policy\n");
exit( BAD_INPUT );
}
break;
default:
fprintf(stderr, "Incorrect # of inputs\n");
exit( WRONG_NUM_INPUTS );
}
printResults( processRequest(policy, loadRequest() ) );
return 0;
}