[comp.os.os2.programmer] RCS for OS/2

rommel@lan.informatik.tu-muenchen.dbp.de (Kai-Uwe Rommel) (09/13/90)

A port of RCS 4.2 (revision control system, source code control system)
to MS-DOS appeared with sources a few days ago in the comp.binaries.ibm.pc
newsgroup. It can be recompiled for OS/2 using the patches below.

To recompile, MS C 6.00 is required, 5.10 does not work (lib functions).
To use it, you need GNU diff.

The following changes were made:
- Restrictions of file name length were removed, it should now work
  with HPFS names. Be shure to use the .DEF files because of the flag.
- The author of the DOS port changed the interpretation of path names
  to recognize \ instead of / as separator *only*. I have tried to make
  it recognize *both* separators. I hope that I found all places.
- On output, RCS converts path names now to lowercase and / separators.
  I think that's better because it is (originally) a Unix program.
- Under Unix it is semantically correct to delete an open file but not
  under DOS and OS/2. This is used by RCS and was not corrected by the
  DOS port. DOS does not refuse deletetion of open files (DOS = dumb
  operating system) while OS/2 of course does so. Some changes were
  needed to correct this.
- The USER environment variable is also recognized (besides USR).
- A bug in the spawning routine caused redirected stdio files to
  remain open after the spawn and thus made them unremovable.

Note:
RCSMERGE does not (yet) work. In addition to GNU diff, it also requires
diff3, sh and ed. I have all of them for OS/2 (sh should appear in comp.
binaries.os2 real soon) but the ed clone seems to have problems handling
output from GNU diff3. The shell script merge.sh was adapted to OS/2
and is included as merge.cmd in the following shar.

I decided to post the diffs here because they are intended to OS/2
programmers and the original sources were not posted to comp.sources.??
so posting in comp.sources.bugs does not make much sense.

Kai Uwe Rommel
rommel@lan.informatik.tu-muenchen.dbp.de


#!/bin/sh
# This is a shell archive (shar 3.32)
# made 09/10/1990 01:02 UTC by unknown@OS/2
# Source directory E:\
#
# existing files will NOT be overwritten
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   1773 -rw-rw-rw- readme
#  22335 -rw-rw-rw- patches.os2
#    253 -rw-rw-rw- ci.cs
#    244 -rw-rw-rw- co.cs
#    143 -rw-rw-rw- ident.cs
#    214 -rw-rw-rw- rcs.cs
#    190 -rw-rw-rw- rcsclean.cs
#    186 -rw-rw-rw- rcsdiff.cs
#    211 -rw-rw-rw- rcsmerge.cs
#    200 -rw-rw-rw- rlog.cs
#     76 -rw-rw-rw- ci.def
#     76 -rw-rw-rw- co.def
#     79 -rw-rw-rw- ident.def
#     77 -rw-rw-rw- rcs.def
#     82 -rw-rw-rw- rcsclean.def
#     81 -rw-rw-rw- rcsdiff.def
#     82 -rw-rw-rw- rcsmerge.def
#     78 -rw-rw-rw- rlog.def
#    751 -rw-rw-rw- merge.cmd
#
if touch 2>&1 | fgrep 'amc' > /dev/null
 then TOUCH=touch
 else TOUCH=true
fi
# ============= readme ==============
if test X"$1" != X"-c" -a -f 'readme'; then
	echo "File already exists: skipping 'readme'"
else
echo "x - extracting readme (Text)"
sed 's/^X//' << 'SHAR_EOF' > readme &&
XA port of RCS 4.2 (revision control system, source code control system)
Xto MS-DOS appeared with sources a few days ago in the comp.binaries.ibm.pc
Xnewsgroup. It can be recompiled for OS/2 using the patches below.
X
XTo recompile, MS C 6.00 is required, 5.10 does not work (lib functions).
XTo use it, you need GNU diff.
X
XThe following changes were made:
X- Restrictions of file name length were removed, it should now work
X  with HPFS names. Be shure to use the .DEF files because of the flag.
X- The author of the DOS port changed the interpretation of path names
X  to recognize \ instead of / as separator *only*. I have tried to make
X  it recognize *both* separators. I hope that I found all places.
X- On output, RCS converts path names now to lowercase and / separators.
X  I think that's better because it is (originally) a Unix program.
X- Under Unix it is semantically correct to delete an open file but not
X  under DOS and OS/2. This is used by RCS and was not corrected by the
X  DOS port. DOS does not refuse deletetion of open files (DOS = dumb
X  operating system) while OS/2 of course does so. Some changes were
X  needed to correct this.
X- The USER environment variable is also recognized (besides USR).
X- A bug in the spawning routine caused redirected stdio files to
X  remain open after the spawn and thus made them unremovable.
X
XNote:
XRCSMERGE does not (yet) work. In addition to GNU diff, it also requires
Xdiff3, sh and ed. I have all of them for OS/2 (sh should appear in comp.
Xbinaries.os2 real soon) but the ed clone seems to have problems handling
Xoutput from GNU diff3. The shell script merge.sh was adapted to OS/2
Xand is included as merge.cmd in the following shar.
X
X
XKai Uwe Rommel
Xrommel@lan.informatik.tu-muenchen.dbp.de
SHAR_EOF
$TOUCH -am 0909180190 readme &&
chmod 0666 readme ||
echo "restore of readme failed"
set `wc -c readme`;Wc_c=$1
if test "$Wc_c" != "1739"; then
	echo original size 1739, current size $Wc_c
fi
fi
# ============= patches.os2 ==============
if test X"$1" != X"-c" -a -f 'patches.os2'; then
	echo "File already exists: skipping 'patches.os2'"
