From b7c333d192cfa93dcfd41275309b4cf0b60a066b Mon Sep 17 00:00:00 2001
From: sinanmohd <sinan@firemail.cc>
Date: Sun, 14 May 2023 11:17:20 +0530
Subject: 7.6: initital commit

---
 7.6/Makefile | 11 +++++++++++
 7.6/main.c   | 36 ++++++++++++++++++++++++++++++++++++
 2 files changed, 47 insertions(+)
 create mode 100644 7.6/Makefile
 create mode 100644 7.6/main.c

diff --git a/7.6/Makefile b/7.6/Makefile
new file mode 100644
index 0000000..b428b03
--- /dev/null
+++ b/7.6/Makefile
@@ -0,0 +1,11 @@
+OBJECTS = main.c
+CC = gcc
+CFLAGS = -Wvla -Wall -Wextra -Wstrict-prototypes -Wmissing-prototypes -fsanitize=address
+
+scan : $(OBJECTS)
+	$(CC) $(CFLAGS) -o comp $(OBJECTS)
+
+.PHONY : clean
+
+clean :
+	rm -f comp
diff --git a/7.6/main.c b/7.6/main.c
new file mode 100644
index 0000000..c86174e
--- /dev/null
+++ b/7.6/main.c
@@ -0,0 +1,36 @@
+#include <stdio.h>
+#include <string.h>
+#include <stdbool.h>
+
+#define MAXLEN 1000
+
+void flcmp(FILE *fp1, FILE *fp2);
+
+int main(int argc, char *argv[])
+{
+	FILE *fp1, *fp2;
+	
+	if (argc != 3) {
+		fprintf(stderr, "Usgae: %s file1 file2\n", *argv);
+		return 1;
+	} else if (!(fp1 = fopen(argv[1], "r")) || !(fp2 = fopen(argv[2], "r"))) {
+		fprintf(stderr, "%s: unable to read files\n", *argv);
+		return 1;
+	} else {
+		flcmp(fp1, fp2);
+		return 0;
+	}
+}
+
+void flcmp(FILE *fp1, FILE *fp2)
+{
+	char l1[MAXLEN], l2[MAXLEN];
+
+	while (fgets(l1, MAXLEN, fp1) && fgets(l2, MAXLEN, fp2)) {
+		if (strcmp(l1, l2)) {
+			printf(">>> %s", l1);
+			printf("<<< %s", l2);
+			break;
+		}
+	}
+}
-- 
cgit v1.2.3