meulenbr@cstw01.UUCP (Frans Meulenbroeks) (02/08/89)
I've received the following bug fix on rcs from Jwahar Bammi. I did not have the possibility to test it, but I have enough confidence in Jwahar to post it as is. The fix solves the fact that co -rX.Y file does not work under Minix. Thanks Jwahar! As far as rcs concerns: If anyone can point me to a PD or free diff3 I would be quite happy. To Jwahar: I send you a mail two days ago concerning gcc. If you haven't received anything please let me know. We had some problems with our spool area, but I'm receiving stuff from you again. However, I don't know if my mail reaches you. Enjoy, Frans Meulenbroeks (meulenbr@cst.prl.philips.nl) Centre for Software Technology ( or try: ...!mcvax!philmds!prle!cst!meulenbr) -- #!/bin/sh # This is a shell archive, meaning: # 1. Remove everything above the #!/bin/sh line. # 2. Save the resulting text in a file. # 3. Execute the file with /bin/sh (not csh) to create the files: # README # merge.sh # rcs.cdiff # This archive created: Mon Feb 6 07:42:43 1989 # By: Jwahar R. Bammi(Case Western Reserve University) # Uucp: {decvax,sun,att}!cwjcc!dsrgsun!bammi # Csnet: bammi@dsrgsun.ces.CWRU.edu # Arpa: bammi@dsrgsun.ces.CWRU.edu # export PATH; PATH=/bin:$PATH echo shar: extracting "'README'" '(1509 characters)' if test -f 'README' then echo shar: over-writing existing file "'README'" fi sed 's/^X//' << \SHAR_EOF > 'README' X X Here is an upgrade to ST-Minix rcs. Thanks to Eric R. Smith X(7103_300@uwovax.uwo.ca) who pointed out that X co -rX.Y file Xdoes not work on the St. I never noticed this since i do most of Xmy rcs'ing/cross compiling on the sun. He suggested the following Xpatch to rcsedit.c X /*skip next line*/ X! while ((c=getc(fedit))!='\n'); X if (c==EOF) X---around line 292 X /*skip next line*/ X! while ((c=getc(fedit))!='\n') X if (c==EOF) X XIt still did'nt work, but it got me looking. The main problem was Xthat he opens the file for update: fopen(file, "w+"). Of course the XSt library just opens it for "w", since it does not even look at Xthe "+", so later what he does is (after writing) X rewind(fp) Xand starts using it for read. Of course on the ST you will get constant XEOF's, which were not being detected in 3 places in rcsedit.c. So Xto fix the problem, i open for "w", then before the rewind, i Xdo a fclose(fp), and a fopen(...,"r"), and you get the equivalent Xbehavior. XWhile i was at it i also fixed minor stuff in merge.sh and makefile. XEnclosed are the diffs: X merge.sh slightly modified merge.sh (i lost the orig!!) X rcs.cdiff diffs to apply. X-- Xusenet: {decvax,sun}!cwjcc!dsrgsun!bammi jwahar r. bammi Xcsnet: bammi@dsrgsun.ces.CWRU.edu Xarpa: bammi@dsrgsun.ces.CWRU.edu XcompuServe: 71515,155 SHAR_EOF if test 1509 -ne "`cat 'README' | wc -c`" then echo shar: error transmitting "'README'" '(should have been 1509 characters)' fi echo shar: extracting "'merge.sh'" '(1024 characters)' if test -f 'merge.sh' then echo shar: over-writing existing file "'merge.sh'" fi sed 's/^X//' << \SHAR_EOF > 'merge.sh' XPATH=/bin:/usr/bin:. XDIFF=/usr/local/bin/diff XDIFF3=/usr/local/lib/rdiff3 Xp=0 Xcase $1 in X-p) X p=$1 X shift;; Xesac X X Xif test $# -ge 3 Xthen X if test -f $1 -a -f $2 -a -f $3 X then X trap "rm -f /tmp/d3[abc]$$; exit 1" 1 2 3 13 15 X trap "rm -f /tmp/d3[abc]$$; exit 0" 0 X $DIFF $1 $3 >/tmp/d3a$$ X $DIFF $2 $3 >/tmp/d3b$$ X $DIFF3 -E /tmp/d3[ab]$$ $1 $2 $3 $4 $5 > /tmp/d3c$$ X r=$? X if test $r != 0 X then X echo Warning: $r overlaps during merge. 1>&2 X fi X if test $p != 0 X then X (cat /tmp/d3c$$; echo '1,$p') | ed - $1 X exit 0 X else X if test -w $1 X then X (cat /tmp/d3c$$; echo w) | ed - $1 X exit 0 X else X echo "$1 not writeable" 1>&2 X exit 1 X fi X fi X else X echo "Cannot open $1, $2, or $3" 1>&2 X fi Xfi Xecho "usage: merge [-p] file1 file2 file3" 1>&2 Xexit 1 SHAR_EOF if test 1024 -ne "`cat 'merge.sh' | wc -c`" then echo shar: error transmitting "'merge.sh'" '(should have been 1024 characters)' fi echo shar: extracting "'rcs.cdiff'" '(6150 characters)' if test -f 'rcs.cdiff' then echo shar: over-writing existing file "'rcs.cdiff'" fi sed 's/^X//' << \SHAR_EOF > 'rcs.cdiff' X*** Makefile.dist Mon Feb 6 00:48:10 1989 X--- Makefile Mon Feb 6 01:11:40 1989 X*************** X*** 29,39 **** X # Figure out where to put the modified diff and diff3 commands, and X # install them. (Read the instructions in the Make-files). X # Define the macros DIFF and DIFF3 accordingly (below). X DESTDIR = X DIFF = /usr/local/bin/diff X! #DIFF3 = /usr/local/lib/diff3 X X # 2. Figure out where to put the RCS commands; define RCSDIR accordingly. X RCSDIR = /usr/local/bin X MERGE = $(RCSDIR)/merge X X--- 29,39 ---- X # Figure out where to put the modified diff and diff3 commands, and X # install them. (Read the instructions in the Make-files). X # Define the macros DIFF and DIFF3 accordingly (below). X DESTDIR = X DIFF = /usr/local/bin/diff X! DIFF3 = /usr/local/bin/diff X X # 2. Figure out where to put the RCS commands; define RCSDIR accordingly. X RCSDIR = /usr/local/bin X MERGE = $(RCSDIR)/merge X X*************** X*** 178,188 **** X X ident.lint: X $(LINT) ident.c rcskeys.c X X merge: merge.sh X! sed -e '/^#/d' -e 's:DIFF3=.*$$:DIFF3=$(DIFF3):' merge.sh > merge X # This takes out the comment lines and substitutes in DIFF3. X # (Comments are not permitted in some older shells.) X chmod 755 merge X X RLOG = rlog.o rcslex.o rcssyn.o rcsrev.o rcsutil.o partime.o maketime.o rcsfnms.o X--- 178,188 ---- X X ident.lint: X $(LINT) ident.c rcskeys.c X X merge: merge.sh X! sed -e '/^#/d' -e 's:DIFF3=.*$$:DIFF3=$(DIFF3):' -e 's:DIFF=.*$$:DIFF=$(DIFF):' merge.sh > merge X # This takes out the comment lines and substitutes in DIFF3. X # (Comments are not permitted in some older shells.) X chmod 755 merge X X RLOG = rlog.o rcslex.o rcssyn.o rcsrev.o rcsutil.o partime.o maketime.o rcsfnms.o X*** rcsbase.h.dist Tue Jan 10 01:59:43 1989 X--- rcsbase.h Mon Feb 6 06:06:31 1989 X*************** X*** 92,102 **** X */ X X X X #include <stdio.h> X! /* X #undef putc /* will be redefined */ X X X #ifdef USG X # define rindex strrchr X--- 92,102 ---- X */ X X X X #include <stdio.h> X! X #undef putc /* will be redefined */ X X X #ifdef USG X # define rindex strrchr X*************** X*** 169,180 **** X #define TMPFILE3 ",RCSt3XXXXXX" X #define JOINFIL2 ",RCSj2XXXXXX" X #define JOINFIL3 ",RCSj3XXXXXX" X X X! /* X #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(unsigned)(x))):fflsbuf((unsigned)(x),p)) X /* This version of putc prints a char, but aborts on write error */ X X #define GETC(in,out,echo) (echo?putc(getc(in),out):getc(in)) X /* GETC writes a del-character (octal 177) on end of file */ X X--- 169,183 ---- X #define TMPFILE3 ",RCSt3XXXXXX" X #define JOINFIL2 ",RCSj2XXXXXX" X #define JOINFIL3 ",RCSj3XXXXXX" X X X! #ifndef MINIX X #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(unsigned)(x))):fflsbuf((unsigned)(x),p)) X+ #else X+ #define putc(x,p) MinixPutc(x,p) /* Minix safe putc */ X+ #endif X /* This version of putc prints a char, but aborts on write error */ X X #define GETC(in,out,echo) (echo?putc(getc(in),out):getc(in)) X /* GETC writes a del-character (octal 177) on end of file */ X X*** rcsutil.c.dist Mon Feb 6 03:33:34 1989 X--- rcsutil.c Mon Feb 6 06:06:22 1989 X*************** X*** 370,374 **** X--- 370,386 ---- X X X X X X+ #ifdef MINIX X+ /* safe putc ++jrb */ X+ int MinixPutc(c,f) X+ int c; X+ FILE *f; X+ { X+ if(fputc(c,f) == EOF) X+ faterror("write error"); X+ return c; X+ } X+ X+ #endif X*** rcsedit.c.orig Fri Dec 18 17:13:46 1987 X--- rcsedit.c Mon Feb 6 06:06:21 1989 X*************** X*** 137,142 **** X--- 137,148 ---- X { char * tmpptr; X if(ferror(fcopy)) X faterror("write failed on %s -- file system full?",resultfile); X+ #ifdef MINIX X+ /* minix cant do a "w+" so before swapping close old, open new */ X+ fclose(fcopy); X+ if((fcopy = fopen(resultfile, "r")) == NULL) X+ faterror("Can't open working file %s",resultfile); X+ #endif X fedit=fcopy; X rewind(fedit); X editline = 1; linecorr=0; X*************** X*** 188,194 **** X if (delta) X VOID expandline(fedit,fcopy,delta,false,false); X else X! while (putc(getc(fedit),fcopy)!='\n'); X editline++; X } X } X--- 194,205 ---- X if (delta) X VOID expandline(fedit,fcopy,delta,false,false); X else X! { X! int c; /* ++jrb for safety sake */ X! while ((c = putc(getc(fedit),fcopy))!='\n') X! if(c == EOF) X! faterror("EOF during edit"); X! } X editline++; X } X } X*************** X*** 292,299 **** X /* skip over unwanted lines */ X for (i=length;i>0;i--) { X /*skip next line*/ X! while ((c=getc(fedit))!='\n'); X! if (c==EOF) X faterror("EOF during edit"); X editline++; X } X--- 303,310 ---- X /* skip over unwanted lines */ X for (i=length;i>0;i--) { X /*skip next line*/ X! while ((c=getc(fedit))!='\n') X! if (c==EOF) /* fixed thanks to ers */ X faterror("EOF during edit"); X editline++; X } X*************** X*** 308,313 **** X--- 319,326 ---- X else { X c = GETC(finptr,frewrite,write); X while (putc(c,fcopy)!='\n'){ X+ if (c==EOF) /* ++jrb */ X+ faterror("EOF during edit"); X if ((c==SDELIM)&&((c=GETC(finptr,frewrite,write))!=SDELIM)){ X serror("Missing string delimiter in edit script"); X VOID putc(c,fcopy); SHAR_EOF if test 6150 -ne "`cat 'rcs.cdiff' | wc -c`" then echo shar: error transmitting "'rcs.cdiff'" '(should have been 6150 characters)' fi # End of shell archive exit 0 -- Frans Meulenbroeks (meulenbr@cst.prl.philips.nl) Centre for Software Technology ( or try: ...!mcvax!philmds!prle!cst!meulenbr)