else
echo "x - extracting patches.os2 (Text)"
sed 's/^X//' << 'SHAR_EOF' > patches.os2 &&
Xdiff -cbBwr rcsdos/src/ci.c rcsos2/src/ci.c
X*** rcsdos/src/ci.c	Fri Sep 07 14:54:02 1990
X--- rcsos2/src/ci.c	Sun Sep 09 13:15:32 1990
X***************
X*** 647,652 ****
X--- 647,653 ----
X                  /* rewrite rest of RCS file */
X                  fastcopy(finptr,frewrite);
X                  ffclose(frewrite); frewrite=NULL;
X+                 ffclose(finptr);   finptr=NULL;
X          }
X  	ignoreints();
X  #ifdef MSDOS
Xdiff -cbBwr rcsdos/src/co.c rcsos2/src/co.c
X*** rcsdos/src/co.c	Fri Sep 07 14:54:02 1990
X--- rcsos2/src/co.c	Sun Sep 09 14:18:08 1990
X***************
X*** 144,150 ****
X  #endif
X  #ifdef MSDOS
X  static char co[] = CO;
X! static char merge[] = "\genurcs\src\merge.bat";
X  #else
X  static char co[] = CO;
X  static char merge[] = MERGE;
X--- 144,150 ----
X  #endif
X  #ifdef MSDOS
X  static char co[] = CO;
X! static char merge[] = MERGE;
X  #else
X  static char co[] = CO;
X  static char merge[] = MERGE;
X***************
X*** 436,441 ****
X--- 436,442 ----
X                          /* rewrite the rest of the RCSfile */
X                          fastcopy(finptr,frewrite);
X                          ffclose(frewrite); frewrite=NULL;
X+                         ffclose(finptr);   finptr=NULL;
X  			ignoreints();
X  #ifdef MSDOS
X                          if (Rename(newRCSfilename,RCSfilename) != 0 ) {
Xdiff -cbBwr rcsdos/src/partime.c rcsos2/src/partime.c
X*** rcsdos/src/partime.c	Fri Sep 07 14:54:04 1990
X--- rcsos2/src/partime.c	Sat Sep 08 23:11:58 1990
X***************
X*** 479,485 ****
X  {	register char *cp, *mp;
X  	register int c;
X  	struct tmwent *lastptr;
X! 	struct integ { int word; };   /* For getting at array ptr */
X  	int i;
X  
X  	lastptr = 0;
X--- 479,485 ----
X  {	register char *cp, *mp;
X  	register int c;
X  	struct tmwent *lastptr;
X! 	struct integ { long word; };   /* For getting at array ptr */
X  	int i;
X  
X  	lastptr = 0;
Xdiff -cbBwr rcsdos/src/rcs.c rcsos2/src/rcs.c
X*** rcsdos/src/rcs.c	Fri Sep 07 14:54:04 1990
X--- rcsos2/src/rcs.c	Sun Sep 09 13:14:04 1990
X***************
X*** 641,646 ****
X--- 641,647 ----
X              }
X          }
X          ffclose(frewrite);   frewrite = NULL;
X+         ffclose(finptr);     finptr=NULL;
X          if ( ! nerror ) {  /*  move temporary file to RCS file if no error */
X  	    ignoreints();		/* ignore interrupts */
X  #ifdef MSDOS
Xdiff -cbBwr rcsdos/src/rcsbase.h rcsos2/src/rcsbase.h
X*** rcsdos/src/rcsbase.h	Fri Sep 07 14:54:04 1990
X--- rcsos2/src/rcsbase.h	Sun Sep 09 16:27:32 1990
X***************
X*** 191,205 ****
X  #define revlength          30 /* max. length of revision numbers            */
X  #define datelength         20 /* length of a date in RCS format             */
X  #define joinlength         20 /* number of joined revisions permitted       */
X- #ifdef MSDOS		/* Added by $Author: lfk $ */
X- #	ifdef MKS
X- #		define RCSDIR         "rcs/" /* subdirectory for RCS files                 */
X- #	else
X- #		define RCSDIR         "RCS\\" /* subdirectory for RCS files                 */
X- #	endif /* MKS */
X- #else
X  #define RCSDIR         "RCS/" /* subdirectory for RCS files                 */
X- #endif /* MSDOS */
X  #ifdef MSDOS		/* Added by $Author: lfk $ */
X  #define RCSSUF            '\0' /* suffix for RCS files                       */
X  #define RCSSEP            '\0' /* separator for RCSSUF                       */
X--- 191,197 ----
X***************
X*** 215,222 ****
X  #  define NCPPN          1024 /* number of characters per pathname          */
X  #else
X  #ifdef MSDOS		/* Added by $Author: lfk $ */
X! #  define NCPFN            13 /* number of characters per filename          */
X! #  define NCPPN       	   66 /* number of characters per pathname          */
X  #else
X  #  define NCPFN            14 /* number of characters per filename          */
X  #  define NCPPN       6*NCPFN /* number of characters per pathname          */
X--- 207,214 ----
X  #  define NCPPN          1024 /* number of characters per pathname          */
X  #else
X  #ifdef MSDOS		/* Added by $Author: lfk $ */
X! #  define NCPFN           256 /* number of characters per filename          */
X! #  define NCPPN       	  256 /* number of characters per pathname          */
X  #else
X  #  define NCPFN            14 /* number of characters per filename          */
X  #  define NCPPN       6*NCPFN /* number of characters per pathname          */
Xdiff -cbBwr rcsdos/src/rcsclean.c rcsos2/src/rcsclean.c
X*** rcsdos/src/rcsclean.c	Fri Sep 07 14:54:04 1990
X--- rcsos2/src/rcsclean.c	Sun Sep 09 12:38:44 1990
X***************
X*** 72,77 ****
X--- 72,79 ----
X   *
X   */
X  #include "rcsbase.h"
X+ #include <sys/types.h>
X+ #include <sys/stat.h>
X  #define ERRCODE 2                   /*error code for exit status            */
X  static char rcsbaseid[] = RCSBASE;
X  
X***************
X*** 241,246 ****
X--- 243,250 ----
X  				/* identical files; can remove working file */
X  				result=0;
X  				diagnose("files identical; %s removed",workfilename);
X+                                 fclose(file2);
X+                                 chmod(workfilename, S_IREAD | S_IWRITE);
X  				if (unlink(workfilename)!=0) {
X  					error("Can't unlink %s",workfilename);
X  				}
Xdiff -cbBwr rcsdos/src/rcsedit.c rcsos2/src/rcsedit.c
X*** rcsdos/src/rcsedit.c	Fri Sep 07 14:54:04 1990
X--- rcsos2/src/rcsedit.c	Sun Sep 09 16:20:28 1990
X***************
X*** 493,504 ****
X  		VOID putc(VDELIM,out); VOID putc(' ',out);
X  		if (marker==Id)
X  #ifdef MSDOS
X- #	ifdef MKS
X  			 VOID fputs(bindex(RCSfilename,'/'),out);
X  #	else
X- 			 VOID fputs(bindex(RCSfilename,'\\'),out);
X- #	endif
X- #else
X  			 VOID fputs(bindex(RCSfilename,'/'),out);
X  #endif /* MSDOS */
X  		else     VOID fputs(getfullRCSname(),out);
X--- 493,500 ----
X***************
X*** 515,529 ****
X                  break;
X          case Log:
X                  VOID fprintf(out, "%c\t%s %c\n%sRevision %s  ",
X- #ifdef MSDOS
X- #	ifdef MKS
X- 						VDELIM, bindex(RCSfilename,'/'), KDELIM, Comment, delta->num);
X- #	else
X- 						VDELIM, bindex(RCSfilename,'\\'), KDELIM, Comment, delta->num);
X- #	endif
X- #else
X                          VDELIM, bindex(RCSfilename,'/'), KDELIM, Comment, delta->num);
X! #endif /* MSDOS */
X                  VOID PRINTDATE(out,date);VOID fputs("  ",out);VOID PRINTTIME(out,date);
X                  VOID fprintf(out, "  %s\n%s",delta->author,Comment);
X                  /* do not include state here because it may change and is not updated*/
X--- 511,518 ----
X                  break;
X          case Log:
X                  VOID fprintf(out, "%c\t%s %c\n%sRevision %s  ",
X                  VDELIM, bindex(RCSfilename,'/'), KDELIM, Comment, delta->num);
X!              /* VDELIM, bindex(RCSfilename,'\\'), KDELIM, Comment, delta->num); */
X                  VOID PRINTDATE(out,date);VOID fputs("  ",out);VOID PRINTTIME(out,date);
X                  VOID fprintf(out, "  %s\n%s",delta->author,Comment);
X                  /* do not include state here because it may change and is not updated*/
X***************
X*** 532,546 ****
X                  /* Comment is the comment leader */
X                  break;
X          case RCSfile:
X! #ifdef MSDOS
X! #	ifdef MKS
X!                 VOID fprintf(out,"%c %s %c",VDELIM,bindex(RCSfilename,'/'),KDELIM);
X! #	else
X!                 VOID fprintf(out,"%c %s %c",VDELIM,bindex(RCSfilename,'\\'),KDELIM);
X! #	endif
X! #else
X                  VOID fprintf(out,"%c %s %c",VDELIM,bindex(RCSfilename,'/'),KDELIM);
X- #endif /* MSDOS */
X                  break;
X          case Revision:
X                  VOID fprintf(out,"%c %s %c",VDELIM,delta->num,KDELIM);
X--- 521,528 ----
X                  /* Comment is the comment leader */
X                  break;
X          case RCSfile:
X!              /* VOID fprintf(out,"%c %s %c",VDELIM,bindex(RCSfilename,'\\'),KDELIM); */
X                  VOID fprintf(out,"%c %s %c",VDELIM,bindex(RCSfilename,'/'),KDELIM);
X                  break;
X          case Revision:
X                  VOID fprintf(out,"%c %s %c",VDELIM,delta->num,KDELIM);
X***************
X*** 555,560 ****
X                  VOID putc(KDELIM,out);
X                  break;
X          }
X- }
X- 
X  
X--- 537,540 ----
Xdiff -cbBwr rcsdos/src/rcsfnms.c rcsos2/src/rcsfnms.c
X*** rcsdos/src/rcsfnms.c	Fri Sep 07 14:54:04 1990
X--- rcsos2/src/rcsfnms.c	Sun Sep 09 16:27:02 1990
X***************
X*** 142,147 ****
X--- 142,148 ----
X  #include <sys/types.h>
X  #include <sys/stat.h>
X  #ifdef MSDOS
X+ #include <stdlib.h>
X  #include <direct.h>
X  #else
X  #include <sys/dir.h>
X***************
X*** 360,376 ****
X          if ((tp=tfnames[freefilename])==nil)
X                tp=tfnames[freefilename] = talloc(NCPPN);
X  #ifdef MSDOS
X! #	ifdef MKS
X! 		if (fullpath!=nil && (lastslash=rindex(fullpath,'/'))!=0) {
X! #	else
X! 		if (fullpath!=nil && (lastslash=rindex(fullpath,'\\'))!=0) {
X! #	endif
X  #else
X          if (fullpath!=nil && (lastslash=rindex(fullpath,'/'))!=0) {
X- #endif /* MSDOS */
X                  /* copy path */
X                  while (fullpath<=lastslash) *tp++ = *fullpath++;
X          }
X          while (*tp++ = *filename++);
X          return (mktemp(tfnames[freefilename++]));
X  }
X--- 361,378 ----
X          if ((tp=tfnames[freefilename])==nil)
X                tp=tfnames[freefilename] = talloc(NCPPN);
X  #ifdef MSDOS
X! 	if (fullpath!=nil)
X!           if ( (lastslash=rindex(fullpath,'/'))!=0 ||
X!                (lastslash=rindex(fullpath,'\\'))!=0) {
X!                 /* copy path */
X!                 while (fullpath<=lastslash) *tp++ = *fullpath++;
X!           }
X  #else
X          if (fullpath!=nil && (lastslash=rindex(fullpath,'/'))!=0) {
X                  /* copy path */
X                  while (fullpath<=lastslash) *tp++ = *fullpath++;
X          }
X+ #endif /* MSDOS */
X          while (*tp++ = *filename++);
X          return (mktemp(tfnames[freefilename++]));
X  }
X***************
X*** 423,428 ****
X--- 425,442 ----
X  }
X  
X  
X+ #ifdef MSDOS
X+ void _unixpath(char *pathbuf)
X+ {
X+   int i;
X+ 
X+   strlwr(pathbuf);
X+ 
X+   for ( i = 0; i <= strlen(pathbuf); i++)
X+     if(pathbuf[i] == '\\')
X+       pathbuf[i] = '/';
X+ }
X+ #endif
X  
X  char * findpairfile(argc, argv, fname)
X  int argc; char * argv[], *fname;
X***************
X*** 437,448 ****
X  
X          for (next = argv, count = argc; count>0; next++,count--) {
X  #ifdef MSDOS
X! #	ifdef MKS
X! 				if ((*next != nil) && strcmp(bindex(*next,'/'),fname)==0) {
X  #	else
X- 				if ((*next != nil) && strcmp(bindex(*next,'\\'),fname)==0) {
X- #	endif
X- #else
X                  if ((*next != nil) && strcmp(bindex(*next,'/'),fname)==0) {
X  #endif /* MSDOS */
X                          /* bindex finds the beginning of the file name stem */
X--- 451,460 ----
X  
X          for (next = argv, count = argc; count>0; next++,count--) {
X  #ifdef MSDOS
X! 		if ((*next != nil) &&
X!                     (strcmp(bindex(*next,'/'),fname)==0 ||
X! 		     strcmp(bindex(*next,'\\'),fname)==0)) {
X  #else
X                  if ((*next != nil) && strcmp(bindex(*next,'/'),fname)==0) {
X  #endif /* MSDOS */
X                          /* bindex finds the beginning of the file name stem */
X***************
X*** 484,489 ****
X--- 496,502 ----
X          char * lastsep, * purefname, * pureRCSname;
X          int opened, returncode;
X  #ifdef MSDOS
X+         char *help;
X  	struct stat dirstat;
X  #endif /* MSDOS */
X          char * RCS1;
X***************
X*** 500,519 ****
X  
X          /* first check suffix to see whether it is an RCS file or not */
X  #ifdef MSDOS
X- #	ifdef MKS
X  		purefname=bindex(*argv, '/'); /* skip path */
X! #	else
X! 		purefname=bindex(*argv, '\\'); /* skip path */
X! #	endif
X  #else
X          purefname=bindex(*argv, '/'); /* skip path */
X  #endif /* MSDOS */
X  #ifdef MSDOS
X! #	ifdef MKS
X! 	if( ( pureRCSname = strstr( *argv, "rcs/" ) ) != NULL){
X! #else
X! 	if( ( pureRCSname = strstr( *argv, "RCS\\" ) ) != NULL){
X! #endif
X                  /* RCS file name given*/
X  		RCS1 = (*argv);
X                  /* derive workfilename*/
X--- 513,528 ----
X  
X          /* first check suffix to see whether it is an RCS file or not */
X  #ifdef MSDOS
X  	purefname=bindex(*argv, '/'); /* skip path */
X! 	if ( (help=bindex(*argv, '\\')) > purefname )
X!           purefname = help;
X  #else
X          purefname=bindex(*argv, '/'); /* skip path */
X  #endif /* MSDOS */
X  #ifdef MSDOS
X! 	if ( (pureRCSname = strstr(*argv, "rcs/")) != NULL ||
X! 	     (pureRCSname = strstr(*argv, "rcs\\")) != NULL ||
X! 	     (pureRCSname = strstr(*argv, "RCS\\")) != NULL ) {
X                  /* RCS file name given*/
X  		RCS1 = (*argv);
X                  /* derive workfilename*/
X***************
X*** 533,560 ****
X                  /* working file given; now try to find RCS file */
X  		workfilename=*argv;
X  		/* derive RCS file name*/
X- #	ifdef MKS
X  		strcpy( tempfilename, "rcs/" );
X- #	else
X- 		strcpy( tempfilename, "RCS\\" );
X- #	endif
X  		strcat( tempfilename, purefname );
X                  RCS1=findpairfile(argc-1,argv+1,tempfilename);
X! #	ifdef MKS
X! 		pureRCSname = strstr( RCS1, "rcs/" );
X! #	else
X  		pureRCSname = strstr( RCS1, "RCS\\" );
X- #	endif
X  				if (strlen(pureRCSname)>NCPFN+4) {
X                          error("working file name %s too long",workfilename);
X                          return 0;
X                  }
X          }
X! #	ifdef MKS
X! 	if( strchr( workfilename, '/' ) != NULL ){
X! #	else
X! 	if( strchr( workfilename, '\\' ) != NULL ){
X! #	endif
X  		error("Sorry, file name %s confuse RCS", workfilename );
X  		return 0;
X  	}
X--- 542,560 ----
X                  /* working file given; now try to find RCS file */
X  		workfilename=*argv;
X  		/* derive RCS file name*/
X  		strcpy( tempfilename, "rcs/" );
X  		strcat( tempfilename, purefname );
X                  RCS1=findpairfile(argc-1,argv+1,tempfilename);
X! 		if ( (pureRCSname = strstr(RCS1, "rcs/")) == NULL )
X! 		  if ( (pureRCSname = strstr(RCS1, "rcs\\")) == NULL )
X  		    pureRCSname = strstr(RCS1, "RCS\\");
X  		if (strlen(pureRCSname)>NCPFN+4) {
X                          error("working file name %s too long",workfilename);
X                          return 0;
X                  }
X          }
X! 	if( strchr( workfilename, '/' ) != NULL ||
X! 	    strchr( workfilename, '\\' ) != NULL ){
X  		error("Sorry, file name %s confuse RCS", workfilename );
X  		return 0;
X  	}
X***************
X*** 700,705 ****
X--- 700,709 ----
X                  /* file names was given in the argument list        */
X                  warn("Option -p is set; ignoring output file %s",workfilename);
X  
X+ #ifdef MSDOS
X+         _unixpath(RCSfilename);
X+         _unixpath(workfilename);
X+ #endif
X          return returncode;
X  }
X  
X***************
X*** 709,715 ****
X   * Calls getwd(), but only once.
X   * removes leading "../" and "./".
X   */
X! {       static char pathbuf[NCPPN];
X          static char namebuf[NCPPN];
X          static int  pathlength;
X  
X--- 713,727 ----
X   * Calls getwd(), but only once.
X   * removes leading "../" and "./".
X   */
X! {
X! #ifdef MSDOS
X!         static char pathbuf[NCPPN];
X! 
X!         _fullpath(pathbuf, RCSfilename, sizeof(pathbuf));
X!         _unixpath(pathbuf);
X!         return pathbuf;
X! #else
X!         static char pathbuf[NCPPN];
X          static char namebuf[NCPPN];
X          static int  pathlength;
X  
X***************
X*** 716,732 ****
X          register char * realname, * lastpathchar;
X          register int  dotdotcounter, realpathlength;
X  
X- #ifdef MSDOS
X- 	/* Treat a full path name containing the drive name */
X- 	/* Added by $Author: lfk $ */
X- #	ifdef MKS
X- 		if (RCSfilename[1] == ':' && RCSfilename[2] == '/') {
X- #	else
X- 		if (RCSfilename[1] == ':' && RCSfilename[2] == '\\') {
X- #	endif
X- #else
X          if (*RCSfilename=='/') {
X- #endif /* MSDOS */
X                  return(RCSfilename);
X          } else {
X                  if (pathlength==0) { /*call curdir for the first time*/
X--- 728,734 ----
X***************
X*** 733,781 ****
X                      if (getwd(pathbuf)==NULL)
X                          faterror("Can't build current directory path");
X                      pathlength=strlen(pathbuf);
X- #ifdef MSDOS
X- 		/* Generally, a MSDOS path name seems to be like "A:\" */
X- 		/* Added by $Author: lfk $ */
X- #	ifdef MKS
X- 					if (!((pathlength==3) && (pathbuf[2]=='/'))) {
X-                         pathbuf[pathlength++]='/';
X- #	else
X- 					if (!((pathlength==3) && (pathbuf[2]=='\\'))) {
X-                         pathbuf[pathlength++]='\\';
X- #	endif
X- 						/* Check needed because some getwd implementations */
X-                         /* generate "/" for the root.                      */
X-                     }
X- #else
X                      if (!((pathlength==1) && (pathbuf[0]=='/'))) {
X                          pathbuf[pathlength++]='/';
X                          /* Check needed because some getwd implementations */
X                          /* generate "/" for the root.                      */
X                      }
X- #endif /* MSDOS */
X                  }
X                  /*the following must be redone since RCSfilename may change*/
X                  /* find how many ../ to remvove from RCSfilename */
X                  dotdotcounter =0;
X                  realname = RCSfilename;
X- #ifdef MSDOS	/* Chaged '/' to '\\' : By $Author: lfk $ */
X-                 while( realname[0]=='.' &&
X- #	ifdef MKS
X- 					  (realname[1]=='/'||(realname[1]=='.'&&realname[2]=='/'))){
X-                         if (realname[1]=='/') {
X- #	else
X- 					  (realname[1]=='\\'||(realname[1]=='.'&&realname[2]=='\\'))){
X-                         if (realname[1]=='\\') {
X- #	endif
X- 							/* drop leading ./ */
X-                             realname += 2;
X-                         } else {
X-                             /* drop leading ../ and remember */
X-                             dotdotcounter++;
X-                             realname += 3;
X-                         }
X-                 }
X- #else
X                  while( realname[0]=='.' &&
X                        (realname[1]=='/'||(realname[1]=='.'&&realname[2]=='/'))){
X                          if (realname[1]=='/') {
X--- 735,750 ----
X***************
X*** 787,807 ****
X                              realname += 3;
X                          }
X                  }
X- #endif /* MSDOS */
X                  /* now remove dotdotcounter trailing directories from pathbuf*/
X                  lastpathchar=pathbuf + pathlength-1;
X                  while (dotdotcounter>0 && lastpathchar>pathbuf) {
X                      /* move pointer backwards over trailing directory */
X                      lastpathchar--;
X- #ifdef MSDOS
X- #	ifdef MKS
X  					if (*lastpathchar=='/') {
X- #	else
X- 					if (*lastpathchar=='\\') {
X- #	endif
X- #else
X-                     if (*lastpathchar=='/') {
X- #endif /* MSDOS */
X                          dotdotcounter--;
X                      }
X                  }
X--- 756,767 ----
X***************
X*** 816,821 ****
X--- 776,782 ----
X                      return(namebuf);
X                  }
X          }
X+ #endif
X  }
X  
X  /* In MSDOS and (perhaps) OS/2, any directries are writable. 	*/
X***************
X*** 954,966 ****
X  {
X  	int a,i;
X  	(void)getcwd(name, NCPPN);
X- #ifdef MKS
X  	strlwr(name);
X  	a = strlen(name);
X  	for ( i = 0; i <= a; i++)
X  		if(name[i] == '\\')
X  			name[i] = '/';
X- #endif
X  	return name;
X  }
X  #endif /* MSODS */
X--- 915,925 ----
Xdiff -cbBwr rcsdos/src/rcsmerge.c rcsos2/src/rcsmerge.c
X*** rcsdos/src/rcsmerge.c	Fri Sep 07 14:54:06 1990
X--- rcsos2/src/rcsmerge.c	Sun Sep 09 14:12:18 1990
X***************
X*** 270,276 ****
X  
X                  if (
X  		      tostdout
X! #if defined(MSDOS) && defined(MKS)
X  			? run((char*)nil,(char*)nil,"sh",merge,"-p",workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)
X  		    : run((char*)nil,(char*)nil,"sh",merge,     workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)) {
X  #else
X--- 270,276 ----
X  
X                  if (
X  		      tostdout
X! #ifdef MSDOS
X  			? run((char*)nil,(char*)nil,"sh",merge,"-p",workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)
X  		    : run((char*)nil,(char*)nil,"sh",merge,     workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)) {
X  #else
Xdiff -cbBwr rcsdos/src/rcsutil.c rcsos2/src/rcsutil.c
X*** rcsdos/src/rcsutil.c	Fri Sep 07 14:54:06 1990
X--- rcsos2/src/rcsutil.c	Sun Sep 09 14:35:36 1990
X***************
X*** 167,181 ****
X   * If the uid is root, tries to get the true login with getlogin().
X   */
X  {
X! 	char *name = "ROOT_DOS";
X  	char *tmpname;
X  #ifdef MSDOS
X  #	ifndef MKS
X! 	if ((tmpname = getenv("USR")) != NULL);
X  #	else
X! 	if ((tmpname = getenv("LOGNAME")) != NULL);
X  #	endif
X  		name = tmpname;
X  	return name;
X  #else
X  	int uid;
X--- 167,183 ----
X   * If the uid is root, tries to get the true login with getlogin().
X   */
X  {
X! 	char *name = "Unknown";
X  	char *tmpname;
X  #ifdef MSDOS
X  #	ifndef MKS
X! 	if ((tmpname = getenv("USR")) != NULL)
X  #	else
X! 	if ((tmpname = getenv("LOGNAME")) != NULL)
X  #	endif
X  		name = tmpname;
X+ 	else if ((tmpname = getenv("USER")) != NULL)
X+ 		name = tmpname;
X  	return name;
X  #else
X  	int uid;
X***************
X*** 516,528 ****
X  	register char **inoutargs;
X  {
X  #ifdef MSDOS
X! 	int result;
X  
X  	if (fflush(stdout) == EOF  ||  fflush(stderr) == EOF)
X  		return -1;
X  	tryopen(fileno(stdin), inoutargs[0], 0);
X  	tryopen(fileno(stdout), inoutargs[1], -1);
X  	result = spawnvp( 0, inoutargs[2], &inoutargs[2] );
X  	return result;
X  #else
X  	int pid;
X--- 518,536 ----
X  	register char **inoutargs;
X  {
X  #ifdef MSDOS
X! 	int result, si, so;
X  
X  	if (fflush(stdout) == EOF  ||  fflush(stderr) == EOF)
X  		return -1;
X+         si = dup(0);
X+         so = dup(1);
X  	tryopen(fileno(stdin), inoutargs[0], 0);
X  	tryopen(fileno(stdout), inoutargs[1], -1);
X  	result = spawnvp( 0, inoutargs[2], &inoutargs[2] );
X+ 	dup2(si, 0);
X+ 	dup2(so, 1);
X+         close(si);
X+         close(so);
X  	return result;
X  #else
X  	int pid;
SHAR_EOF
$TOUCH -am 0909165090 patches.os2 &&
chmod 0666 patches.os2 ||
echo "restore of patches.os2 failed"
set `wc -c patches.os2`;Wc_c=$1
if test "$Wc_c" != "21666"; then
	echo original size 21666, current size $Wc_c
fi
fi
# ============= ci.cs ==============
if test X"$1" != X"-c" -a -f 'ci.cs'; then
	echo "File already exists: skipping 'ci.cs'"
else
echo "x - extracting ci.cs (Text)"
sed 's/^X//' << 'SHAR_EOF' > ci.cs &&
X(-W1 -DUSG -DSTRICT_LOCKING=1 -DGNUDIFF
X-DCO=\"co.exe\" -DDIFF=\"diff.exe\"
Xci.c rcslex.c rcssyn.c rcsgen.c rcsedit.c
Xrcskeys.c rcsrev.c rcsutil.c rcsfnms.c partime.c
Xmaketime.c rcskeep.c rcsfcmp.c
X)
Xsetargv.obj
Xci.exe
Xci.def
X-AS -LB -S0x2000
SHAR_EOF
$TOUCH -am 0908231590 ci.cs &&
chmod 0666 ci.cs ||
echo "restore of ci.cs failed"
set `wc -c ci.cs`;Wc_c=$1
if test "$Wc_c" != "243"; then
	echo original size 243, current size $Wc_c
fi
fi
# ============= co.cs ==============
if test X"$1" != X"-c" -a -f 'co.cs'; then
	echo "File already exists: skipping 'co.cs'"
else
echo "x - extracting co.cs (Text)"
sed 's/^X//' << 'SHAR_EOF' > co.cs &&
X(-W1 -DUSG -DSTRICT_LOCKING=1
X-DCO=\"co.exe\" -DDIFF=\"diff.exe\" -DMERGE=\"merge.cmd\"
Xco.c rcslex.c rcssyn.c rcsgen.c rcsedit.c rcskeys.c
Xrcsrev.c rcsutil.c rcsfnms.c partime.c maketime.c
X)
Xsetargv.obj
Xco.exe
Xco.def
X-AS -LB -S0x2000
SHAR_EOF
$TOUCH -am 0909141790 co.cs &&
chmod 0666 co.cs ||
echo "restore of co.cs failed"
set `wc -c co.cs`;Wc_c=$1
if test "$Wc_c" != "235"; then
	echo original size 235, current size $Wc_c
fi
fi
# ============= ident.cs ==============
if test X"$1" != X"-c" -a -f 'ident.cs'; then
	echo "File already exists: skipping 'ident.cs'"
else
echo "x - extracting ident.cs (Text)"
sed 's/^X//' << 'SHAR_EOF' > ident.cs &&
X(-W1 -DUSG -DSTRICT_LOCKING=1
X-DCO=\"co.exe\" -DDIFF=\"diff.exe\"
Xident.c rcskeys.c
X)
Xsetargv.obj
Xrcsid.exe
Xident.def
X-AS -LB -S0x2000
SHAR_EOF
$TOUCH -am 0909134190 ident.cs &&
chmod 0666 ident.cs ||
echo "restore of ident.cs failed"
set `wc -c ident.cs`;Wc_c=$1
if test "$Wc_c" != "135"; then
	echo original size 135, current size $Wc_c
fi
fi
# ============= rcs.cs ==============
if test X"$1" != X"-c" -a -f 'rcs.cs'; then
	echo "File already exists: skipping 'rcs.cs'"
else
echo "x - extracting rcs.cs (Text)"
sed 's/^X//' << 'SHAR_EOF' > rcs.cs &&
X(-W1 -DUSG -DSTRICT_LOCKING=1 -DGNUDIFF
X-DCO=\"co.exe\" -DDIFF=\"diff.exe\"
Xrcs.c rcslex.c rcssyn.c rcsrev.c rcsutil.c
Xrcsgen.c rcsedit.c rcskeys.c rcsfnms.c
X)
Xsetargv.obj
Xrcs.exe
Xrcs.def
X-AS -LB -S0x2000
SHAR_EOF
$TOUCH -am 0908232090 rcs.cs &&
chmod 0666 rcs.cs ||
echo "restore of rcs.cs failed"
set `wc -c rcs.cs`;Wc_c=$1
if test "$Wc_c" != "205"; then
	echo original size 205, current size $Wc_c
fi
fi
# ============= rcsclean.cs ==============
if test X"$1" != X"-c" -a -f 'rcsclean.cs'; then
	echo "File already exists: skipping 'rcsclean.cs'"
else
echo "x - extracting rcsclean.cs (Text)"
sed 's/^X//' << 'SHAR_EOF' > rcsclean.cs &&
X(-W1 -DUSG -DSTRICT_LOCKING=1
X-DCO=\"co.exe\" -DDIFF=\"diff.exe\"
Xrcsclean.c rcsfnms.c rcssyn.c rcslex.c
Xrcsrev.c rcsutil.c
X)
Xsetargv.obj
Xrcsclean.exe
Xrcsclean.def
X-AS -LB -S0x2000
SHAR_EOF
$TOUCH -am 0908233090 rcsclean.cs &&
chmod 0666 rcsclean.cs ||
echo "restore of rcsclean.cs failed"
set `wc -c rcsclean.cs`;Wc_c=$1
if test "$Wc_c" != "181"; then
	echo original size 181, current size $Wc_c
fi
fi
# ============= rcsdiff.cs ==============
if test X"$1" != X"-c" -a -f 'rcsdiff.cs'; then
	echo "File already exists: skipping 'rcsdiff.cs'"
else
echo "x - extracting rcsdiff.cs (Text)"
sed 's/^X//' << 'SHAR_EOF' > rcsdiff.cs &&
X(-W1 -DUSG -DSTRICT_LOCKING=1
X-DCO=\"co.exe\" -DDIFF=\"diff.exe\"
Xrcsdiff.c rcsutil.c rcsfnms.c rcsrev.c rcssyn.c rcslex.c
X)
Xsetargv.obj
Xrcsdiff.exe
Xrcsdiff.def
X-AS -LB -S0x2000
SHAR_EOF
$TOUCH -am 0908231190 rcsdiff.cs &&
chmod 0666 rcsdiff.cs ||
echo "restore of rcsdiff.cs failed"
set `wc -c rcsdiff.cs`;Wc_c=$1
if test "$Wc_c" != "178"; then
	echo original size 178, current size $Wc_c
fi
fi
# ============= rcsmerge.cs ==============
if test X"$1" != X"-c" -a -f 'rcsmerge.cs'; then
	echo "File already exists: skipping 'rcsmerge.cs'"
else
echo "x - extracting rcsmerge.cs (Text)"
sed 's/^X//' << 'SHAR_EOF' > rcsmerge.cs &&
X(-W1 -DUSG -DSTRICT_LOCKING=1
X-DCO=\"co.exe\" -DDIFF=\"diff.exe\" -DMERGE=\"merge.cmd\"
Xrcsmerge.c rcsutil.c rcsfnms.c rcsrev.c rcssyn.c rcslex.c
X)
Xsetargv.obj
Xrcsmerge.exe
Xrcsmerge.def
X-AS -LB -S0x2000
SHAR_EOF
$TOUCH -am 0909154790 rcsmerge.cs &&
chmod 0666 rcsmerge.cs ||
echo "restore of rcsmerge.cs failed"
set `wc -c rcsmerge.cs`;Wc_c=$1
if test "$Wc_c" != "203"; then
	echo original size 203, current size $Wc_c
fi
fi
# ============= rlog.cs ==============
if test X"$1" != X"-c" -a -f 'rlog.cs'; then
	echo "File already exists: skipping 'rlog.cs'"
else
echo "x - extracting rlog.cs (Text)"
sed 's/^X//' << 'SHAR_EOF' > rlog.cs &&
X(-W1 -DUSG -DSTRICT_LOCKING=1
X-DCO=\"co.exe\" -DDIFF=\"diff.exe\"
Xrlog.c rcslex.c rcssyn.c rcsrev.c rcsutil.c partime.c maketime.c rcsfnms.c
X)
Xsetargv.obj
Xrcslog.exe
Xrlog.def
X-AC -LB -S0x2000
SHAR_EOF
$TOUCH -am 0909141790 rlog.cs &&
chmod 0666 rlog.cs ||
echo "restore of rlog.cs failed"
set `wc -c rlog.cs`;Wc_c=$1
if test "$Wc_c" != "192"; then
	echo original size 192, current size $Wc_c
fi
fi
# ============= ci.def ==============
if test X"$1" != X"-c" -a -f 'ci.def'; then
	echo "File already exists: skipping 'ci.def'"
else
echo "x - extracting ci.def (Text)"
sed 's/^X//' << 'SHAR_EOF' > ci.def &&
XNAME CI WINDOWCOMPAT NEWFILES
XDESCRIPTION 'RCS 4.2 - for MS-DOS and OS/2'
SHAR_EOF
$TOUCH -am 0909130790 ci.def &&
chmod 0666 ci.def ||
echo "restore of ci.def failed"
set `wc -c ci.def`;Wc_c=$1
if test "$Wc_c" != "74"; then
	echo original size 74, current size $Wc_c
fi
fi
# ============= co.def ==============
if test X"$1" != X"-c" -a -f 'co.def'; then
	echo "File already exists: skipping 'co.def'"
else
echo "x - extracting co.def (Text)"
sed 's/^X//' << 'SHAR_EOF' > co.def &&
XNAME CO WINDOWCOMPAT NEWFILES
XDESCRIPTION 'RCS 4.2 - for MS-DOS and OS/2'
SHAR_EOF
$TOUCH -am 0909130790 co.def &&
chmod 0666 co.def ||
echo "restore of co.def failed"
set `wc -c co.def`;Wc_c=$1
if test "$Wc_c" != "74"; then
	echo original size 74, current size $Wc_c
fi
fi
# ============= ident.def ==============
if test X"$1" != X"-c" -a -f 'ident.def'; then
	echo "File already exists: skipping 'ident.def'"
else
echo "x - extracting ident.def (Text)"
sed 's/^X//' << 'SHAR_EOF' > ident.def &&
XNAME IDENT WINDOWCOMPAT NEWFILES
XDESCRIPTION 'RCS 4.2 - for MS-DOS and OS/2'
SHAR_EOF
$TOUCH -am 0909130790 ident.def &&
chmod 0666 ident.def ||
echo "restore of ident.def failed"
set `wc -c ident.def`;Wc_c=$1
if test "$Wc_c" != "77"; then
	echo original size 77, current size $Wc_c
fi
fi
# ============= rcs.def ==============
if test X"$1" != X"-c" -a -f 'rcs.def'; then
	echo "File already exists: skipping 'rcs.def'"
else
echo "x - extracting rcs.def (Text)"
sed 's/^X//' << 'SHAR_EOF' > rcs.def &&
XNAME RCS WINDOWCOMPAT NEWFILES
XDESCRIPTION 'RCS 4.2 - for MS-DOS and OS/2'
SHAR_EOF
$TOUCH -am 0909130790 rcs.def &&
chmod 0666 rcs.def ||
echo "restore of rcs.def failed"
set `wc -c rcs.def`;Wc_c=$1
if test "$Wc_c" != "75"; then
	echo original size 75, current size $Wc_c
fi
fi
# ============= rcsclean.def ==============
if test X"$1" != X"-c" -a -f 'rcsclean.def'; then
	echo "File already exists: skipping 'rcsclean.def'"
else
echo "x - extracting rcsclean.def (Text)"
sed 's/^X//' << 'SHAR_EOF' > rcsclean.def &&
XNAME RCSCLEAN WINDOWCOMPAT NEWFILES
XDESCRIPTION 'RCS 4.2 - for MS-DOS and OS/2'
SHAR_EOF
$TOUCH -am 0909130790 rcsclean.def &&
chmod 0666 rcsclean.def ||
echo "restore of rcsclean.def failed"
set `wc -c rcsclean.def`;Wc_c=$1
if test "$Wc_c" != "80"; then
	echo original size 80, current size $Wc_c
fi
fi
# ============= rcsdiff.def ==============
if test X"$1" != X"-c" -a -f 'rcsdiff.def'; then
	echo "File already exists: skipping 'rcsdiff.def'"
else
echo "x - extracting rcsdiff.def (Text)"
sed 's/^X//' << 'SHAR_EOF' > rcsdiff.def &&
XNAME RCSDIFF WINDOWCOMPAT NEWFILES
XDESCRIPTION 'RCS 4.2 - for MS-DOS and OS/2'
SHAR_EOF
$TOUCH -am 0909130790 rcsdiff.def &&
chmod 0666 rcsdiff.def ||
echo "restore of rcsdiff.def failed"
set `wc -c rcsdiff.def`;Wc_c=$1
if test "$Wc_c" != "79"; then
	echo original size 79, current size $Wc_c
fi
fi
# ============= rcsmerge.def ==============
if test X"$1" != X"-c" -a -f 'rcsmerge.def'; then
	echo "File already exists: skipping 'rcsmerge.def'"
else
echo "x - extracting rcsmerge.def (Text)"
sed 's/^X//' << 'SHAR_EOF' > rcsmerge.def &&
XNAME RCSMERGE WINDOWCOMPAT NEWFILES
XDESCRIPTION 'RCS 4.2 - for MS-DOS and OS/2'
SHAR_EOF
$TOUCH -am 0909130790 rcsmerge.def &&
chmod 0666 rcsmerge.def ||
echo "restore of rcsmerge.def failed"
set `wc -c rcsmerge.def`;Wc_c=$1
if test "$Wc_c" != "80"; then
	echo original size 80, current size $Wc_c
fi
fi
# ============= rlog.def ==============
if test X"$1" != X"-c" -a -f 'rlog.def'; then
	echo "File already exists: skipping 'rlog.def'"
else
echo "x - extracting rlog.def (Text)"
sed 's/^X//' << 'SHAR_EOF' > rlog.def &&
XNAME RLOG WINDOWCOMPAT NEWFILES
XDESCRIPTION 'RCS 4.2 - for MS-DOS and OS/2'
SHAR_EOF
$TOUCH -am 0909130890 rlog.def &&
chmod 0666 rlog.def ||
echo "restore of rlog.def failed"
set `wc -c rlog.def`;Wc_c=$1
if test "$Wc_c" != "76"; then
	echo original size 76, current size $Wc_c
fi
fi
# ============= merge.cmd ==============
if test X"$1" != X"-c" -a -f 'merge.cmd'; then
	echo "File already exists: skipping 'merge.cmd'"
else
echo "x - extracting merge.cmd (Text)"
sed 's/^X//' << 'SHAR_EOF' > merge.cmd &&
Xextproc sh
X
X#	$Id: merge.sh,v 5.2 90/07/15 11:32:01 ROOT_DOS Release $
X
XDIFF=diff
XDIFF3=diff3
Xp=w
Xcase $1 in
X-p)
X	p='1,$p'
X	shift
Xesac
X
Xcase $# in
X0|1|2)
X        echo >&2 ""
X	echo >&2 "Usage: merge [-p] file1 file2 file3"
X	exit 1
Xesac
X
Xcase $p in
Xw)
X	if test ! -w $1
X	then
X		echo >&2 "$1 not writeable"
X		exit 1
X	fi
Xesac
X
Xtrap 's=$?; rm -f d3a$$ d3b$$; exit $s' 0
Xtrap exit 1 2 3 13 15
Xumask 077
X
X$DIFF $1 $3 >d3a$$
Xcase $? in
X0|1) ;;
X*) exit
Xesac
X
X$DIFF $2 $3 >d3b$$
Xcase $? in
X0|1) ;;
X*) exit
Xesac
X
X{
X	$DIFF3 -E d3a$$ d3b$$ $1 $2 $3 $4 $5
X	case $? in
X	0) ;;
X	1) echo >&2 merge: warning: 1 overlap during merge.;;
X	*) echo >&2 merge: warning: $? overlaps during merge.
X	esac
X	echo $p
X} | ed - $1
SHAR_EOF
$TOUCH -am 0909141190 merge.cmd &&
chmod 0666 merge.cmd ||
echo "restore of merge.cmd failed"
set `wc -c merge.cmd`;Wc_c=$1
if test "$Wc_c" != "697"; then
	echo original size 697, current size $Wc_c
fi
fi
exit 0
--
/* Kai Uwe Rommel
 * Munich
 * rommel@lan.informatik.tu-muenchen.dbp.de
 */