changeset 8:9d862edfd3cc

fix fgetc() call
author Paper <37962225+mrpapersonic@users.noreply.github.com>
date Wed, 26 Jan 2022 22:32:41 -0500
parents bd392e82001c
children d2cd8c5672fa
files src/main.c
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/main.c	Wed Jan 26 21:57:01 2022 -0500
+++ b/src/main.c	Wed Jan 26 22:32:41 2022 -0500
@@ -92,7 +92,7 @@
 				strncpy(args.output, optarg, sizeof(args.input)-1);
 				break;
 			case 'v':
-				args.version = abs(atoi(strcpy(optarg)));  /* abs() for possible negative inputs */
+				args.version = abs(atoi(strdup(optarg)));  /* abs() for possible negative inputs */
 				break;
 			case 't':
 				strncpy(args.type, optarg, sizeof(args.input)-1);
@@ -117,7 +117,7 @@
 		return 1;
 	}
 	FILE* input_file = fopen(args.input, "r");
-	if (fgetc() == EOF) {
+	if (fgetc(input_file) == EOF) {
 		fprintf(stderr, "Input file \"%s\" is empty.", args.input);
 		fclose(input_file);
 		return 1;