kent@ncoast.UUCP (Kent Williams) (12/10/88)
Posting-number: Volume 5, Issue 77 Submitted-by: "Kent Williams" <kent@ncoast.UUCP> Archive-name: gdiff.diff.ms [You need to get the GnuDiff distribution to use this. ++bsa] This is the readme file for the MSDOS porting kit for GNU DIFF. In order to produce a working MSDOS version, follow these steps: 1. Get the distribution of gnu diff. This is archived various places around the networks. I got it by ftp to prep.ai.mit.edu. If you can't find it, contact me as a last resort. I believe it is also available from uunet. The following steps can be performed either on a Unix system, or on a DOS system, if you have the DOS versions of patch and tar. 2. Unpack the tar. The standard distribution tar creates a directory called diff in the current working directory. 3. Apply the patch file included below in the diff directory. The following steps happen on your target DOS or OS/2 system. 4. Copy the directory from the Unix system to the MSDOS system, if necessary. 5. Add the msdos makefile, proto.h and getopt.c to the directory. 6. Run make. This is a minimal delta port -- i.e. as few changes as possible. I used the Microsoft C compiler V 5.1, though you should be able to get it to work with any compiler that supports a huge model. As far as I know, this should work fine under OS/2 also. That being the case, it can't work on really large files, since it keeps both of the files being compared in core. This works fine for virtual memory operating systems, but it's a little tough on an 8088. I had to go to the huge data model because of some pointer arithmetic problem in compact model -- if you compile it compact model, diffs of single files work fine, but if you diff two directories, the program runs out of memory and crashes DOS. If someone figures out what the problem is, please let me know. Another fixer-upper opportunity is diff3. I did the minimum in order to get a clean compile, and it doesn't cooperate by working correctly. I have included the standard getopt.c from comp.sources.unix, as that isn't available in the Microsoft Standard Library. Questions/Comments/Suggestions to: Kent Williams 722 Rundell Street Iowa City, IA 52240 internet: williams@umaxc.weeg.uiowa.edu (319) 338-6053 (If you call from Australia, please compute the time difference!) -----------------------------CUT HERE-------OUCH------------------------ # This is a shell archive. Save this into a file, edit it # and delete all lines above this comment. Then give this # file to sh by executing the command "sh file". The files # will be extracted into the current directory owned by # you with default permissions. # # The files contained herein are: # makefile.dos difpatch.dos getopt.c proto.h # echo 'x - makefile.dos' sed 's/^X//' <<'________This_Is_The_END________' >>makefile.dos X X# X# MSDOS makefile for gnu-diff X# XMODEL = H XCFLAGS = -nologo -Zi -W2 -DUSG XOPT = -Ox X.SUFFIXES: .obj .c X X.c.obj: X cl -c $(CFLAGS) -A$(MODEL) $(OPT) $< X XSRC=analyze.c context.c diff.c dir.c ed.c getopt.c io.c normal.c\ X regex.c util.c XOBJ=$(SRC:.c=.obj) X Xdiff.exe : $(OBJ) X link $(OBJ) $(LIB)\setargv ,$@ /CO/NOE/ST:32000 ,; X Xdiff3.exe : diff3.obj getopt.obj X link diff3 getopt $(LIB)\setargv /CO/NOE ,; X Xproto.h : $(SRC) X @-del $@ X ! cl -Zg -DMAKING_PROTO_H $(CFLAGS) $? >> $@ X X$(OBJ) : diff.h X Xclean : X rm *.bak *.obj *.map ________This_Is_The_END________ echo 'x - difpatch.dos' sed 's/^X//' <<'________This_Is_The_END________' >>difpatch.dos X X*** analyze.c Mon Sep 26 23:57:10 1988 X--- diff/analyze.c Tue Dec 06 10:38:50 1988 X*************** X*** 116,119 **** X--- 116,120 ---- X bmin > dmin ? bd[--bmin - 1] = INT_MAX : ++bmin; X bmax < dmax ? bd[++bmax + 1] = INT_MAX : --bmax; X+ X for (d = bmax; d >= bmin; d -= 2) X { X*************** X*** 387,392 **** X--- 388,401 ---- X X /* Cancel provisional discards at the end, and shrink the run. */ X+ #if defined(MSC_BUG) X while (j > i && discards[j - 1] == 2) X discards[j - 1] = 0, --provisional; X+ #else X+ { X+ int index = j - 1; X+ while (j > i && discards[index] == 2) X+ discards[index] = 0, --provisional; X+ } X+ #endif X X /* Now we have the length of a run of discardable lines X*************** X*** 652,658 **** X--- 661,673 ---- X If so, we know they are identical without actually reading them. */ X X+ #if !defined(MSDOS) X+ /* X+ ** since MSC always sets the inode and dev fields to zero under DOS X+ ** this test will always think two files are the same. X+ */ X if (filevec[0].stat.st_ino == filevec[1].stat.st_ino X && filevec[0].stat.st_dev == filevec[1].stat.st_dev) X return 0; X+ #endif /* MSDOS */ X X binary = read_files (filevec); X*************** X*** 664,670 **** X--- 679,711 ---- X if (binary) X { X+ #if !defined(MSDOS) X int differs = (filevec[0].buffered_chars != filevec[1].buffered_chars X || bcmp (filevec[0].buffer, filevec[1].buffer, X filevec[1].buffered_chars)); X+ #else X+ int differs; X+ if(filevec[0].buffered_chars != filevec[1].buffered_chars) X+ differs = 1; X+ else { X+ /* X+ ** we've got to do it in chunks because of our X+ ** poor 16 bit processor X+ */ X+ char huge *b0 = filevec[0].buffer, X+ *b1 = filevec[1].buffer; X+ long int count; X+ unsigned int delta; X+ count = filevec[0].buffered_chars; X+ while(count > 0) { X+ delta = (unsigned)(count > 65000 ? 65000 : count); X+ if(bcmp(b0,b1,delta) != 0) X+ break; X+ count -= delta; X+ b0 += delta; X+ b1 += delta; X+ } X+ differs = count != 0; X+ } X+ #endif X if (differs) X message ("Binary files %s and %s differ\n", X*************** X*** 775,780 **** X--- 816,826 ---- X for (i = 0; i < 2; ++i) X { X+ #if !defined(MSDOS) X if (filevec[i].buffer != 0) X free (filevec[i].buffer); X+ #else /* MSDOS */ X+ if (filevec[i].buffer != 0) X+ hfree (filevec[i].buffer); X+ #endif X free (filevec[i].linbuf); X } X*** context.c Wed Sep 28 21:19:18 1988 X--- diff/context.c Mon Dec 05 10:36:40 1988 X*************** X*** 253,257 **** X X /* If the change is ignorable, mark it. */ X! script->ignore = (!deletes && !inserts); X X /* Advance to the following change. */ X--- 253,257 ---- X X /* If the change is ignorable, mark it. */ X! script->ignore = (char)(!deletes && !inserts); X X /* Advance to the following change. */ X*** diff.c Fri Oct 07 00:18:42 1988 X--- diff/diff.c Tue Dec 06 10:25:02 1988 X*************** X*** 68,72 **** X } X X! main (argc, argv) X int argc; X char *argv[]; X--- 68,72 ---- X } X X! void main (argc, argv) X int argc; X char *argv[]; X*************** X*** 301,304 **** X--- 301,305 ---- X } X X+ void X specify_style (style) X enum output_style style; X*************** X*** 383,387 **** X } X } X! X /* See if the two named files are actually the same physical file. X If so, we know they are identical without actually reading them. */ X--- 384,394 ---- X } X } X! #if !defined(MSDOS) X! /* X! ** this stuff is real bad idea under MSDOS, at least for MSC 5.1 X! ** because the st_ino and st_dev fields are not supported by X! ** MSDOS, and so stat sets them to zero; therefore X! ** this test always succeeds. X! */ X /* See if the two named files are actually the same physical file. X If so, we know they are identical without actually reading them. */ X*************** X*** 395,398 **** X--- 402,406 ---- X goto done; X } X+ #endif /* MSDOS */ X X /* Open the files and record their descriptors. */ X*************** X*** 411,415 **** X { X char *filename = inf[i].name; X! X inf[i].desc = open (filename, O_RDONLY, 0); X if (0 > inf[i].desc) X--- 419,431 ---- X { X char *filename = inf[i].name; X! #if !defined(MSDOS) X! inf[i].desc = open (filename, O_RDONLY, 0); X! if (0 > inf[i].desc) X! { X! perror_with_name (filename); X! errorcount = 1; X! } X! #else X! if(inf[i].dir_p == 0) { X inf[i].desc = open (filename, O_RDONLY, 0); X if (0 > inf[i].desc) X*************** X*** 418,421 **** X--- 434,440 ---- X errorcount = 1; X } X+ } else X+ inf[i].desc = 0; X+ #endif /* MSDOS */ X } X } X*** diff.h Wed Oct 12 00:51:24 1988 X--- diff/diff.h Mon Dec 05 10:40:14 1988 X*************** X*** 23,27 **** X--- 23,31 ---- X #include <stdio.h> X #include <sys/types.h> X+ X+ #if !defined(MSDOS) X #include <sys/file.h> X+ #endif /* MSDOS */ X+ X #include <sys/stat.h> X X*************** X*** 28,32 **** X--- 32,40 ---- X #ifdef USG X #include <time.h> X+ X+ #if !defined(MSDOS) X #include <dirent.h> X+ #endif /* MSDOS */ X+ X #include <fcntl.h> X #define direct dirent X*************** X*** 43,47 **** X--- 51,57 ---- X #define bzero(s,n) memset((s),0,(n)) X X+ #if !defined(MSDOS) X #define dup2(f,t) (close(t),fcntl((f),F_DUPFD,(t))) X+ #endif X X #define vfork fork X*************** X*** 50,57 **** X--- 60,75 ---- X #endif X X+ #ifdef MSDOS X+ #include <process.h> X+ #include <stdlib.h> X+ #endif /* MSDOS */ X+ X #include <errno.h> X+ X+ #if !defined(MSDOS) X extern int errno; X extern int sys_nerr; X extern char *sys_errlist[]; X+ #endif X X #define EOS (0) X*************** X*** 59,64 **** X--- 77,84 ---- X #define TRUE 1 X X+ #if !defined(min) X #define min(a,b) ((a) <= (b) ? (a) : (b)) X #define max(a,b) ((a) >= (b) ? (a) : (b)) X+ #endif /* MSDOS */ X X #ifndef PR_FILE_NAME X*************** X*** 68,73 **** X--- 88,97 ---- X /* Support old-fashioned C compilers. */ X #if defined (__STDC__) || defined (__GNUC__) X+ #if !defined(MSDOS) X #include "limits.h" X #else X+ #include <limits.h> X+ #endif /* MSDOS */ X+ #else X #define INT_MAX 2147483647 X #define CHAR_BIT 8 X*************** X*** 74,79 **** X #endif X X /* Support old-fashioned C compilers. */ X! #if !defined (__STDC__) && !defined (__GNUC__) X #define const X #endif X--- 98,117 ---- X #endif X X+ #if defined(MSDOS) X+ #ifdef INT_MAX X+ #undef INT_MAX X+ #include <limits.h> X+ #endif X+ #if !defined(MAKING_PROTO_H) X+ #include "proto.h" X+ #endif X+ #include <malloc.h> X+ #include <io.h> X+ #include <memory.h> X+ extern int getopt(int nargc,char **nargv,char *ostr); X+ #endif X+ X /* Support old-fashioned C compilers. */ X! #if !defined (__STDC__) && !defined (__GNUC__) || defined(MSDOS) X #define const X #endif X*************** X*** 215,223 **** X X /* Buffer in which text of file is read. */ X char * buffer; X /* Allocated size of buffer. */ X int bufsize; X /* Number of valid characters now in the buffer. */ X! int buffered_chars; X X /* Array of data on analyzed lines of this chunk of this file. */ X--- 253,273 ---- X X /* Buffer in which text of file is read. */ X+ #if !defined(MSDOS) X char * buffer; X+ X /* Allocated size of buffer. */ X int bufsize; X+ X+ /* Number of valid characters now in the buffer. */ X+ long int buffered_chars; X+ #else /* MSDOS */ X+ char huge *buffer; X+ X+ /* Allocated size of buffer. */ X+ long int bufsize; X+ X /* Number of valid characters now in the buffer. */ X! long int buffered_chars; X! #endif /* MSDOS */ X X /* Array of data on analyzed lines of this chunk of this file. */ X*************** X*** 315,316 **** X--- 365,367 ---- X void message (); X void print_message_queue (); X+ X*** dir.c Tue Sep 20 13:32:58 1988 X--- diff/dir.c Tue Dec 06 11:34:58 1988 X*************** X*** 32,35 **** X--- 32,94 ---- X }; X X+ #if defined(MSDOS) X+ /* X+ ** due to difference of opinion btw gnu and microsoft about what X+ ** const means, const is defined away in diff.h, which causes warnings X+ ** when compiling the headers. This ugliness is avoided here. X+ */ X+ #ifdef const X+ #undef const X+ #endif X+ #include <string.h> X+ #include <dos.h> X+ X+ struct direct { X+ char d_name[14]; X+ }; X+ X+ typedef struct _dir { X+ int first; X+ struct find_t dta; X+ struct direct current; X+ } DIR; X+ X+ X+ DIR * X+ opendir(char *name) { X+ char localname[65]; X+ DIR *rval = malloc(sizeof(DIR)); X+ strcpy(localname,name); X+ strcat(localname,"/*.*"); X+ if(rval == NULL || X+ _dos_findfirst(localname,_A_NORMAL|_A_SUBDIR,&rval->dta) != 0) X+ return NULL; X+ rval->first = 1; X+ return rval; X+ } X+ X+ void X+ closedir(DIR *x) { X+ free(x); X+ } X+ X+ struct direct * X+ readdir(DIR *thisdir) { X+ /* X+ ** first time through, we don't need to look for a file X+ */ X+ if(!thisdir->first) { X+ if(_dos_findnext(&thisdir->dta) != 0) X+ return NULL; X+ } else X+ thisdir->first = 0; X+ strncpy(thisdir->current.d_name,thisdir->dta.name,13); X+ thisdir->current.d_name[13] = '\0'; X+ strlwr(thisdir->current.d_name); X+ return &thisdir->current; X+ } X+ X+ #endif /* MSDOS */ X+ X static struct dirdata X dir_sort (dirname) X*************** X*** 55,59 **** X { X pfatal_with_name (dirname); X! return; X } X X--- 114,118 ---- X { X pfatal_with_name (dirname); X! return dirdata; X } X X*************** X*** 124,128 **** X--- 183,195 ---- X diff_dirs (name1, name2, handle_file, depth) X char *name1, *name2; X+ #if !defined(MSDOS) X int (*handle_file) (); X+ #else X+ /* sorry, rms, I can't live with the assumption that X+ ** sizeof(char *) == sizeof(int) X+ */ X+ int (*handle_file)(char *dir0,char *name0, X+ char *dir1,char *name1,int depth); X+ #endif X { X struct dirdata data1, data2; X*************** X*** 176,180 **** X { X /* Next filename in dir 1 is less; that is a file in dir 1 only. */ X! v1 = handle_file (name1, data1.files[i1], name2, 0, depth + 1); X i1++; X } X--- 243,248 ---- X { X /* Next filename in dir 1 is less; that is a file in dir 1 only. */ X! v1 = handle_file (name1, data1.files[i1], name2, (char *)0, X! depth + 1); X i1++; X } X*************** X*** 182,186 **** X { X /* Next filename in dir 2 is less; that is a file in dir 2 only. */ X! v1 = handle_file (name1, 0, name2, data2.files[i2], depth + 1); X i2++; X } X--- 250,255 ---- X { X /* Next filename in dir 2 is less; that is a file in dir 2 only. */ X! v1 = handle_file (name1, (char *)0, name2, data2.files[i2], X! depth + 1); X i2++; X } X*** io.c Mon Sep 26 22:27:28 1988 X--- diff/io.c Tue Dec 06 11:19:24 1988 X*************** X*** 22,27 **** X--- 22,31 ---- X X /* Rotate a value n bits to the left. */ X+ #if !defined(MSDOS) X #define UINT_BIT (sizeof (unsigned) * CHAR_BIT) X #define ROL(v, n) ((v) << (n) | (v) >> UINT_BIT - (n)) X+ #else X+ #define ROL(v,n) ((v) << (n) | (v) >> (sizeof(v) * CHAR_BIT) - (n)) X+ #endif X X /* Given a hash value and a new character, return a new hash value. */ X*************** X*** 62,65 **** X--- 66,70 ---- X current->buffer = 0; X } X+ #if !defined(MSDOS) X /* If it's a regular file, we can just get the size out of the stat X block and slurp it in all at once. */ X*************** X*** 70,76 **** X--- 75,97 ---- X current->buffered_chars X = read (current->desc, current->buffer, current->bufsize); X+ #else /* MSDOS */ X+ else { X+ current->bufsize = current->stat.st_size + 1; X+ if((current->buffer = X+ (char huge *)halloc(current->bufsize,sizeof(char))) == NULL) X+ fatal("virtual memory exhausted"); X+ { X+ int count; X+ current->buffered_chars = 0; X+ while((count = read(current->desc, X+ current->buffer+current->buffered_chars, X+ 32000)) > 0) X+ current->buffered_chars += count; X+ } X+ #endif /* MSDOS */ X if (current->buffered_chars < 0) X pfatal_with_name (current->name); X } X+ #if !defined(MSDOS) X else X { X*************** X*** 97,100 **** X--- 118,122 ---- X pfatal_with_name (current->name); X } X+ #endif /* MSDOS */ X X /* Check first part of file to see if it's a binary file. */ X*************** X*** 129,135 **** X--- 151,167 ---- X X /* Attempt to get a good initial guess as to the number of lines. */ X+ #if !defined(MSDOS) X current->linbufsize = current->buffered_chars / 50 + 5; X current->linbuf X = (struct line_def *) xmalloc (current->linbufsize * sizeof (struct line_def)); X+ #else X+ long int buffersize; X+ current->linbufsize = (int) X+ (buffersize = (long int)(current->buffered_chars / 50 + 5)); X+ buffersize *= sizeof(struct line_def); X+ if(buffersize > 65535L) X+ fatal("Too many lines to compare"); X+ current->linbuf = (struct line_def *) xmalloc((size_t)buffersize); X+ #endif X X if (function_regexp) X*************** X*** 291,296 **** X int lines; X /* Number of bytes left to scan. */ X int bytes = min (filevec[0].buffered_chars, filevec[1].buffered_chars); X! X /* Find identical prefix. */ X X--- 323,331 ---- X int lines; X /* Number of bytes left to scan. */ X+ #if !defined(MSDOS) X int bytes = min (filevec[0].buffered_chars, filevec[1].buffered_chars); X! #else X! long int bytes = min (filevec[0].buffered_chars, filevec[1].buffered_chars); X! #endif X /* Find identical prefix. */ X X*************** X*** 388,391 **** X--- 423,427 ---- X 32749, X 65521, X+ #if !defined MSDOS X 131071, X 262139, X*************** X*** 399,402 **** X--- 435,439 ---- X 67108859, /* Preposterously large . . . */ X -1 X+ #endif X }; X X*************** X*** 410,414 **** X int n; X { X! int bucket = current->linbuf[n].hash % nbuckets; X struct equivclass *b = buckets[bucket], *p = NULL; X X--- 447,451 ---- X int n; X { X! int bucket = (int)(current->linbuf[n].hash % nbuckets); X struct equivclass *b = buckets[bucket], *p = NULL; X X*** regex.c Sat Oct 08 01:16:56 1988 X--- diff/regex.c Thu Dec 08 08:20:48 1988 X*************** X*** 136,139 **** X--- 136,145 ---- X #endif X X+ #ifdef MSDOS X+ #include <memory.h> X+ #include <malloc.h> X+ #include "diff.h" X+ #endif X+ X /* X * Define the syntax stuff, so we can do the \<...\> things. X*************** X*** 188,192 **** X #ifndef NFAILURES X #define NFAILURES 80 X! #endif NFAILURES X X /* width of a byte in bits */ X--- 194,198 ---- X #ifndef NFAILURES X #define NFAILURES 80 X! #endif /* NFAILURES */ X X /* width of a byte in bits */ X*************** X*** 246,249 **** X--- 252,256 ---- X #define PATUNFETCH p-- X X+ #if !defined(MSDOS) X #define EXTEND_BUFFER \ X { char *old_buffer = bufp->buffer; \ X*************** X*** 263,268 **** X pending_exact += c; \ X } X! X! static int store_jump (), insert_jump (); X X char * X--- 270,293 ---- X pending_exact += c; \ X } X! #else X! #define EXTEND_BUFFER \ X! { char *old_buffer = bufp->buffer; \ X! if (bufp->allocated == (1<<15)) goto too_big; \ X! bufp->allocated *= 2; \ X! if (bufp->allocated > (1<<15)) bufp->allocated = (1<<15); \ X! if (!(bufp->buffer = (char *) realloc (bufp->buffer, bufp->allocated))) \ X! goto memory_exhausted; \ X! c = bufp->buffer - old_buffer; \ X! b += c; \ X! if (fixup_jump) \ X! fixup_jump += c; \ X! if (laststart) \ X! laststart += c; \ X! begalt += c; \ X! if (pending_exact) \ X! pending_exact += c; \ X! } X! #endif X! static void store_jump (), insert_jump (); X X char * X*************** X*** 345,350 **** X--- 370,379 ---- X else X /* Caller did not allocate a buffer. Do it for him */ X+ #if !defined(MSDOS) X bufp->buffer = (char *) malloc (28); X if (!bufp->buffer) goto memory_exhausted; X+ #else X+ bufp->buffer = (char *) xmalloc(28); X+ #endif X begalt = b = bufp->buffer; X } X*************** X*** 746,750 **** X `opcode' is the opcode to store. */ X X! static int X store_jump (from, opcode, to) X char *from, *to; X--- 775,779 ---- X `opcode' is the opcode to store. */ X X! static void X store_jump (from, opcode, to) X char *from, *to; X*************** X*** 752,757 **** X { X from[0] = opcode; X! from[1] = (to - (from + 3)) & 0377; X! from[2] = (to - (from + 3)) >> 8; X } X X--- 781,786 ---- X { X from[0] = opcode; X! from[1] = (char)((to - (from + 3)) & 0377); X! from[2] = (char)((to - (from + 3)) >> 8); X } X X*************** X*** 763,767 **** X If you call this function, you must zero out pending_exact. */ X X! static int X insert_jump (op, from, to, current_end) X char op; X--- 792,796 ---- X If you call this function, you must zero out pending_exact. */ X X! static void X insert_jump (op, from, to, current_end) X char op; X*************** X*** 1274,1278 **** X case start_memory: X regstart[*p] = d; X! regstart_seg1[*p++] = (dend == end_match_1); X break; X X--- 1303,1307 ---- X case start_memory: X regstart[*p] = d; X! regstart_seg1[*p++] = (unsigned char)(dend == end_match_1); X break; X X*************** X*** 1279,1283 **** X case stop_memory: X regend[*p] = d; X! regend_seg1[*p++] = (dend == end_match_1); X break; X X--- 1308,1312 ---- X case stop_memory: X regend[*p] = d; X! regend_seg1[*p++] = (unsigned char)(dend == end_match_1); X break; X X*************** X*** 1424,1428 **** X /* p1[0] ... p1[2] are an on_failure_jump. X Examine what follows that */ X! if (p1[3] == (unsigned char) exactn && p1[5] != c) X p[-3] = (unsigned char) finalize_jump; X else if (p1[3] == (unsigned char) charset X--- 1453,1457 ---- X /* p1[0] ... p1[2] are an on_failure_jump. X Examine what follows that */ X! if (p1[3] == (char) exactn && p1[5] != (char)c) X p[-3] = (unsigned char) finalize_jump; X else if (p1[3] == (unsigned char) charset X*************** X*** 1661,1669 **** X if (!re_comp_buf.buffer) X { X if (!(re_comp_buf.buffer = (char *) malloc (200))) X return "Memory exhausted"; X- re_comp_buf.allocated = 200; X if (!(re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH))) X return "Memory exhausted"; X } X return re_compile_pattern (s, strlen (s), &re_comp_buf); X--- 1690,1703 ---- X if (!re_comp_buf.buffer) X { X+ #if !defined(MSDOS) X if (!(re_comp_buf.buffer = (char *) malloc (200))) X return "Memory exhausted"; X if (!(re_comp_buf.fastmap = (char *) malloc (1 << BYTEWIDTH))) X return "Memory exhausted"; X+ #else X+ re_comp_buf.buffer = (char *) xmalloc(200); X+ re_comp_buf.fastmap = (char *) xmalloc(1 << BYTEWIDTH); X+ #endif X+ re_comp_buf.allocated = 200; X } X return re_compile_pattern (s, strlen (s), &re_comp_buf); X*** util.c Fri Sep 30 11:04:10 1988 X--- diff/util.c Mon Dec 05 10:36:40 1988 X*************** X*** 131,134 **** X--- 131,135 ---- X strcat (name, name1); X X+ #if !defined(MSDOS) X if (paginate_flag) X { X*************** X*** 163,166 **** X--- 164,168 ---- X } X else X+ #endif X { X X*************** X*** 187,191 **** X--- 189,195 ---- X { X fclose (outfile); X+ #if !defined(MSDOS) X wait (0); X+ #endif X } X } X*************** X*** 222,226 **** X X /* Undo the alteration. */ X! s1->text[s1->length] = savechar; X X /* If the comparison stopped at the alteration, X--- 226,230 ---- X X /* Undo the alteration. */ X! s1->text[s1->length] = (char) savechar; X X /* If the comparison stopped at the alteration, X*************** X*** 617,620 **** X--- 621,625 ---- X } X X+ void X debug_script (sp) X struct change *sp; ________This_Is_The_END________ echo 'x - getopt.c' sed 's/^X//' <<'________This_Is_The_END________' >>getopt.c X X#include <stdio.h> X/* X * get option letter from argument vector X */ Xint opterr = 1, /* useless, never set or used */ X optind = 1, /* index into parent argv vector */ X optopt; /* character checked for validity */ Xchar *optarg; /* argument associated with option */ X#define BADCH (int)'?' X#define EMSG "" X#define tell(s) fputs(*nargv,stderr);fputs(s,stderr); \ X fputc(optopt,stderr);fputc('\n',stderr);return(BADCH); Xint Xgetopt(int nargc,char **nargv,char *ostr) X{ X static char *place = EMSG; /* option letter processing */ X register char *oli; /* option letter list index */ X#ifdef USG X#define index strchr X#endif X char *index(); X if(!*place) { /* update scanning pointer */ X if(optind >= nargc || *(place = nargv[optind]) != '-' || !*++place) return(EOF); X if (*place == '-') { /* found "--" */ X ++optind; X return(EOF); X } X } /* option letter okay? */ X if ((optopt = (int)*place++) == (int)':' || !(oli = index(ostr,optopt))) { X if(!*place) ++optind; X tell(": illegal option -- "); X } X if (*++oli != ':') { /* don't need argument */ X optarg = NULL; X if (!*place) ++optind; X } X else { /* need an argument */ X if (*place) optarg = place; /* no white space */ X else if (nargc <= ++optind) { /* no arg */ X place = EMSG; X tell(": option requires an argument -- "); X } X else optarg = nargv[optind]; /* white space */ X place = EMSG; X ++optind; X } X return(optopt); /* dump back option letter */ X} XSKELETON_BONES ________This_Is_The_END________ echo 'x - proto.h' sed 's/^X//' <<'________This_Is_The_END________' >>proto.h X Xextern void discard_confusing_lines(struct file_data *filevec); Xextern int diff_2_files(struct file_data *filevec,int depth); Xextern void print_context_header(struct file_data *inf); Xextern void print_context_script(struct change *script); Xextern void main(int argc,char * *argv); Xextern void specify_style(enum output_style style); Xextern int compare_files(char *dir0,char *name0,char *dir1,char *name1,int depth); Xextern struct _dir *opendir(char *name); Xextern void closedir(struct _dir *x); Xextern struct dirent *readdir(struct _dir *thisdir); Xextern int diff_dirs(char *name1,char *name2, X int (*handle_file)(char *dir0,char *name0, X char *dir1,char *name1,int depth),int depth); Xextern void print_ed_script(struct change *script); Xextern void print_forward_ed_script(struct change *script); Xextern void print_rcs_script(struct change *script); Xextern void find_and_hash_each_line(void ); Xextern int read_files(struct file_data *filevec); Xextern void print_normal_script(struct change *script); Xextern void print_normal_hunk(struct change *hunk); Xextern int re_set_syntax(int syntax); Xextern char *re_compile_pattern(char *pattern,int size,struct re_pattern_buffer *bufp); Xextern void re_compile_fastmap(struct re_pattern_buffer *bufp); Xextern int re_search(struct re_pattern_buffer *pbufp,char *string,int size,int startpos,int range,struct re_registers *regs); Xextern int re_search_2(struct re_pattern_buffer *pbufp,char *string1,int size1,char *string2,int size2,int startpos,int range,struct re_registers *regs,int mstop); Xextern int re_match(struct re_pattern_buffer *pbufp,char *string,int size,int pos,struct re_registers *regs); Xextern int re_match_2(struct re_pattern_buffer *pbufp,unsigned char *string1,int size1,unsigned char *string2,int size2,int pos,struct re_registers *regs,int mstop); Xextern char *re_comp(char *s); Xextern int re_exec(char *s); Xextern void perror_with_name(char *text); Xextern void pfatal_with_name(char *text); Xextern void error(char *format,...); Xextern void fatal(char *message); Xextern void message(char *format,char *arg1,char *arg2); Xextern void print_message_queue(void ); Xextern void setup_output(char *name0,char *name1,int depth); Xextern void finish_output(void ); Xextern int line_cmp(struct line_def *s1,struct line_def *s2); Xextern struct change *find_change(struct change *start); Xextern struct change *find_reverse_change(struct change *start); Xextern void print_script(struct change *script,struct change *(*hunkfun)(),void (*printfun)()); Xextern void print_1_line(char *line_flag,struct line_def *line); Xextern int change_letter(int inserts,int deletes); Xextern int translate_line_number(struct file_data *file,int lnum); Xextern void translate_range(struct file_data *file,int a,int b,int *aptr,int *bptr); Xextern void print_number_range(char sepchar,struct file_data *file,int a,int b); Xextern void analyze_hunk(struct change *hunk,int *first0,int *last0,int *first1,int *last1,int *deletes,int *inserts); Xextern void *xmalloc(unsigned int size); Xextern void *xrealloc(void *old,unsigned int size); Xextern void *xcalloc(int nitems,int size); Xextern char *concat(char *s1,char *s2,char *s3); Xextern void debug_script(struct change *sp); ________This_Is_The_END________ exit -- Kent Williams {{harvard,mit-eddie}!necntc,well!hoptoad,sun!cwruecmp!hal}!ncoast!kent ARPA: necntc!ncoas!kent@harvard.harvard.e