Move verbose to global VERBOSE
This commit is contained in:
parent
0b947b701f
commit
03d08c71af
8
csim.c
8
csim.c
@ -2,6 +2,8 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include "cachelab.h"
|
#include "cachelab.h"
|
||||||
|
|
||||||
|
int VERBOSE = 0;
|
||||||
|
|
||||||
void print_usage()
|
void print_usage()
|
||||||
{
|
{
|
||||||
printf("Usage: ./csim [-hv] -s <number> -E <number> -b <number> -t <file>\n"
|
printf("Usage: ./csim [-hv] -s <number> -E <number> -b <number> -t <file>\n"
|
||||||
@ -29,7 +31,7 @@ int parse_int_arg(char* arg)
|
|||||||
|
|
||||||
int main(int argc, char* argv[])
|
int main(int argc, char* argv[])
|
||||||
{
|
{
|
||||||
int set_bits = 0, lines = 0, block_bits = 0, verbose = 0;
|
int set_bits = 0, lines = 0, block_bits = 0;
|
||||||
char* filename;
|
char* filename;
|
||||||
int ii;
|
int ii;
|
||||||
for (ii = 0; ii < argc; ii++)
|
for (ii = 0; ii < argc; ii++)
|
||||||
@ -40,7 +42,7 @@ int main(int argc, char* argv[])
|
|||||||
//print_usage();
|
//print_usage();
|
||||||
break;
|
break;
|
||||||
case 'v':
|
case 'v':
|
||||||
verbose = 1;
|
VERBOSE = 1;
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
set_bits = parse_int_arg(argv[ii+1]);
|
set_bits = parse_int_arg(argv[ii+1]);
|
||||||
@ -57,7 +59,7 @@ int main(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
printf("Arguments: %d, %d, %d, %d, %s\n", set_bits, lines, block_bits, verbose, filename);
|
printf("Arguments: %d, %d, %d, %d, %s\n", set_bits, lines, block_bits, VERBOSE, filename);
|
||||||
if(!set_bits|| !lines || !block_bits || !filename)
|
if(!set_bits|| !lines || !block_bits || !filename)
|
||||||
print_usage();
|
print_usage();
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user