spiff port

This commit is contained in:
ian 1998-09-23 23:34:01 +00:00
parent 453d54781f
commit 4fce28871e
11 changed files with 272 additions and 0 deletions

19
textproc/spiff/Makefile Normal file
View File

@ -0,0 +1,19 @@
# $OpenBSD: Makefile,v 1.1.1.1 1998/09/23 23:34:01 ian Exp $
#
PKGNAME= spiff-1.0
DISTNAME= spiff-1.0
CATEGORIES= textproc
MASTER_SITES= http://www.darwinsys.com/freeware/
NO_CDROM = "COPYRIGHT says \"...may not be sold for profit...\""
MAINTAINER= ian@openbsd.org
MAN1=spiff.1
do-install:
${INSTALL_PROGRAM} ${WRKSRC}/spiff ${PREFIX}/bin
${INSTALL_MAN} ${WRKSRC}/spiff.0 ${PREFIX}/man/man1
.include <bsd.port.mk>

1
textproc/spiff/files/md5 Normal file
View File

@ -0,0 +1 @@
MD5 (spiff-1.0.tar.gz) = 9b71ac1a9b9ed014e0ce700df6046dfa

View File

@ -0,0 +1,69 @@
--- Makefile.orig Sun May 1 18:51:17 1994
+++ Makefile Wed Sep 23 18:43:57 1998
@@ -18,21 +18,21 @@
# choose a) b) or c)
#
# a) for BSD derivitives, enable the following line
-#OSFLAG=
+OSFLAG=
# b) for XENIX systems, enable the following line
#OSFLAG=-DXENIX
# b) for other A.T.&T. UNIX derivitives, enable the following line
-OSFLAG=-DATT
+#OSFLAG=-DATT
#
# 2) SELECTION OF TERMINAL CONTROL LIBRARY
# choose either of a) b) or c)
#
# a) if you use termcap, enable the following lines
-#TFLAG=-DM_TERMCAP
-#TLIB=termcap
+TFLAG=-DM_TERMCAP
+TLIB=ncurses
# b) if you are using terminfo on a XENIX machine, enable the following lines
#TFLAG=-DM_TERMINFO
@@ -75,6 +75,7 @@
CFILES= spiff.c output.c compare.c float.c strings.c exact.c miller.c parse.c command.c comment.c tol.c line.c floatrep.c token.c misc.c visual.c
HFILES=misc.h strings.h line.h float.h floatrep.h tol.h command.h comment.h token.h edit.h parse.h compare.h flagdefs.h exact.h miller.h visual.h output.h
OTHER=README Makefile Sample.1 Sample.2 Sample.3 Sample.4 paper.ms paper.out
+
MANPAGE=spiff.1
# disable this line iff you like being honked at.
@@ -82,7 +83,7 @@
CFLAGS=-O $(OSFLAG) $(TFLAG) $(VISFLAG) $(DEFS)
-default: spiff
+all: spiff spiff.0
spiff: $(OBJ)
$(CC) $(CFLAGS) -o spiff $(OBJ) $(VISLIB) -l$(TLIB)
@@ -95,7 +96,6 @@
misc.o: misc.c visual.h misc.h
parse.o: parse.c misc.h line.h command.h float.h tol.h comment.h parse.h token.h flagdefs.h
- @echo compiler may report 4 statement not reached warning messages for parse.c
$(CC) $(CFLAGS) -c parse.c
command.o: command.c float.h tol.h misc.h
@@ -107,7 +107,6 @@
output.o: output.c output.h misc.h edit.h flagdefs.h
compare.o: compare.c misc.h strings.h float.h tol.h token.h line.h compare.h flagdefs.h
- @echo compiler may report 1 statement not reached warning message for compare.c
$(CC) $(CFLAGS) -c compare.c
float.o: float.c misc.h strings.h float.h floatrep.h
@@ -146,4 +145,6 @@
install:
mv spiff $(INSDIR)/bin
cp $(MANPAGE) $(INSDIR)/man/man1
-
+
+spiff.0: spiff.1
+ nroff -man spiff.1 > spiff.0

View File

