[comp.os.minix] patches to get RCS running on Minix

meulenbr@cstw01.UUCP (Frans Meulenbroeks) (01/09/89)

Hi!

On about the fifth upgrade of the kernel I blew it, and I decided I
needed an SCCS/RCS equivalent. After asking many people pointed out that
RCS is free, so here are cdiffs to get it running under Minix/ST/gcc.
I don't know if this will run under Minix/PC or on Minix/ST/native cc.
However you have a chance since the code is well written.
Warning: you will also need a proper diff. The gnu one will do.

See the enclosed README.MINIX files about my changes, and some other
notes.

As usual no warranty. 
Thanks to the people who told me of this software.
Many, Many thanks to Walter Tichy for creating such a fine set of
programs.

If you encounter problems, drop me a note. Flames to /dev/null.

Frans Meulenbroeks (.sig at end).

PS: the shar is composed on a SUN. Perhaps some of the names have become
too long since I added .cdiff to them. You might get truncated names
when unsharring under Minix.

#	This is a shell archive.
#	Remove everything above and including the cut line.
#	Then run the rest of the file through sh.
-----cut here-----cut here-----cut here-----cut here-----
#!/bin/sh
# shar:	Shell Archiver
#	Run the following text with /bin/sh to create:
#	README.MINIX
#	READ_ME
#	Makefile.cdiff
#	maketime.c.cdiff
#	rcsbase.h.cdiff
#	rcsgen.c.cdiff
#	rcslex.c.cdiff
#	rcsutil.c.cdiff
#	stdio.h.cdiff
# This archive created: Mon Jan  9 11:40:36 1989
sed 's/^X//' << \SHAR_EOF > README.MINIX
XHere are cdiffs to get RCS running under Minix/ST.
XI don't know if I'm entitled to distribute the full source.
XAnyway the enclosed READ_ME file tells you how to obtain the source.
XSources are also available on numerous archive servers.
X
XSome notes:
X- I have only tried to compile this stuff using gcc on an ST, using 32
X  bit ints. I have not tried native cc or gcc/16bit int. I have also not
X  tried this stuff under Minix/PC.
X- you will need a proper diff. I use the one from gcc.
X  Although the docs say you'll need a diff3, I don't have one, and I
X  don't found the need for it.
X- In order to get things working I added some filthy defines in my
X  stdio.h. You can perhaps apply these diffs on another include file if wanted.
X- I commented out the safe versions of putc and fflush, since there is no
X  flsbuf() under Minix.
X- I also commented out the code to get the time zone. This is set to
X  a constant. I use 0. Choose whatever you like and seems appropriate.
X  see maketime.c.cdiff
X- I have done only limited testing for this. 
X  However, you can create rcs files, and check code in and out.
X  I have not encountered any problems, but then I'm still learning how to
X  use this stuff. 
X
XAs usual no warranty. 
XThanks to the people who told me of this software.
XMany, Many thanks to Walter Tichy for creating such a fine set of
Xprograms.
X
XFrans Meulenbroeks.
SHAR_EOF
sed 's/^X//' << \SHAR_EOF > READ_ME
XRCS release 3 is still available for free, if you retrieve it yourself over
Xthe UUCP or ARPA net.  If you need a tape, there is a handlig charge of
X$100.  In both cases, we need a signed copy of the non-disclosure form
Xbelow, executed by the person who handles your Unix licenses.  Upon receipt
Xof the completed form, we will send you detailed instructions on how to
Xretrieve RCS.  If you also include the handling charge, we will mail a tape
Xwith RCS instead.
X
XThe whole package consists of RCS proper, the manual pages for it, and
Xmodified versions of the Unix commands diff and diff3.  If you need more
Xinformation on RCS before getting it, read "Design, Implementation, and
XEvaluation of a Revision Control System", by Walter Tichy, in Proc. of the
X6th Int'l Conference on Software Engineering, Sept. 1982, IEEE.
X
X
X
XWalter Tichy
X(tichy@cs.purdue.edu, decvax!purdue!tichy)
X===========================================================================
X
X
XTo:   Walter Tichy
X      Department of Computer Science
X      Purdue University
X      West Lafayette, IN 47907
X
XFrom: <Name>
X      <Name and address of your lab or institution>
X      <reliable network address; without it I can't send the instructions>
X      <phone number>
X
X
X<Date>
X
X
XBy this letter, we agree to the following:
X
X1. RCS will be used internally only.
X
X2. RCS will not be distributed in any form or by any means without prior
X   written permission by the author, Walter Tichy.
X
X3. There are no warranties, express or implied, with regard to materials
X   provided.  Accordingly, Purdue assumes no obligation to provide any
X   assistance of any kind whatsoever, or to furnish any additional
X   materials.
X
X4. Copyright notices and Purdue markings will be preserved in all
X   materials originally or substantially provided by Purdue.
X
X5. Purdue will be given credit where appropriate.
X
X
XIt is understood that if we decide to incorporate RCS into a product,
Xwe have to come to a separate licensing arrangement with the author.
X
X
X
X                               <Name>
X                               <Position>
X
SHAR_EOF
sed 's/^X//' << \SHAR_EOF > Makefile.cdiff
X*** Makefile.orig	Thu Jan  5 11:20:38 1989
X--- Makefile.gcc	Thu Jan  5 13:21:09 1989
X***************
X*** 30,37 ****
X  #     install them. (Read the instructions in the Make-files).
X  #     Define the macros DIFF and DIFF3 accordingly (below).
X  DESTDIR   =
X! DIFF      = /bin/diff
X! DIFF3     = /usr/lib/diff3
X  
X  # 2.  Figure out where to put the RCS commands; define RCSDIR accordingly.
X  RCSDIR    = /usr/local/bin
X--- 30,37 ----
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/lib/diff3
X  
X  # 2.  Figure out where to put the RCS commands; define RCSDIR accordingly.
X  RCSDIR    = /usr/local/bin
X***************
X*** 39,45 ****
X  
X  # 3.  Figure out where to put your old RCS commands; define OLDDIR
X  #     accordingly. This is not needed if you don't have an old release of RCS.
X! OLDDIR    = /usr/old/bin
X  
X  # 4.  Set the operating system variable OS. If you run on 4.1 BSD, do not
X  #     define OS:
X--- 39,45 ----
X  
X  # 3.  Figure out where to put your old RCS commands; define OLDDIR
X  #     accordingly. This is not needed if you don't have an old release of RCS.
X! #OLDDIR    = /usr/old/bin
X  
X  # 4.  Set the operating system variable OS. If you run on 4.1 BSD, do not
X  #     define OS:
X***************
X*** 50,56 ****
X  #     OS  = -DV6
X  #     If you run on 4.2 or 4.3 BSD, use:
X  #     OS = -DV4_2BSD
X! OS        = -DV4_2BSD
X  
X  # 5.  Decide whether you want strict locking as the default or not.
X  #     If you want strict locking, use:
X--- 50,56 ----
X  #     OS  = -DV6
X  #     If you run on 4.2 or 4.3 BSD, use:
X  #     OS = -DV4_2BSD
X! OS = 
X  
X  # 5.  Decide whether you want strict locking as the default or not.
X  #     If you want strict locking, use:
X***************
X*** 57,63 ****
X  #     LOCKING = 1
X  #     otherwise:
X  #     LOCKING = 0
X! LOCKING   = 1
X  
X  # 6.  Decide what loader flags you need, and define LDFLAGS accordingly.
X  #     On the Vax you need none, on PDP-11s with split i/d you need -i.
X--- 57,63 ----
X  #     LOCKING = 1
X  #     otherwise:
X  #     LOCKING = 0
X! LOCKING   = 0
X  
X  # 6.  Decide what loader flags you need, and define LDFLAGS accordingly.
X  #     On the Vax you need none, on PDP-11s with split i/d you need -i.
X***************
X*** 77,84 ****
X  SNOOP	= /usr/local/bin/snoop
X  
X  
X! DEFINES= -DCOMPAT2 $(OS) -DSTRICT_LOCKING=$(LOCKING) -DDIFF='"${DESTDIR}$(DIFF)"' -DMERGE='"${DESTDIR}$(MERGE)"' -DTARGETDIR='"${DESTDIR}$(RCSDIR)"'
X! CFLAGS	= -O $(DEFINES)
X  LINT = lint -c -u  -Dlint $(DEFINES)
X  
X  # 8.  If you don't have release 2 RCS files around (e.g., if you don't
X--- 77,85 ----
X  SNOOP	= /usr/local/bin/snoop
X  
X  
X! DEFINES= $(OS) -DSTRICT_LOCKING=$(LOCKING) -DDIFF='"${DESTDIR}$(DIFF)"' -DMERGE='"${DESTDIR}$(MERGE)"' -DTARGETDIR='"${DESTDIR}$(RCSDIR)"'
X! CFLAGS	= -O $(DEFINES) -DMINIX
X! CC = mgcc
X  LINT = lint -c -u  -Dlint $(DEFINES)
X  
X  # 8.  If you don't have release 2 RCS files around (e.g., if you don't
X***************
X*** 163,169 ****
X  	$(LINT) $(CISRC)
X  	
X  ci:	$(CIFILES)
X! 	cc $(LDFLAGS) -o ci $(CIFILES)
X  
X  COFILES = co.o rcslex.o rcssyn.o rcsgen.o rcsedit.o rcskeys.o rcsrev.o rcsutil.o rcsfnms.o partime.o maketime.o
X  
X--- 164,170 ----
X  	$(LINT) $(CISRC)
X  	
X  ci:	$(CIFILES)
X! 	$(CC) $(LDFLAGS) -o ci $(CIFILES)
X  
X  COFILES = co.o rcslex.o rcssyn.o rcsgen.o rcsedit.o rcskeys.o rcsrev.o rcsutil.o rcsfnms.o partime.o maketime.o
X  
X***************
X*** 171,180 ****
X  co.lint:
X  	$(LINT) $(COSRC)
X  co:	$(COFILES)
X! 	cc $(LDFLAGS) -o co $(COFILES)
X  
X  ident:	ident.o rcskeys.o
X! 	cc -o ident ident.o rcskeys.o
X  
X  ident.lint:
X  	$(LINT) ident.c rcskeys.c
X--- 172,181 ----
X  co.lint:
X  	$(LINT) $(COSRC)
X  co:	$(COFILES)
X! 	$(CC) $(LDFLAGS) -o co $(COFILES)
X  
X  ident:	ident.o rcskeys.o
X! 	$(CC) -o ident ident.o rcskeys.o
X  
X  ident.lint:
X  	$(LINT) ident.c rcskeys.c
X***************
X*** 188,194 ****
X  RLOG = rlog.o rcslex.o rcssyn.o rcsrev.o rcsutil.o partime.o maketime.o rcsfnms.o
X  RLOGSRC = rlog.c rcslex.c rcssyn.c rcsrev.c rcsutil.c partime.c maketime.c rcsfnms.c
X  rlog:	$(RLOG)
X! 	cc $(LDFLAGS) -o rlog $(RLOG)
X  
X  rlog.lint:
X  	$(LINT) $(RLOGSRC)
X--- 189,195 ----
X  RLOG = rlog.o rcslex.o rcssyn.o rcsrev.o rcsutil.o partime.o maketime.o rcsfnms.o
X  RLOGSRC = rlog.c rcslex.c rcssyn.c rcsrev.c rcsutil.c partime.c maketime.c rcsfnms.c
X  rlog:	$(RLOG)
X! 	$(CC) $(LDFLAGS) -o rlog $(RLOG)
X  
X  rlog.lint:
X  	$(LINT) $(RLOGSRC)
X***************
X*** 197,203 ****
X  
X  RCSSRC = rcs.c rcslex.c rcssyn.c rcsrev.c rcsutil.c rcsgen.c rcsedit.c rcskeys.c rcsfnms.c
X  rcs:	$(RCS)
X! 	cc $(LDFLAGS) -o rcs $(RCS)
X  
X  rcs.lint:
X  	$(LINT) $(RCSSRC)
X--- 198,204 ----
X  
X  RCSSRC = rcs.c rcslex.c rcssyn.c rcsrev.c rcsutil.c rcsgen.c rcsedit.c rcskeys.c rcsfnms.c
X  rcs:	$(RCS)
X! 	$(CC) $(LDFLAGS) -o rcs $(RCS)
X  
X  rcs.lint:
X  	$(LINT) $(RCSSRC)
X***************
X*** 211,217 ****
X  RCSDIFFSRC = rcsdiff.c rcsutil.c rcsfnms.c rcsrev.c rcssyn.c rcslex.c
X  
X  rcsdiff:	$(RCSDIFF)
X! 	cc -o rcsdiff $(RCSDIFF)
X  
X  rcsdiff.lint:
X  	$(LINT) $(RCSDIFFSRC)
X--- 212,218 ----
X  RCSDIFFSRC = rcsdiff.c rcsutil.c rcsfnms.c rcsrev.c rcssyn.c rcslex.c
X  
X  rcsdiff:	$(RCSDIFF)
X! 	$(CC) -o rcsdiff $(RCSDIFF)
X  
X  rcsdiff.lint:
X  	$(LINT) $(RCSDIFFSRC)
X***************
X*** 218,229 ****
X  RCSMERGE = rcsmerge.o rcsutil.o rcsfnms.o rcsrev.o rcssyn.o rcslex.o
X  RCSMERGESRC = rcsmerge.c rcsutil.c rcsfnms.c rcsrev.c rcssyn.c rcslex.c
X  rcsmerge:	$(RCSMERGE)
X! 	cc -o rcsmerge $(RCSMERGE)
X  rcsmerge.lint:
X  	$(LINT) $(RCSMERGESRC)
X  	
X  snoop:	snoop.o
X! 	cc -o snoop snoop.o
X  snoop.lint:
X  	$(LINT) snoop.c
X  
X--- 219,230 ----
X  RCSMERGE = rcsmerge.o rcsutil.o rcsfnms.o rcsrev.o rcssyn.o rcslex.o
X  RCSMERGESRC = rcsmerge.c rcsutil.c rcsfnms.c rcsrev.c rcssyn.c rcslex.c
X  rcsmerge:	$(RCSMERGE)
X! 	$(CC) -o rcsmerge $(RCSMERGE)
X  rcsmerge.lint:
X  	$(LINT) $(RCSMERGESRC)
X  	
X  snoop:	snoop.o
X! 	$(CC) -o snoop snoop.o
X  snoop.lint:
X  	$(LINT) snoop.c
X  
X***************
X*** 235,241 ****
X  HFILES=	rcsbase.h time.h
X  
X  depend:	${SOURCE} ${HFILES}
X! 	cc -M  ${CFLAGS} ${SOURCE} > makedep
X  	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
X  	echo '$$r makedep' >>eddep
X  	echo 'w' >>eddep
X--- 236,242 ----
X  HFILES=	rcsbase.h time.h
X  
X  depend:	${SOURCE} ${HFILES}
X! 	$(CC) -M  ${CFLAGS} ${SOURCE} > makedep
X  	echo '/^# DO NOT DELETE THIS LINE/+1,$$d' >eddep
X  	echo '$$r makedep' >>eddep
X  	echo 'w' >>eddep
SHAR_EOF
sed 's/^X//' << \SHAR_EOF > maketime.c.cdiff
X*** maketime.c.orig	Fri Dec 18 23:13:42 1987
X--- maketime.c	Thu Jan  5 13:27:19 1989
X***************
X*** 225,230 ****
X--- 225,231 ----
X  	tzset();
X  	return(_lclzon >= 0 ? _lclzon : (_lclzon = timezone/60L));
X  #else /* V7 */
X+ #ifndef MINIX
X  	struct timeb tb;
X  
X  	if(_lclzon < 0)
X***************
X*** 232,237 ****
X--- 233,241 ----
X  		_lclzon = tb.timezone;
X  	  }
X  	return(_lclzon);
X+ #else /* MINIX */
X+ 	return(0);
X+ #endif MINIX
X  
X  #endif USG
X  #endif V6
SHAR_EOF
sed 's/^X//' << \SHAR_EOF > rcsbase.h.cdiff
X*** rcsbase.h.orig	Fri Dec 18 23:13:45 1987
X--- rcsbase.h	Thu Jan  5 13:24:57 1989
X***************
X*** 94,99 ****
X--- 94,100 ----
X  
X  
X  #include <stdio.h>
X+ /*
X  #undef putc         /* will be redefined */
X  
X  
X***************
X*** 170,175 ****
X--- 171,177 ----
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***************
X*** 301,307 ****
X  extern char            * NextString;
X  extern char            * cmdid;
X  
X! #if defined(USG) || defined(V4_2BSD)
X  #define VOID	(void)
X  #else
X  typedef int void;
X--- 303,309 ----
X  extern char            * NextString;
X  extern char            * cmdid;
X  
X! #if defined(USG) || defined(V4_2BSD) || defined(__GNUC__)
X  #define VOID	(void)
X  #else
X  typedef int void;
SHAR_EOF
sed 's/^X//' << \SHAR_EOF > rcsgen.c.cdiff
X*** rcsgen.c.orig	Fri Dec 18 23:13:47 1987
X--- rcsgen.c	Thu Jan  5 13:04:21 1989
X***************
X*** 94,100 ****
X  
X  
X  char    curlogmsg[logsize] /* buffer for current log message                */
X!         ='\0';
X  
X  enum stringwork {copy, edit, expand, edit_expand };
X  /* parameter to scandeltatext() */
X--- 94,100 ----
X  
X  
X  char    curlogmsg[logsize] /* buffer for current log message                */
X!         ="";
X  
X  enum stringwork {copy, edit, expand, edit_expand };
X  /* parameter to scandeltatext() */
SHAR_EOF
sed 's/^X//' << \SHAR_EOF > rcslex.c.cdiff
X*** rcslex.c.orig	Fri Dec 18 23:13:49 1987
X--- rcslex.c	Fri Jan  6 11:59:16 1989
X***************
X*** 605,610 ****
X--- 605,611 ----
X  
X  
X  
X+ #ifndef MINIX
X  fflsbuf(c, iop)
X  unsigned c; register FILE * iop;
X  /* Function: Flush iop.
X***************
X*** 615,620 ****
X--- 616,622 ----
X                  faterror("write error");
X          return result;
X  }
X+ #endif
X  
X  
X  fputs(s, iop)
X***************
X*** 649,655 ****
X--- 651,661 ----
X  #ifdef VFPRINTF
X  	VOID vfprintf(iop, fmt, ap);
X  #else
X+ #ifdef MINIX
X+ 	_doprintf(iop, fmt, ap);
X+ #else
X  	_doprnt(fmt, ap, iop);
X+ #endif MINIX
X  #endif VFPRINTF
X          if (ferror(iop)) {
X                  faterror("write error");
SHAR_EOF
sed 's/^X//' << \SHAR_EOF > rcsutil.c.cdiff
X*** rcsutil.c.orig	Fri Dec 18 23:13:50 1987
X--- rcsutil.c	Thu Jan  5 13:20:08 1989
X***************
X*** 98,103 ****
X--- 98,104 ----
X  {       char * name;
X  	int uid;
X  	uid=getuid();
X+ #ifndef MINIX
X  	if (uid==0) {
X  		/* super user; try getlogin() to distinguish */
X  		name = getlogin();
X***************
X*** 104,109 ****
X--- 105,111 ----
X  		if (name!=nil && *name!='\0')
X  			return name;
X  	}
X+ #endif
X  	return(getpwuid(uid)->pw_name);
X  }
X  
SHAR_EOF
sed 's/^X//' << \SHAR_EOF > stdio.h.cdiff
X*** stdio.h.orig	Thu Jan  5 11:45:24 1989
X--- stdio.h	Mon Jan  9 11:21:53 1989
X***************
X*** 13,18 ****
X--- 13,31 ----
X  #define PERPRINTF   64
X  #define STRINGS    128
X  
X+ #define _IOREAD                1
X+ #define _IOWRT                 2
X+ #define _IONBF                 4
X+ #define _IOEOF                 8
X+ #define _IOERR                16
X+ 
X+ #define _iob _io_table
X+ #define _flag _flags
X+ #define _base _buf
X+ #define _cnt _count
X+ 
X+ #define clearerr(p)     ((p)->_flags &= ~(_IOERR|_IOEOF))
X+ 
X  #ifndef FILE
X  
X  extern struct _io_buf {
SHAR_EOF
#	End of shell archive
exit 0
-- 
Frans Meulenbroeks        (meulenbr@cst.prl.philips.nl)
	Centre for Software Technology
	( or try: ...!mcvax!philmds!prle!cst!meulenbr)