From 73010dc96357a9715b87421534bebc19ecd5863d Mon Sep 17 00:00:00 2001 From: Alexandre Jesus Date: Wed, 5 Oct 2016 18:42:30 +0100 Subject: Fix issues that would lead to seg fault on the online method --- src/main/online.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/main') diff --git a/src/main/online.c b/src/main/online.c index ba8a94c..fb400ef 100644 --- a/src/main/online.c +++ b/src/main/online.c @@ -13,13 +13,13 @@ int main(int argc, char * argv[]){ struct front_item * front = NULL; struct online_return ret; - if(argc!=5){ + if(argc!=6){ printf("Wrong number of arguments!\n"); - printf("Example usage: %s algorithm1 algorithm2 sort_method data_file\n",argv[0]); + printf("Example usage: %s algorithm1 algorithm2 sort_method cut_pointa data_file\n", argv[0]); return 0; } - data = input(argv[4]); + data = input(argv[5]); /* Sort data */ srand(time(NULL)); @@ -29,10 +29,11 @@ int main(int argc, char * argv[]){ qsort(data->items, data->N, sizeof(struct item), cmp_items_ratio); } + printf("%d\n", atoi(argv[4])); clock_t t = clock(); /* Choose algorithm1 */ if(strcmp(argv[1], "dfs") == 0) { - ret = dfs_online(data, NULL, NULL, 20); + ret = dfs_online(data, NULL, NULL, atoi(argv[4])); } else if(strcmp(argv[1], "random_heuristic") == 0) { ret = random_heuristic_online(data, NULL, NULL); } -- cgit v1.2.3