Move verbose to global VERBOSE

This commit is contained in:
Adam Goldsmith 2016-04-26 10:30:54 -04:00
parent 0b947b701f
commit 03d08c71af

8
csim.c
View File

@ -2,6 +2,8 @@
#include <stdio.h>
#include "cachelab.h"
int VERBOSE = 0;
void print_usage()
{
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 set_bits = 0, lines = 0, block_bits = 0, verbose = 0;
int set_bits = 0, lines = 0, block_bits = 0;
char* filename;
int ii;
for (ii = 0; ii < argc; ii++)
@ -40,7 +42,7 @@ int main(int argc, char* argv[])
//print_usage();
break;
case 'v':
verbose = 1;
VERBOSE = 1;
break;
case 's':
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)
print_usage();