K & R C Programs Exercise 6-3

K and R C, Solution to Exercise 6-3:
K and R C Programs Exercises provides the solution to all the exercises in the C Programming Language (2nd Edition). You can learn and solve K&R C Programs Exercise.
C Program to Write a cross-referencer program that prints a list of all words in a document, and, for each word, a list of the line numbers on which it occurs. Remove noise words like “the”, “and,” and so on. Read more about C Programming Language .

/***********************************************************
* You can use all the programs on www.c-program-example.com
* for personal and learning purposes. For permissions to use the
* programs for commercial purposes,
* contact info@c-program-example.com
* To find more C programs, do visit www.c-program-example.com
* and browse!
* Original URL: http://www.c-program-example.com/2012/02/k-r-c-programs-exercise-6-3.html
* GitHub URL: https://github.com/snadahalli/cprograms/blob/master/knrc/knrc6_3.c
***********************************************************/

/** Write a cross-referencer program that prints a list of all words in a
* document, and, for each word, a list of the line numbers on which it
* occurs. Remove noise words like "the", "and," and so on.
**/

#include
#include
#include
#include

char *dupstr(char *s) {
char *p = NULL;
if(s != NULL){
p = malloc(strlen(s) + 1);
if(p) {
strcpy(p, s);
}
}
return p;
}

int i_strcmp(const char *s, const char *t) {
int diff = 0;
char cs = 0;
char ct = 0;

while(diff == 0 && *s != '