@ -0,0 +1,24 @@
--- command.c.orig Wed Sep 23 14:06:51 1998
+++ command.c Wed Sep 23 18:42:18 1998
@@ -172,17 +172,17 @@
}
int
-C_is_cmd(inline)
-char *inline;
+C_is_cmd(input_line)
+char *input_line;
{
char *ptr;
/*
** see if this is a command line
** and if so, do the command right away
*/
- if (('\0' != _C_cmdword[0]) && (!S_wordcmp(inline,_C_cmdword)))
+ if (('\0' != _C_cmdword[0]) && (!S_wordcmp(input_line,_C_cmdword)))
{
- ptr = inline;
+ ptr = input_line;
S_nextword(&ptr);
_C_do_a_cmd(ptr);
return(1);

View File

@ -0,0 +1,54 @@
--- compare.c.orig Mon Feb 5 15:17:15 1990
+++ compare.c Wed Sep 23 18:42:18 1998
@@ -17,12 +17,15 @@
#include "token.h"
#include "line.h"
#include "float.h"
-#include "compare.h"
#include <ctype.h>
-X_com(a,b,flags)
-int a,b,flags;
+static int _X_cmptokens(K_token p1,K_token p2,int flags);
+static int _X_strcmp(char *s1, char *s2, int flags);
+static int _X_floatdiff(F_float p1,F_float p2,T_tol the_tol);
+
+int
+X_com(int a, int b, int flags)
{
K_token atmp,btmp;
@@ -47,9 +50,7 @@
** same as strcmp() except that case can be optionally ignored
*/
static int
-_X_strcmp(s1,s2,flags)
-char *s1,*s2;
-int flags;
+_X_strcmp(char *s1, char *s2, int flags)
{
if (flags & U_NO_CASE)
{
@@ -84,9 +85,7 @@
** routine to compare two tokens
*/
static int
-_X_cmptokens(p1,p2,flags)
-K_token p1, p2;
-int flags;
+_X_cmptokens(K_token p1,K_token p2,int flags)
{
if (K_gettype(p1) != K_gettype(p2))
{
@@ -114,9 +113,7 @@
** compare two F_floats using a tolerance
*/
static int
-_X_floatdiff(p1,p2,the_tol)
-F_float p1,p2;
-T_tol the_tol;
+_X_floatdiff(F_float p1,F_float p2,T_tol the_tol)
{
F_float diff, float_tmp;
T_tol tol_tmp;

View File

@ -0,0 +1,19 @@
--- misc.h.orig Wed Sep 23 14:07:19 1998
+++ misc.h Wed Sep 23 18:42:18 1998
@@ -33,16 +33,6 @@
#define Z_ALLOC(n,type) ((type*) _Z_myalloc((n) * sizeof (type)))
extern int *_Z_myalloc();
-/*
-** lines needed to shut up lint
-*/
-extern char *sprintf();
-extern char *strcat();
-extern char *strncat();
-extern char *strcpy();
-extern char *strncpy();
-extern char *malloc();
-
extern void Z_complain();
extern void Z_fatal();
extern void Z_exceed();

View File

@ -0,0 +1,12 @@
--- spiff.1.orig Mon Feb 5 15:17:23 1990
+++ spiff.1 Wed Sep 23 18:42:19 1998
@@ -1,9 +1,5 @@
-.ll 6i
-.pl 10.5i
-.po 1.25i
.\" @(#)spiff.1 1.0 (Bellcore) 9/20/87
.\"
-.lt 6.0i
.TH SPIFF 1 "February 2, 1988"
.AT 3
.SH NAME

View File

@ -0,0 +1,49 @@
--- spiff.c.orig Mon Feb 5 15:17:20 1990
+++ spiff.c Wed Sep 23 18:42:19 1998
@@ -27,7 +27,8 @@
#include "visual.h"
#include "output.h"
-extern void _Y_doargs();
+static void _Y_doargs(int argc, char *argv[], char **file1,
+ char **file2, int *max_d);
static int _Y_eflag = 0; /* use exact match algorithm */
static int _Y_vflag = 0; /* use visual mode */
@@ -38,9 +39,8 @@
*/
static int _Y_flags;
-main(argc,argv)
-int argc;
-char *argv[];
+int
+main(int argc, char *argv[])
{
E_edit edit_end;
char *filename[2];
@@ -120,9 +120,9 @@
if (E_NULL != edit_end)
{
O_output(edit_end,_Y_flags);
- return(1);
+ return 1;
}
- return(0);
+ return 0;
}
/*
@@ -174,11 +174,7 @@
#define SETPTR {if(strlen(argv[1]) == 2) {argv++;argc--;ptr=argv[1];}else ptr=(&argv[1][2]);}
static void
-_Y_doargs(argc,argv,file1,file2,max_d)
-int argc;
-char *argv[];
-char **file1,**file2;
-int *max_d;
+_Y_doargs(int argc, char *argv[], char **file1, char **file2, int *max_d)
{
char *ptr;

View File

@ -0,0 +1 @@
A very flexible diff-like program, with options for C & other langs too.

22
textproc/spiff/pkg/DESCR Normal file
View File

@ -0,0 +1,22 @@
Spiff compares the contents of two files and prints a description
of the important differences between the files. White space is
ignored except to separate other objects. Spiff maintains tolerances
below which differences between two floating point numbers are
ignored. Differences in floating point notation (such as 3.4 3.40
and 3.4e01) are treated as unimportant. User specified delimited
strings (i.e. comments) can also be ignored. There are options for
C and other languages; comments are understood and normally ignored.
Inside other user specified delimited strings (i.e. quoted strings)
whitespace can be significant.
Spiff's operation can be altered via command line options, a command
script, and with commands that are embedded in the input files.
Each of two input files is read and stored in core. Then it is
parsed into a series of tokens (literal strings and floating point
numbers, white space is ignored). The token sequences are stored
in core as well. After both files have been parsed, a differencing
algorithm is applied to the token sequences. The differencing
algorithm produces an edit script, which is then passed to an output
routine. The result is much slower than regular diff, but much
more controllable.

2
textproc/spiff/pkg/PLIST Normal file
View File

@ -0,0 +1,2 @@
bin/spiff
man/man1/spiff.0