diff --git a/input.c b/input.c index d4a8956..f2c7d63 100644 --- a/input.c +++ b/input.c @@ -17,7 +17,6 @@ #define STAGE_2_ARG_COUNT 5 #define STAGE_3_ARG_COUNT 5 #define STAGE_4_ARG_COUNT 5 -#define OPEN_FILE_ERROR "Error: Unable to open file %s\n" enum stages getStage(char *stage) { if (strcmp(stage, "1") == 0){ @@ -95,7 +94,7 @@ int getExpectedArgs(enum stages stage) { FILE *safeFileOpen(FILE **f, char *fileName, char *mode) { *f = fopen(fileName, mode); if (*f == NULL) { - fputs(OPEN_FILE_ERROR, stderr); + fprintf(stderr, "Error: Unable to open file %s\n", fileName); exit(EXIT_FAILURE); } return *f; diff --git a/input.o b/input.o index 26429a3..c647f13 100644 Binary files a/input.o and b/input.o differ diff --git a/main.c b/main.c index ba21686..0c653d2 100644 --- a/main.c +++ b/main.c @@ -8,14 +8,7 @@ * The polygon can be split using a pair of integers, which represent * the edge numbers that should be connected. This comes from stdin. * - * To run the program type: - * ./voronoi1 dataset_file polygon_file output_file < splits - * - * Options: - * dataset_file required Path to the dataset file (CSV) - * polygon_file required Path to the polygon file (txt) - * output_file required Output solution file - * splits optional Pairs of integers to split the edges + * To see valid input arguments, run ./voronoi2 * */ @@ -69,6 +62,9 @@ int main(int argc, char **argv) { /* Ensure input arguments are correct */ + if (argc == 1) { + printArgError(STAGE_ERROR, "Incorrect usage."); + } enum stages stage = getStage(argv[1]); int expectedArgs = getExpectedArgs(stage); if (expectedArgs != argc) { diff --git a/main.o b/main.o index f1fe66a..e1b3a8b 100644 Binary files a/main.o and b/main.o differ diff --git a/voronoi1 b/voronoi1 deleted file mode 100644 index e39fe76..0000000 Binary files a/voronoi1 and /dev/null differ diff --git a/voronoi2 b/voronoi2 index 117e65e..878fc9a 100755 Binary files a/voronoi2 and b/voronoi2 differ