Name: comparator
Summary: fast comparison of large source-code trees
-Version: 2.4
+Version: 2.5
Release: 1
License: GPL
Group: Utilities
%{_libdir}/python*/site-packages/comparator.py
%changelog
+* Thu Jul 8 2004 Eric S. Raymond <esr@snark.thyrsus.com> - 2.5-1
+- Alan Burlinson's tweaks to ease porting to SunOS.
+
* Thu Mar 11 2004 Eric S. Raymond <esr@snark.thyrsus.com> 2.4-1
- Fixed strtok() bug apparently introduced by C library change.
Added -n, -f, and -F options to filterator.
characters. This is recommended for comparing C code; it prevents the
comparison from being fooled by differences in indent style.</para>
-<para>The <option>remove_comments</option> option removes comments in
+<para>The <option>remove-comments</option> option removes comments in
C files, All // comments are removed, but only "winged" /* comments
with the start and end of comment on the same line are ignored; also,
block /* comments are retained, but the beginning /* and ending */ are
/* hash.c -- hash and digest computation for comparator */
+#include <stdio.h>
#include "hash.h"
#ifndef FORCE_MD5
sys.stdout.write('\n\t')
m = md5.new()
m.update(`i` + `j`)
- sys.stdout.write('0x' + m.hexdigest()[-(width*2):] + "LL,")
+ sys.stdout.write('0x' + m.hexdigest()[-(width*2):] + "ULL,")
print "}, /* end char %02x */" % i
print "};"
static linenum_t linecount;
-int analyzer_init(unsigned char *buf)
+int analyzer_init(const char *buf)
/* initialize line filtering */
{
int i;
exit(1);
}
- cp = strtok(strdup(buf), ", ");
+ cp = strtok(strdup((const char *)buf), ", ");
if (strcmp(cp, "line-oriented"))
return(1);
while (cp = strtok(NULL, ", "))
/* main.c -- main sequence of comparator */
+#include <limits.h>
#include <stdio.h>
#include <unistd.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>
+#ifdef __sun
+#include <alloca.h>
+#endif
#include <sys/stat.h>
#include <errno.h>
#include <time.h>
/* special case if user gave exactly one tree */
if (!compile_only && argcount == 1)
{
- char *olddir = NULL;
-
if (dir)
{
- olddir = getcwd(NULL, 0); /* may fail off Linux */
chdir(dir);
}
write_scf(argv[optind], redirect(outfile));
if (dir)
{
- olddir = getcwd(NULL, 0); /* may fail off Linux */
+ olddir = getcwd(NULL, PATH_MAX);
chdir(dir);
}
write_scf(source, ofp);
{
if (dir)
{
- olddir = getcwd(NULL, 0); /* may fail off Linux */
+ olddir = getcwd(NULL, PATH_MAX);
chdir(dir);
}
init_scf(source, scf, 0);
#include <sys/types.h>
#include <netinet/in.h>
+/* Solaris typedefs */
+#ifdef __sun
+typedef uint16_t u_int16_t;
+typedef uint32_t u_int32_t;
+#endif
+
#ifndef LARGEFILES
/*
* 65,536 lines should be enough, but make it possible to compile with 32 bits.
struct analyzer_t /* structure describing a feature analyzer */
{
- int (*init)(unsigned char *);
+ int (*init)(const char *);
void (*mode)(int);
feature_t *(*get)(const struct filehdr_t *, FILE *, linenum_t *);
void (*free)(const char *);
static int eligible(const char *file)
/* is the specified file eligible to be compared? */
{
+ if (strstr(file, "CVS") || strstr(file,"RCS") || strstr(file,"SCCS"))
+ return(0);
/* fast check for the most common suffixes */
#define endswith(suff) !strcmp(suff, file + strlen(file) - strlen(suff))
- if (endswith(".c") || endswith(".h") || endswith(".html"))
+ else if (endswith(".c") || endswith(".h") || endswith(".html"))
return(1);
else if (endswith(".o") || endswith("~") || endswith(".bdf"))
return(0);
- else if (strstr(file, "CVS") || strstr(file,"RCS") || strstr(file,"SCCS"))
- return(0);
#undef endswith
else
{
{
if (debug)
fprintf(stderr, "%d (%02x): '%s'\n", i, display[i].flags, display[i].feature);
- hash_update(display[i].feature, strlen(display[i].feature));
+ hash_update((unsigned char*) display[i].feature, strlen(display[i].feature));
out.flags |= display[i].flags;
}
hash_complete(&out.hash);