2019-05-08 17:34:30 -07:00
|
|
|
#include <stdio.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
#include <string.h>
|
|
|
|
|
|
|
|
#define ARGC_ERROR 1
|
2019-05-11 18:36:22 -07:00
|
|
|
#define TOOMANYFILES_ERROR 2
|
|
|
|
#define CONFLICTING_OUTPUT_OPTIONS 3
|
|
|
|
|
2019-05-08 17:34:30 -07:00
|
|
|
#define MAXSTRINGS 1024
|
2019-05-11 18:36:22 -07:00
|
|
|
#define MAXPARAS 4096
|
2019-05-08 17:34:30 -07:00
|
|
|
|
2019-05-11 18:36:22 -07:00
|
|
|
#define HASHLEN 200
|
|
|
|
#define BUFLEN 256
|
2019-05-08 17:34:30 -07:00
|
|
|
|
2019-05-11 23:03:45 -07:00
|
|
|
// ================================================================ //
|
|
|
|
|
|
|
|
/*
|
|
|
|
TODO: check line by line in a pagraph, using '|' for differences");
|
|
|
|
TODO: this starter code does not yet handle printing all of fin1's pagraphs.");
|
|
|
|
TODO: handle the rest of diff's options");
|
|
|
|
TODO: fix standard printing with no pameters");
|
|
|
|
TODO: implement multiple types of pameters\n");
|
|
|
|
*/
|
|
|
|
|
2019-05-11 22:56:41 -07:00
|
|
|
// ================================================================= //
|
2019-05-08 17:34:30 -07:00
|
|
|
|
|
|
|
FILE *fin1, *fin2;
|
2019-05-11 18:36:22 -07:00
|
|
|
const char* files[2] = { NULL, NULL };
|
|
|
|
|
2019-05-08 17:34:30 -07:00
|
|
|
char buf[BUFLEN];
|
|
|
|
char *strings1[MAXSTRINGS], *strings2[MAXSTRINGS];
|
|
|
|
|
2019-05-11 18:36:22 -07:00
|
|
|
int showversion = 0, showbrief = 0, ignorecase = 0, report_identical = 0, showsidebyside = 0;
|
|
|
|
int showleftcolumn = 0, showunified = 0, showcontext = 0, suppresscommon = 0, diffnormal = 0;
|
2019-05-15 17:24:09 -07:00
|
|
|
int showhelp = 0, foundmatch = 0;
|
2019-05-11 18:36:22 -07:00
|
|
|
|
2019-05-11 19:39:28 -07:00
|
|
|
int equal = 0, cnt = 0, count = 0;
|
2019-05-11 18:36:22 -07:00
|
|
|
|
|
|
|
int count1 = 0, count2 = 0;
|
2019-05-11 22:56:41 -07:00
|
|
|
|
|
|
|
// ================================================================ //
|
|
|
|
|
|
|
|
void init(int argc, const char* argv[]);
|
|
|
|
void setoption(const char* arg, const char* s, const char* t, int* value);
|
|
|
|
void diff_output_conflict_error(void);
|
|
|
|
|
|
|
|
void loadfiles(const char* filename1, const char* filename2);
|
|
|
|
|
|
|
|
void version();
|
|
|
|
void help();
|
|
|
|
|
|
|
|
int normal(const char* filename1, const char* filename2);
|
|
|
|
int sideside(const char* filename1, const char* filename2);
|
|
|
|
void quiet(const char* filename1, const char* filename2);
|
|
|
|
void loud(const char* filename1, const char* filename2);
|
2019-05-15 17:24:09 -07:00
|
|
|
|
|
|
|
void identical(const char* filename1, const char* filename2);
|