comp20003-project02/input.h

49 lines
921 B
C
Raw Normal View History

#ifndef STDIO_HEADER
#define STDIO_HEADER
#include <stdio.h>
#endif
#ifndef STDLIB_HEADER
#define STDLIB_HEADER
#include <stdlib.h>
#endif
#ifndef STRING_HEADER
#define STRING_HEADER
#include <string.h>
#endif
#ifndef INPUT_HEADER
#define INPUT_HEADER
enum stages {
STAGE_1 = 1,
STAGE_2 = 2,
STAGE_3 = 3,
STAGE_4 = 4,
STAGE_ERROR = -1
};
/* Gets the current stage from the command-line argument */
enum stages getStage(char *stage);
/* Checks the validity of the command line input arguments */
void checkInputArgs(int argc, char **argv);
/* Gets the expected number of arguments for a given stage */
int getExpectedArgs(enum stages stage);
/* Prints the corresponding usage strings for a given stage */
void printArgError(enum stages stage, char *errorMessage);
/* Opens a file and checks if the file is safe to use */
FILE *safeFileOpen(FILE **f, char *fileName, char *mode);
#endif