1#include <stdio.h> 2#include <string.h> 3#include <stdlib.h> 4 5#include "different.h" 6#include "gripes.h" 7#include "man-config.h" 8#include "util.h" 9 10static struct filelist { 11 char *pathname; 12 struct filelist *next; 13} cat_list, man_list; 14 15static int 16is_different(const char *file, struct filelist *p) { 17 char *command; 18 const char *cmp = getval("CMP"); 19 int ret; 20 21 if (cmp) { 22 while (p->next) { 23 command = my_xsprintf("%s %S %S\n", cmp, file, p->pathname); 24 ret = do_system_command (command, 1); 25 if (ret == 0) { 26 gripe(IDENTICAL, file, p->pathname); 27 return 0; 28 } 29 p = p->next; 30 } 31 p->next = (struct filelist *) my_malloc(sizeof(struct filelist)); 32 p->pathname = my_strdup(file); 33 p->next->next = 0; 34 } 35 return 1; 36} 37 38int 39different_cat_file (const char *file) { 40 return is_different (file, &cat_list); 41} 42 43int 44different_man_file (const char *file) { 45 return is_different (file, &man_list); 46} 47