[alt.sources] diffs for RCS 4.3 for OS/2

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

The following shar contains patches for plain RCS 4.3 to create a
version that can be used under OS/2. To compile, you need MS C 6.0 and
my Compiler Shell 4.6 or above. The makefile.msc is *not* up to date, I
included it as starting point for those who want to use some make. It
was included with RCS 4.2 for DOS and can be modified for this version.

Kai Uwe Rommel

#!/bin/sh
# This is a shell archive (produced by shar 3.53)
# To extract the files from this archive, save it to a file, remove
# everything above the "!/bin/sh" line above, and type "sh file_name".
#
# made 10/02/1990 02:28 UTC by unknown@os2
# Source directory E:\
#
# existing files will NOT be overwritten unless -c is specified
#
# This shar contains:
# length  mode       name
# ------ ---------- ------------------------------------------
#   1837 -rw-rw-rw- readme.os2
#  59049 -rw-rw-rw- patches.os2
#    236 -rw-rw-rw- ci.cs
#    223 -rw-rw-rw- co.cs
#    106 -rw-rw-rw- ident.cs
#    197 -rw-rw-rw- rcs.cs
#    191 -rw-rw-rw- rcsclean.cs
#    185 -rw-rw-rw- rcsdiff.cs
#    190 -rw-rw-rw- rcsmerge.cs
#    161 -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
#   3567 -rw-rw-rw- makefile.msc
#    745 -rwxrwxrwx merge.cmd
#
# ============= readme.os2 ==============
if test -f 'readme.os2' -a X"$1" != X"-c"; then
	echo 'x - skipping readme.os2 (File already exists)'
else
echo 'x - extracting readme.os2 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'readme.os2' &&
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. I made diffs to plain rcs 4.2 and applied them to plain rcs 4.3
which I had available and made some additional changes.
X
To compile, MS C 6.00 is required, 5.10 does not work (lib functions).
To use it, you need GNU diff.
X
The following changes were made:
- 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.
- 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.
- On output, RCS converts path names now to lowercase and / separators.
X  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
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.
- The USER environment variable is also recognized (besides USR).
- A bug in the spawning routine caused redirected stdio files to
X  remain open after the spawn and thus made them unremovable.
X
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.
X
X
Kai Uwe Rommel
rommel@lan.informatik.tu-muenchen.dbp.de
SHAR_EOF
chmod 0666 readme.os2 ||
echo 'restore of readme.os2 failed'
Wc_c="`wc -c 'readme.os2'`"
test 1802 -eq "$Wc_c" ||
	echo 'readme.os2: original size 1802, current size' "$Wc_c"
fi
# ============= patches.os2 ==============
if test -f 'patches.os2' -a X"$1" != X"-c"; then
	echo 'x - skipping patches.os2 (File already exists)'
else
echo 'x - extracting patches.os2 (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'patches.os2' &&
Only in rcs43-2: readme.os2
Only in rcs43-2: patches.os2
Only in rcs43-2/src: makefile.msc
Only in rcs43-2/src: ci.cs
Only in rcs43-2/src: ci.def
Only in rcs43-2/src: co.cs
Only in rcs43-2/src: co.def
Only in rcs43-2/src: ident.cs
Only in rcs43-2/src: ident.def
Only in rcs43-2/src: rcs.cs
Only in rcs43-2/src: rcs.def
Only in rcs43-2/src: rcsclean.cs
Only in rcs43-2/src: rcsclean.def
Only in rcs43-2/src: rcsdiff.cs
Only in rcs43-2/src: rcsdiff.def
Only in rcs43-2/src: rcsmerge.cs
Only in rcs43-2/src: rcsmerge.def
Only in rcs43-2/src: rlog.cs
Only in rcs43-2/src: rlog.def
diff -cbBwr rcs43/src/ci.c rcs43-2/src/ci.c
*** rcs43/src/ci.c	Wed Sep 19 19:02:52 1990
--- rcs43-2/src/ci.c	Fri Sep 21 15:11:44 1990
***************
*** 179,184 ****
--- 179,190 ----
X
X  char * newRCSfilename, * diffilename;
X  char * RCSfilename,*workfilename,*expfilename,*newworkfilename;
+
+ #ifdef MSDOS
+ char tmpdir[NCPPN];
+ extern char *gettmpdir();
+ #endif /* MSDOS */
+
X  extern struct stat RCSstat, workstat; /* file status of RCS and work file   */
X  extern int  haveRCSstat, haveworkstat;/* status indicators                  */
X
***************
*** 358,363 ****
--- 364,372 ----
X                  faterror("Can't take both log and description from redirected stdin; use -ttextfile");
X          }
X          /* now handle all filenames */
+ #ifdef MSDOS
+ 	strcpy( tmpdir, gettmpdir());
+ #endif /* MSDOS */
X          do {
X          gendeltas[0] = nil;
X          copyflag=rewriteflag=false;
***************
*** 486,503 ****
--- 495,532 ----
X                  if(!putdtext(newdelnum,newdelta.log,workfilename,frewrite)) continue;
X                  ffclose(frewrite); frewrite=NULL;
X          } else {
+ #ifdef MSDOS
+                 diffilename=mktempfile(tmpdir,DIFFILE);
+ #else
X                  diffilename=mktempfile("/tmp/",DIFFILE);
+ #endif /* MSDOS */
X                  if (&newdelta==Head) {
X                          /* prepend new one */
X                          rewriteflag=false;
X                          if (!(expfilename=
+ #ifdef MSDOS
+                               buildrevision(gendeltas,targetdelta,tmpdir,false))) continue;
+ #else
X                                buildrevision(gendeltas,targetdelta,"/tmp/",false))) continue;
+ #endif /* MSDOS */
X                          if (!mustcheckin(expfilename,targetdelta)) continue;
X                                  /* don't check in files that aren't different, unless forced*/
X                          newdelta.log=getlogmsg();
X                          exit_stats = run((char*)nil, diffilename,
+ #ifdef MSDOS
+ #	ifdef GNUDIFF
+ 				DIFF,"-a","-n",workfilename,expfilename, (char*)nil);
+ #	elif MKS
+ 				DIFF,"-n",workfilename,expfilename, (char*)nil);
+ #	endif
+ #else
X  				DIFF,"-n",workfilename,expfilename, (char*)nil);
+ #endif /* MSDOS */
+ #ifdef MSDOS
+                         if (exit_stats != 0 && exit_stats != 1 )
+ #else
X                          if (exit_stats != 0 && exit_stats != (1 << BYTESIZ))
+ #endif /* MSDOS */
X                              faterror ("diff failed");
X                          /* diff returns 2 in the upper byte on failure */
X                          if(!putdtext(newdelnum,newdelta.log,workfilename,frewrite)) continue;
***************
*** 506,518 ****
--- 535,563 ----
X                          /* insert new delta text */
X                          rewriteflag=true;
X                          if (!(expfilename=
+ #ifdef MSDOS
+                               buildrevision(gendeltas,targetdelta,tmpdir,false))) continue;
+ #else
X                                buildrevision(gendeltas,targetdelta,"/tmp/",false))) continue;
+ #endif /* MSDOS */
X                          if (!mustcheckin(expfilename,targetdelta)) continue;
X                                  /* don't check in files that aren't different, unless forced*/
X                          newdelta.log=getlogmsg();
X                          exit_stats = run((char*)nil, diffilename,
+ #ifdef MSDOS
+ #ifdef GNUDIFF
+ 				DIFF,"-a","-n",expfilename,workfilename, (char*)nil);
+ #	elif MKS
+ 				DIFF,"-n",expfilename,workfilename, (char*)nil);
+ #	endif
+ #else
X  				DIFF,"-n",expfilename,workfilename, (char*)nil);
+ #endif /* MSDOS */
+ #ifdef MSDOS
+                         if (exit_stats != 0 && exit_stats != 1 )
+ #else
X                          if (exit_stats != 0 && exit_stats != (1 << BYTESIZ))
+ #endif /* MSDOS */
X                              faterror ("diff failed");
X                          if(!putdtext(newdelnum,newdelta.log,diffilename,frewrite)) continue;
X                  }
***************
*** 520,528 ****
--- 565,578 ----
X                  /* rewrite rest of RCS file */
X                  fastcopy(finptr,frewrite);
X                  ffclose(frewrite); frewrite=NULL;
+                 ffclose(finptr);   finptr=NULL;
X          }
X  	ignoreints();
+ #ifdef MSDOS
+         if (Rename(newRCSfilename,RCSfilename)<0) {
+ #else
X          if (rename(newRCSfilename,RCSfilename)<0) {
+ #endif /* MSDOS */
X                  error("Can't write new RCS file %s; saved in %s",
X                        RCSfilename,newRCSfilename);
X                  newRCSfilename[0]='\0'; /* avoid deletion by cleanup*/
***************
*** 532,538 ****
--- 582,592 ----
X          }
X          newRCSfilename[0]='\0'; /* avoid re-unlinking by cleanup()*/
X
+ #ifdef MSDOS
+ 	newRCSmode= (initflag|rcsinitflag?workstat.st_mode:RCSstat.st_mode)& ~S_IWRITE;
+ #else
X  	newRCSmode= (initflag|rcsinitflag?workstat.st_mode:RCSstat.st_mode)& ~0222;
+ #endif /* MSDOS */
X  	/* newRCSmode is also used to adjust mode of working file for -u and -l */
X  	if (chmod(RCSfilename,newRCSmode)<0)
X                  warn("Can't set mode of %s",RCSfilename);
***************
*** 550,556 ****
--- 604,614 ----
X                  xpandfile(workfilename,workfilename /*for directory*/,&newdelta);
X                  if (!newworkfilename) continue; /* expand failed */
X  		ignoreints();
+ #ifdef MSDOS
+ 		if (Rename(newworkfilename,workfilename) <0) {
+ #else
X  		if (rename(newworkfilename,workfilename) <0) {
+ #endif /* MSDOS */
X                      error("Can't expand keywords in %s",workfilename);
X                      restoreints();
X                      continue;
***************
*** 628,634 ****
--- 686,696 ----
X                  } else {
X                      /* no existing lock; try Dbranch */
X                      /* update newdelnum */
+ #ifdef MSDOS
+                     if (!(StrictLocks==false) ) {
+ #else
X                      if (!((StrictLocks==false) && (getuid() == RCSstat.st_uid))) {
+ #endif /* MSDOS */
X                          error("no lock set by %s",caller);
X                          return false;
X                      }
***************
*** 797,803 ****
--- 859,869 ----
X                  next->delta->lockedby=nil; /* reset locked-by */
X                  return next->delta;
X          } else {
+ #ifdef MSDOS
+                 if (!(StrictLocks==false) ) {
+ #else
X                  if (!((StrictLocks==false) && (getuid() == RCSstat.st_uid))) {
+ #endif /* MSDOS */
X                      error("no lock set by %s for revision %s",who,num);
X                      return nil;
X                  } else {
***************
*** 945,951 ****
--- 1011,1021 ----
X
X          /* now read string from stdin */
X          if (ttystdin()) {
+ #ifdef MSDOS
+                 VOID fputs("enter log message:\n(terminate with ^Z or single '.')\n>> ",stderr);
+ #else
X                  VOID fputs("enter log message:\n(terminate with ^D or single '.')\n>> ",stderr);
+ #endif /* MSDOS */
X          } else {  /* redirected stdin */
X                  if (stdinread>0)
X                      faterror("Can't reread redirected stdin for log message; use -m");
diff -cbBwr rcs43/src/co.c rcs43-2/src/co.c
*** rcs43/src/co.c	Wed Sep 19 19:02:52 1990
--- rcs43-2/src/co.c	Fri Sep 21 15:37:56 1990
***************
*** 152,157 ****
--- 152,161 ----
X
X  char * newRCSfilename, * neworkfilename;
X  char * RCSfilename, * workfilename;
+ #ifdef MSDOS
+ char tmpdir[NCPPN];
+ char *gettmpdir();
+ #endif /* MSDOS */
X  extern struct stat RCSstat, workstat; /* file status of RCS and work file   */
X  extern int  haveRCSstat, haveworkstat;/* status indicators                  */
X
***************
*** 242,252 ****
--- 246,260 ----
X                          break;
X
X                  case 'j':
+ #ifdef MSDOS /* Current Version can't treat join */
+ 			faterror("Current Version can't treat join");
+ #else
X                          if ((*argv)[2]!='\0'){
X                                  if (join!=nil)warn("Redefinition of -j option");
X                                  join = (*argv)+2;
X                          }
X                          break;
+ #endif /* MSDOS */
X
X                  case 's':
X                          if ((*argv)[2]!='\0'){
***************
*** 270,275 ****
--- 278,286 ----
X
X          if (argc<1) faterror("No input file\n%s",cmdusage);
X
+ #ifdef MSDOS
+ 	strcpy( tmpdir, gettmpdir() );
+ #endif /* MSDOS */
X          /* now handle all filenames */
X          do {
X          rewriteflag=false;
***************
*** 353,359 ****
--- 364,374 ----
X                  getdesc(false); /* don't echo*/
X
X                  if (!(neworkfilename=buildrevision(gendeltas,targetdelta,
+ #ifdef MSDOS
+                       tostdout?(join!=nil? tmpdir:(char *)nil):workfilename,true)))
+ #else
X                        tostdout?(join!=nil?"/tmp/":(char *)nil):workfilename,true)))
+ #endif /* MSDOS */
X                                  continue;
X
X                  if ((lockflag||killock==1)&&nerror==0) {
***************
*** 360,367 ****
--- 375,387 ----
X                          /* rewrite the rest of the RCSfile */
X                          fastcopy(finptr,frewrite);
X                          ffclose(frewrite); frewrite=NULL;
+                         ffclose(finptr);   finptr=NULL;
X  			ignoreints();
+ #ifdef MSDOS
+                         if (Rename(newRCSfilename,RCSfilename) != 0 ) {
+ #else
X                          if (rename(newRCSfilename,RCSfilename)<0) {
+ #endif /* MSDOS */
X                                  error("Can't rewrite %s; saved in: %s",
X                                  RCSfilename, newRCSfilename);
X                                  newRCSfilename[0]='\0'; /* avoid deletion*/
***************
*** 369,375 ****
--- 389,399 ----
X                                  break;
X                          }
X                          newRCSfilename[0]='\0'; /* avoid re-deletion by cleanup()*/
+ #ifdef MSDOS
+                         if (chmod(RCSfilename,RCSstat.st_mode & ~S_IWRITE)<0)
+ #else
X                          if (chmod(RCSfilename,RCSstat.st_mode & ~0222)<0)
+ #endif /* MSDOS */
X                              warn("Can't preserve mode of %s",RCSfilename);
X                          restoreints();
X                  }
***************
*** 383,389 ****
--- 407,417 ----
X  			if (!buildjoin(neworkfilename)) continue;
X                  }
X                  if (!tostdout) {
+ #ifdef MSDOS
+ 			if (Rename(neworkfilename,workfilename) <0) {
+ #else
X  			if (rename(neworkfilename,workfilename) <0) {
+ #endif /* MSDOS */
X                                  error("Can't create %s; see %s",workfilename,neworkfilename);
X                                  neworkfilename[0]= '\0'; /*avoid deletion*/
X                                  continue;
***************
*** 423,429 ****
--- 451,461 ----
X          if (haveworkstat< 0)      /* File doesn't exist; set by pairfilenames*/
X              return (true);        /* No problem */
X
+ #ifdef MSDOS
+ 	if ((workstat.st_mode & S_IWRITE)&&!forceflag) {    /* File is writable */
+ #else
X  	if ((workstat.st_mode & 0222)&&!forceflag) {    /* File is writable */
+ #endif /* MSDOS */
X              if (!quietflag) {
X                  VOID fprintf(stderr,"writable %s exists; overwrite? [ny](n): ",workfilename);
X                  /* must be stderr in case of IO redirect */
***************
*** 612,619 ****
--- 644,656 ----
X          char * rev2, * rev3;
X          int i;
X
+ #ifdef MSDOS
+         rev2=mktempfile(tmpdir,JOINFIL2);
+         rev3=mktempfile(tmpdir,JOINFIL3);
+ #else
X          rev2=mktempfile("/tmp/",JOINFIL2);
X          rev3=mktempfile("/tmp/",JOINFIL3);
+ #endif /* MSDOS */
X
X          i=0;
X          while (i<lastjoin) {
diff -cbBwr rcs43/src/ident.c rcs43-2/src/ident.c
*** rcs43/src/ident.c	Wed Sep 19 19:02:56 1990
--- rcs43-2/src/ident.c	Fri Sep 21 15:07:46 1990
***************
*** 104,110 ****
--- 104,114 ----
X     }
X
X     while ( --argc > 0 ) {
+ #ifdef MSDOS
+ 	  if ( (fp = fopen(*++argv, "rb") ) == NULL ) {
+ #else
X        if ( (fp = fopen(*++argv, "r") ) == NULL ) {
+ #endif
X           VOID fprintf(stderr,  "ident error: can't open %s\n", *argv);
X           continue;
X        } else {
diff -cbBwr rcs43/src/partime.c rcs43-2/src/partime.c
*** rcs43/src/partime.c	Wed Sep 19 19:02:52 1990
--- rcs43-2/src/partime.c	Fri Sep 21 15:11:46 1990
***************
*** 468,474 ****
X  {	register char *cp, *mp;
X  	register int c;
X  	struct tmwent *lastptr;
! 	struct integ { int word; };   /* For getting at array ptr */
X  	int i;
X
X  	lastptr = 0;
--- 468,474 ----
X  {	register char *cp, *mp;
X  	register int c;
X  	struct tmwent *lastptr;
! 	struct integ { long word; };   /* For getting at array ptr */
X  	int i;
X
X  	lastptr = 0;
diff -cbBwr rcs43/src/rcs.c rcs43-2/src/rcs.c
*** rcs43/src/rcs.c	Wed Sep 19 19:02:54 1990
--- rcs43-2/src/rcs.c	Fri Sep 21 15:11:50 1990
***************
*** 192,197 ****
--- 192,202 ----
X  struct  access  *curaccess,  *rmaccess;
X  struct  hshentry        * gendeltas[hshsize];
X
+ #ifdef MSDOS
+ extern char *gettmpdir();
+ char	tmpdir[NCPPN];
+ #endif /* MSDOS */
+
X  struct  Lockrev {
X          char    * revno;
X          struct  Lockrev   * nextrev;
***************
*** 449,455 ****
X              diagnose("%s aborted",cmdid);
X              exit(1);
X          }
!
X          /* now handle all filenames */
X          do {
X          rewriteflag = false;
--- 454,462 ----
X              diagnose("%s aborted",cmdid);
X              exit(1);
X          }
! #ifdef MSDOS
! 	strcpy( tmpdir, gettmpdir() );
! #endif /* MSDOS */
X          /* now handle all filenames */
X          do {
X          rewriteflag = false;
***************
*** 557,564 ****
--- 564,576 ----
X
X
X          /* prepare for rewriting the RCS file */
+ #ifdef MSDOS
+         newRCSfilename=mktempfile(RCSfilename,NEWRCSFILE);
+         oldumask = umask(S_IWRITE); /* turn off write bits */
+ #else
X          newRCSfilename=mktempfile(RCSfilename,NEWRCSFILE);
X          oldumask = umask(0222); /* turn off write bits */
+ #endif /* MSDOS */
X          if ((frewrite=fopen(newRCSfilename, "w"))==NULL) {
X                  VOID fclose(finptr);
X                  error("Can't open file %s",newRCSfilename);
***************
*** 584,592 ****
--- 596,609 ----
X              }
X          }
X          ffclose(frewrite);   frewrite = NULL;
+         ffclose(finptr);     finptr=NULL;
X          if ( ! nerror ) {  /*  move temporary file to RCS file if no error */
X  	    ignoreints();		/* ignore interrupts */
+ #ifdef MSDOS
+             if(Rename(newRCSfilename,RCSfilename)<0) {
+ #else
X              if(rename(newRCSfilename,RCSfilename)<0) {
+ #endif /* MSDOS */
X                  error("Can't create RCS file %s; saved in %s",
X                     RCSfilename, newRCSfilename);
X                  newRCSfilename[0] = '\0';  /*  avoid deletion by cleanup  */
***************
*** 1022,1028 ****
--- 1039,1049 ----
X          if (response=='\n'||response=='n'||response=='N') return false;
X
X          /* go ahead with breaking  */
+ #ifdef MSDOS
+         messagefile=mktempfile( tmpdir, "mmXXXXXX");
+ #else
X          messagefile=mktempfile("/tmp/", "RCSmailXXXXXX");
+ #endif /* MSDOS */
X          if ( (mailmess = fopen(messagefile, "w")) == NULL) {
X              faterror("Can't open file %s", messagefile);
X          }
***************
*** 1490,1500 ****
--- 1511,1529 ----
X          int  i, c, exit_stats;
X
X          cuttail->selector = DELETE;
+ #ifdef MSDOS
+         initeditfiles( tmpdir );
+ #else
X          initeditfiles("/tmp/");
+ #endif /* MSDOS */
X          scanlogtext(deltas[0], copy);
X          i = 1;
X          if ( cuthead )  {
+ #ifdef MSDOS
+             cutfilename=mktempfile( tmpdir, "ctXXXXXX");
+ #else
X              cutfilename=mktempfile("/tmp/", "RCScutXXXXXX");
+ #endif /* MSDOS */
X              if ( (fcut = fopen(cutfilename, "w")) == NULL) {
X                  faterror("Can't open temporary file %s", cutfilename);
X              }
***************
*** 1514,1523 ****
--- 1543,1568 ----
X          finishedit((struct hshentry *)nil);    ffclose(fcopy);
X
X          if ( cuthead ) {
+ #ifdef MSDOS
+             diffilename=mktempfile( tmpdir, "dfXXXXXX");
+ #else
X              diffilename=mktempfile("/tmp/", "RCSdifXXXXXX");
+ #endif /* MSDOS */
X              exit_stats = run((char*)nil,diffilename,
+ #ifdef MSDOS
+ #	ifdef GNUDIFF
+ 			DIFF,"-n","-a",cutfilename,resultfile,(char*)nil);
+ #	elif MKS
+ 			DIFF,"-n",cutfilename,resultfile,(char*)nil);
+ #	endif
+ #else
X  			DIFF,"-n",cutfilename,resultfile,(char*)nil);
+ #endif /* MSDOS */
+ #ifdef MSDOS
+             if (exit_stats != 0 && exit_stats != 1 )
+ #else
X              if (exit_stats != 0 && exit_stats != (1 << BYTESIZ))
+ #endif /* MSDOS */
X                  faterror ("diff failed");
X              if(!putdtext(cuttail->num,curlogmsg,diffilename,frewrite)) return;
X          }
diff -cbBwr rcs43/src/rcsbase.h rcs43-2/src/rcsbase.h
*** rcs43/src/rcsbase.h	Wed Sep 19 19:02:54 1990
--- rcs43-2/src/rcsbase.h	Fri Sep 21 15:17:16 1990
***************
*** 127,132 ****
--- 127,135 ----
X
X
X  #include <stdio.h>
+ #ifdef MKS
+ #define STREQ(a,b)	( strcmp( (a), (b) ) == 0 )
+ #endif
X  #ifdef USG
X  #include <string.h>
X  #else
***************
*** 137,143 ****
--- 140,150 ----
X
X  #ifdef USG
X  #       define rindex    strrchr
+ #ifdef MSDOS
+ #       define DATEFORM  "%02d.%02d.%02d.%02d.%02d.%02d"
+ #else
X  #       define DATEFORM  "%.2d.%.2d.%.2d.%.2d.%.2d.%.2d"
+ #endif
X  #else
X  #       define DATEFORM  "%02d.%02d.%02d.%02d.%02d.%02d"
X  #endif
***************
*** 175,182 ****
--- 182,194 ----
X  #define datelength         20 /* length of a date in RCS format             */
X  #define joinlength         20 /* number of joined revisions permitted       */
X  #define RCSDIR         "RCS/" /* subdirectory for RCS files                 */
+ #ifdef MSDOS		/* Added by $Author: lfk $ */
+ #define RCSSUF            '\0' /* suffix for RCS files                       */
+ #define RCSSEP            '\0' /* separator for RCSSUF                       */
+ #else
X  #define RCSSUF            'v' /* suffix for RCS files                       */
X  #define RCSSEP            ',' /* separator for RCSSUF                       */
+ #endif /* MSDOS */
X  #define KDELIM            '$' /* delimiter for keywords                     */
X  #define VDELIM            ':' /* separates keywords from values             */
X  #define DEFAULTSTATE    "Exp" /* default state of revisions                 */
***************
*** 184,191 ****
--- 196,208 ----
X  #  define NCPFN           256 /* number of characters per filename          */
X  #  define NCPPN          1024 /* number of characters per pathname          */
X  #else
+ #ifdef MSDOS		/* support OS/2 HPFS */
+ #  define NCPFN           256 /* number of characters per filename          */
+ #  define NCPPN       	  256 /* number of characters per pathname          */
+ #else
X  #  define NCPFN            14 /* number of characters per filename          */
X  #  define NCPPN       6*NCPFN /* number of characters per pathname          */
+ #endif /* MSDOS */
X  #endif
X  #define keylength          20 /* buffer length for expansion keywords       */
X  #define keyvallength NCPPN+revlength+datelength+60
***************
*** 202,207 ****
--- 219,233 ----
X
X  /* temporary file names */
X
+ #ifdef MSDOS			/* Added by $Author: lfk $ */
+ #define NEWRCSFILE  "nwXXXXXX"
+ #define DIFFILE     "ciXXXXXX"
+ #define TMPFILE1    "t1XXXXXX"
+ #define TMPFILE2    "t2XXXXXX"
+ #define TMPFILE3    "t3XXXXXX"
+ #define JOINFIL2    "j2XXXXXX"
+ #define JOINFIL3    "j3XXXXXX"
+ #else
X  #define NEWRCSFILE  ",RCSnewXXXXXX"
X  #define DIFFILE     ",RCSciXXXXXX"
X  #define TMPFILE1    ",RCSt1XXXXXX"
***************
*** 209,214 ****
--- 235,241 ----
X  #define TMPFILE3    ",RCSt3XXXXXX"
X  #define JOINFIL2    ",RCSj2XXXXXX"
X  #define JOINFIL3    ",RCSj3XXXXXX"
+ #endif /* MSDOS */
X
X
X  #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(unsigned)(x))):fflsbuf((unsigned)(x),p))
***************
*** 218,224 ****
--- 245,255 ----
X  /* GETC modifies a local variable c; a kludge, but smaller and faster.      */
X  /* GETC writes a del-character (octal 177) on end of file                   */
X
+ #ifdef MSDOS
+ #define WORKMODE(RCSmode) (RCSmode & ~S_IWRITE)|((lockflag||!StrictLocks)? ( S_IWRITE | S_IREAD ) : 0000 )
+ #else
X  #define WORKMODE(RCSmode) (RCSmode&~0222)|((lockflag||!StrictLocks)?0600:0000)
+ #endif /* MSDOS */
X  /* computes mode of working file: same as RCSmode, but write permission     */
X  /* determined by lockflag and StrictLocks.                                  */
X
diff -cbBwr rcs43/src/rcsclean.c rcs43-2/src/rcsclean.c
*** rcs43/src/rcsclean.c	Wed Sep 19 19:02:56 1990
--- rcs43-2/src/rcsclean.c	Fri Sep 21 16:25:54 1990
***************
*** 66,71 ****
--- 66,73 ----
X   *
X   */
X  #include "rcsbase.h"
+ #include <sys/types.h>
+ #include <sys/stat.h>
X  #define ERRCODE 2                   /*error code for exit status            */
X  #ifndef lint
X  static char rcsbaseid[] = RCSBASE;
***************
*** 82,87 ****
--- 84,94 ----
X  extern FILE * finptr;               /* RCS input file                       */
X  extern FILE * fopen();
X
+ #ifdef MSDOS
+ extern char *gettmpdir();
+ char tmpdir[NCPPN];
+ #endif /* MSDOS */
+
X  char *RCSfilename;
X  char *workfilename;
X  char * tempfile;
***************
*** 130,135 ****
--- 137,146 ----
X
X  	if (argc<1) fterror("No input file\n%s", cmdusage);
X
+ #ifdef MSDOS
+ 	strcpy( tmpdir, gettmpdir() );
+ #endif /* MSDOS */
+
X          /* now handle all filenames */
X          do {
X                  finptr=NULL;
***************
*** 159,165 ****
--- 170,180 ----
X  		if (!expandsym(rev,numericrev)) continue;
X                  if (!(target=genrevs(numericrev,(char *)nil,(char *)nil,(char *)nil,gendeltas))) continue;
X
+ #ifdef MSDOS
+ 		tempfile=mktempfile( tmpdir ,TMPFILE1);
+ #else
X  		tempfile=mktempfile("/tmp/",TMPFILE1);
+ #endif /* MSDOS */
X  		diagnose("retrieving revision %s",target->num);
X                  VOID sprintf(command,"%s -q -p%s %s > %s\n",
X  			CO ,target->num,RCSfilename,tempfile);
***************
*** 182,191 ****
--- 197,209 ----
X  				/* identical files; can remove working file */
X  				result=0;
X  				diagnose("files identical; %s removed",workfilename);
+                                 fclose(file2);
+                                 chmod(workfilename, S_IREAD | S_IWRITE);
X  				if (unlink(workfilename)!=0) {
X  					error("Can't unlink %s",workfilename);
X  				}
X  				if (findlock(caller, false)) {
+                                     VOID fclose(finptr); finptr=NULL;
X  				    VOID sprintf(command,"%s -q -u%s %s\n",
X  						 RCS_CMD, target->num, RCSfilename);
X  				    if (system(command)) {
diff -cbBwr rcs43/src/rcsdiff.c rcs43-2/src/rcsdiff.c
*** rcs43/src/rcsdiff.c	Wed Sep 19 19:02:56 1990
--- rcs43-2/src/rcsdiff.c	Fri Sep 21 15:10:10 1990
***************
*** 111,116 ****
--- 111,122 ----
X  char *workfilename;
X  char * temp1file, * temp2file;
X
+ #ifdef MSDOS
+ int old_stdout;
+ char *gettmpdir();
+ char tmpdir[NCPPN];
+ #endif /* MSDOS */
+
X  char bops[10];
X  char otherops[10];
X
***************
*** 197,202 ****
--- 203,212 ----
X  	}
X  	if (argc<1) fterror("No input file\n%s",cmdusage);
X
+ #ifdef MSDOS
+ 	strcpy( tmpdir, gettmpdir() );
+ 	old_stdout = dup(1);
+ #endif /* MSDOS */
X          /* now handle all filenames */
X          do {
X                  finptr=NULL;
***************
*** 231,237 ****
--- 241,251 ----
X                  }
X
X
+ #ifdef MSDOS
+                 temp1file=mktempfile(tmpdir,TMPFILE1);
+ #else
X                  temp1file=mktempfile("/tmp/",TMPFILE1);
+ #endif /* MSDOS */
X                  diagnose("retrieving revision %s",xrev1);
X                  VOID sprintf(commarg,"-p%s",xrev1);
X                  if (run((char*)nil,temp1file, co,"-q",commarg,RCSfilename,(char*)nil)){
***************
*** 242,248 ****
--- 256,266 ----
X                          temp2file=workfilename;
X                          diagnose("diff%s%s -r%s %s",boption,otheroption,xrev1,workfilename);
X                  } else {
+ #ifdef MSDOS
+                         temp2file=mktempfile(tmpdir,TMPFILE2);
+ #else
X                          temp2file=mktempfile("/tmp/",TMPFILE2);
+ #endif /* MSDOS */
X                          diagnose("retrieving revision %s",xrev2);
X  			VOID sprintf(commarg,"-p%s",xrev2);
X                          if (run((char*)nil,temp2file, co,"-q",commarg,RCSfilename,(char *)nil)){
***************
*** 251,267 ****
X                          }
X                          diagnose("diff%s%s -r%s -r%s",boption,otheroption,xrev1,xrev2);
X                  }
!
X                  exit_stats =
X  			*boption
X  			? *otheroption
X  			  ? run((char*)nil,(char*)nil, DIFF, boption+1,	otheroption+1,	temp1file,temp2file,(char*)nil)
X  			  : run((char*)nil,(char*)nil, DIFF, boption+1,			temp1file,temp2file,(char*)nil)
X  			: *otheroption
X  			  ? run((char*)nil,(char*)nil, DIFF, 		otheroption+1,	temp1file,temp2file,(char*)nil)
X  			  : run((char*)nil,(char*)nil, DIFF, 				temp1file,temp2file,(char*)nil);
X
X                  if (exit_stats == (1 << BYTESIZ))
X  			diffs_found = 1;
X                  else if (exit_stats != 0) {
X                          error ("diff failed");
--- 269,312 ----
X                          }
X                          diagnose("diff%s%s -r%s -r%s",boption,otheroption,xrev1,xrev2);
X                  }
! #ifdef MSDOS
! #	ifdef MKS
! 		dup2( old_stdout, 1 );
!                 exit_stats =
! 			*boption
! 			? *otheroption
! 			  ? spawnlp( 0, DIFF, DIFF, boption+1, otheroption+1, temp1file,temp2file,NULL)
! 			  : spawnlp( 0, DIFF, DIFF, boption+1, temp1file, temp2file, NULL)
! 			: *otheroption
! 			  ? spawnlp( 0, DIFF, DIFF, otheroption+1, temp1file,temp2file, NULL)
! 			  : spawnlp( 0, DIFF, DIFF, temp1file, temp2file, NULL);
! #	else
! 		dup2( old_stdout, 1 );
X                  exit_stats =
X  			*boption
X  			? *otheroption
+ 			  ? spawnlp( 0, DIFF, DIFF, "-a", boption+1, otheroption+1, temp1file,temp2file,NULL)
+ 			  : spawnlp( 0, DIFF, DIFF, "-a", boption+1, temp1file, temp2file, NULL)
+ 			: *otheroption
+ 			  ? spawnlp( 0, DIFF, DIFF, "-a", otheroption+1, temp1file,temp2file, NULL)
+ 			  : spawnlp( 0, DIFF, DIFF, "-a", temp1file, temp2file, NULL);
+ #	endif
+ #else
+                 exit_stats =
+ 			*boption
+ 			? *otheroption
X  			  ? run((char*)nil,(char*)nil, DIFF, boption+1,	otheroption+1,	temp1file,temp2file,(char*)nil)
X  			  : run((char*)nil,(char*)nil, DIFF, boption+1,			temp1file,temp2file,(char*)nil)
X  			: *otheroption
X  			  ? run((char*)nil,(char*)nil, DIFF, 		otheroption+1,	temp1file,temp2file,(char*)nil)
X  			  : run((char*)nil,(char*)nil, DIFF, 				temp1file,temp2file,(char*)nil);
+ #endif /* MSDOS */
X
+ #ifdef MSDOS
+                 if (exit_stats == 1 )
+ #else
X                  if (exit_stats == (1 << BYTESIZ))
+ #endif /* MSDOS */
X  			diffs_found = 1;
X                  else if (exit_stats != 0) {
X                          error ("diff failed");
diff -cbBwr rcs43/src/rcsedit.c rcs43-2/src/rcsedit.c
*** rcs43/src/rcsedit.c	Wed Sep 19 19:02:52 1990
--- rcs43-2/src/rcsedit.c	Fri Sep 21 15:57:46 1990
***************
*** 474,480 ****
--- 474,484 ----
X  	case Header:
X  		VOID putc(VDELIM,out); VOID putc(' ',out);
X  		if (marker==Id)
+ #ifdef MSDOS
X  			 VOID fputs(bindex(RCSfilename,'/'),out);
+ #	else
+ 			 VOID fputs(bindex(RCSfilename,'/'),out);
+ #endif /* MSDOS */
X  		else     VOID fputs(getfullRCSname(),out);
X  		VOID fprintf(out," %s ", delta->num);
X                  VOID PRINTDATE(out,date);VOID putc(' ',out);VOID PRINTTIME(out,date);
***************
*** 490,495 ****
--- 494,500 ----
X          case Log:
X                  VOID fprintf(out, "%c\t%s %c\n%sRevision %s  ",
X                          VDELIM, bindex(RCSfilename,'/'), KDELIM, Comment, delta->num);
+              /* 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*/
***************
*** 498,503 ****
--- 503,509 ----
X                  /* Comment is the comment leader */
X                  break;
X          case RCSfile:
+              /* 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:
***************
*** 513,518 ****
X                  VOID putc(KDELIM,out);
X                  break;
X          }
- }
-
X
--- 519,522 ----
diff -cbBwr rcs43/src/rcsfnms.c rcs43-2/src/rcsfnms.c
*** rcs43/src/rcsfnms.c	Wed Sep 19 19:02:54 1990
--- rcs43-2/src/rcsfnms.c	Fri Sep 21 15:19:02 1990
***************
*** 120,126 ****
--- 120,131 ----
X  #include "rcsbase.h"
X  #include <sys/types.h>
X  #include <sys/stat.h>
+ #ifdef MSDOS
+ #include <stdlib.h>
+ #include <direct.h>
+ #else
X  #include <sys/dir.h>
+ #endif /* MSDOS */
X
X  extern char * rindex();
X  extern char * mktemp();
***************
*** 154,174 ****
X  /* table is used to guess the proper comment leader from the working file's */
X  /* suffix during initial ci (see InitAdmin()). Comment leaders are needed   */
X  /* for languages without multiline comments; for others they are optional.  */
X          "c",   " * ",   /* C           */
X  	"csh", "# ",    /* shell       */
X          "e",   "# ",    /* efl         */
X          "f",   "c ",    /* fortran     */
X          "h",   " * ",   /* C-header    */
X          "l",   " * ",   /* lex         NOTE: conflict between lex and franzlisp*/
X          "mac", "; ",    /* macro       vms or dec-20 or pdp-11 macro */
X  	"me",  ".\\\" ",/* me-macros   t/nroff*/
X  	"mm",  ".\\\" ",/* mm-macros   t/nroff*/
X  	"ms",  ".\\\" ",/* ms-macros   t/nroff*/
X          "p",   " * ",   /* pascal      */
X  	"pl",  "% ",	/* prolog      */
X          "r",   "# ",    /* ratfor      */
X          "red", "% ",    /* psl/rlisp   */
!
X  #ifdef sparc
X          "s",   "! ",    /* assembler   */
X  #endif
--- 159,207 ----
X  /* table is used to guess the proper comment leader from the working file's */
X  /* suffix during initial ci (see InitAdmin()). Comment leaders are needed   */
X  /* for languages without multiline comments; for others they are optional.  */
+ /* According to your MSDOS-environment, you change these settlements. !!    */
+ /* If you can work on UN*X, it is worthwile to keep these.                  */
+ /* It however, may cause lack of memory on MSDOS                           */
+ /* $Author: lfk $                                                      */
+ 		"",		"# ",		/* default for empty suffix */
+ 		"awk",	"# ",		/* AWK */
X          "c",   " * ",   /* C           */
+ #ifdef ALL
+ 		"c++"	"// "		/* C++ */
+ 		"cc"	"// "		/* C++ */
+ 		"CC"	"// "		/* C++ */
+ 		"C"		"// "		/* C++ */
+ 		"cl",	";;; ",		/* common lisp */
X  	"csh", "# ",    /* shell       */
X          "e",   "# ",    /* efl         */
+ 		"el",	"; ",		/* gnulisp     */
+ #endif
X          "f",   "c ",    /* fortran     */
X          "h",   " * ",   /* C-header    */
+ 		"ksh",	"# ",		/* korn shell  */
X          "l",   " * ",   /* lex         NOTE: conflict between lex and franzlisp*/
X          "mac", "; ",    /* macro       vms or dec-20 or pdp-11 macro */
X  	"me",  ".\\\" ",/* me-macros   t/nroff*/
+ #ifdef ALL
+ 		"ml",	"; ",		/* mocklisp    */
+ #endif
X  	"mm",  ".\\\" ",/* mm-macros   t/nroff*/
X  	"ms",  ".\\\" ",/* ms-macros   t/nroff*/
+ #ifdef ALL
X          "p",   " * ",   /* pascal      */
+ 		"perl",	"# ",		/* L. Wall's Perl */
X  	"pl",  "% ",	/* prolog      */
X          "r",   "# ",    /* ratfor      */
X          "red", "% ",    /* psl/rlisp   */
! 		"sh",	"# ",		/* shell       */
! 		"sl",	"% ",		/* psl         */
! #endif
! 		"tex",	"% ",		/* tex	       */
! 		"y",	" * ",		/* yacc        */
! #ifdef ALL
! 		"ye",	" * ",		/* yacc-efl    */
! 		"yr",	" * ",		/* yacc-ratfor */
! #endif
X  #ifdef sparc
X          "s",   "! ",    /* assembler   */
X  #endif
***************
*** 181,198 ****
X  #ifdef vax
X          "s",   "# ",    /* assembler   */
X  #endif
!
!         "sh",  "# ",    /* shell       */
!         "sl",  "% ",    /* psl         */
!         "red", "% ",    /* psl/rlisp   */
!         "cl",  ";;; ",  /* common lisp   */
!         "ml",  "; ",    /* mocklisp    */
!         "el",  "; ",    /* gnulisp     */
! 	"tex", "% ",	/* tex	       */
!         "y",   " * ",   /* yacc        */
!         "ye",  " * ",   /* yacc-efl    */
!         "yr",  " * ",   /* yacc-ratfor */
!         "",    "# ",    /* default for empty suffix */
X          nil,   ""       /* default for unknown suffix; must always be last */
X  };
X
--- 214,228 ----
X  #ifdef vax
X          "s",   "# ",    /* assembler   */
X  #endif
! #ifdef MSDOS
! 		"asm",	"; ",	/* assembler   */
! 		"bat",	"REM ",	/* MS-DOS command.com */
! 		"cxx",	"// ",	/* MS-DOS c++ */
! 		"fin",	".\\\" ",	/* for *.fin files on MSDOS */
! 		"fma",	".\\\" ",	/* for fma-macors fin on MSDOS */
! 		"for",	"c ",	/* MS Fortran */
! 		"pl",	"# ",	/* L. Wall's Perl for MS-DOS */
! #endif /* MSDOS */
X          nil,   ""       /* default for unknown suffix; must always be last */
X  };
X
***************
*** 216,221 ****
--- 246,252 ----
X   * The name of the semaphore file is put into variable semafilename.
X   */
X  {
+ #ifndef MSDOS
X          register char * tp, *sp, *lp;
X          int fdesc;
X
***************
*** 249,254 ****
--- 280,289 ----
X                       madesema=true;
X          }
X          return true;
+ #else /* NOT MSDOS */
+ 	makesema = true;
+ 	return true;
+ #endif /* NOT MSDOS */
X  }
X
X
***************
*** 257,262 ****
--- 292,300 ----
X   * sets madesema to false.
X   */
X  {
+ #ifdef MSDOS
+ 	madesema = false ;
+ #else
X          if (madesema) {
X                  madesema=false;
X                  if (unlink(semafilename) == -1) {
***************
*** 263,272 ****
X                          error("Can't find semaphore file %s",semafilename);
X                  }
X          }
X  }
X
-
-
X  InitCleanup()
X  {       freefilename =  0;  /* initialize pointer */
X  }
--- 301,309 ----
X                          error("Can't find semaphore file %s",semafilename);
X                  }
X          }
+ #endif /* MSDOS */
X  }
X
X  InitCleanup()
X  {       freefilename =  0;  /* initialize pointer */
X  }
***************
*** 303,312 ****
--- 340,358 ----
X          register char * lastslash, *tp;
X          if ((tp=tfnames[freefilename])==nil)
X                tp=tfnames[freefilename] = talloc(NCPPN);
+ #ifdef MSDOS
+ 	if (fullpath!=nil)
+           if ( (lastslash=rindex(fullpath,'/'))!=0 ||
+                (lastslash=rindex(fullpath,'\\'))!=0) {
+                 /* copy path */
+                 while (fullpath<=lastslash) *tp++ = *fullpath++;
+           }
+ #else
X          if (fullpath!=nil && (lastslash=rindex(fullpath,'/'))!=0) {
X                  /* copy path */
X                  while (fullpath<=lastslash) *tp++ = *fullpath++;
X          }
+ #endif /* MSDOS */
X          while (*tp++ = *filename++);
X          return (mktemp(tfnames[freefilename++]));
X  }
***************
*** 342,347 ****
--- 388,396 ----
X
X          /* guess the comment leader from the suffix*/
X          Suffix=bindex(workfilename, '.');
+ #ifdef MSDOS
+ 	Suffix = strlwr( Suffix );
+ #endif /* MSDOS */
X          if (Suffix==workfilename) Suffix= ""; /* empty suffix; will get default*/
X          for (i=0;;i++) {
X                  if (comtable[i].suffix==nil) {
***************
*** 356,361 ****
--- 405,422 ----
X  }
X
X
+ #ifdef MSDOS
+ void _unixpath(char *pathbuf)
+ {
+   int i;
+
+   strlwr(pathbuf);
+
+   for ( i = 0; i <= strlen(pathbuf); i++)
+     if(pathbuf[i] == '\\')
+       pathbuf[i] = '/';
+ }
+ #endif
X
X  char * findpairfile(argc, argv, fname)
X  int argc; char * argv[], *fname;
***************
*** 369,375 ****
--- 430,442 ----
X          register int count;
X
X          for (next = argv, count = argc; count>0; next++,count--) {
+ #ifdef MSDOS
+ 		if ((*next != nil) &&
+                     (strcmp(bindex(*next,'/'),fname)==0 ||
+ 		     strcmp(bindex(*next,'\\'),fname)==0)) {
+ #	else
X                  if ((*next != nil) && strcmp(bindex(*next,'/'),fname)==0) {
+ #endif /* MSDOS */
X                          /* bindex finds the beginning of the file name stem */
X                          match= *next;
X                          *next=nil;
***************
*** 419,424 ****
--- 486,495 ----
X          register char * sp, * tp;
X          char * lastsep, * purefname, * pureRCSname;
X          int opened, returncode;
+ #ifdef MSDOS
+         char *help;
+ 	struct stat dirstat;
+ #endif /* MSDOS */
X          char * RCS1;
X  	char prefdir[NCPPN];
X
***************
*** 431,437 ****
--- 502,554 ----
X          InitCleanup();
X
X          /* first check suffix to see whether it is an RCS file or not */
+ #ifdef MSDOS
X  		purefname=bindex(*argv, '/'); /* skip path */
+ 	if ( (help=bindex(*argv, '\\')) > purefname )
+           purefname = help;
+ #else
+         purefname=bindex(*argv, '/'); /* skip path */
+ #endif /* MSDOS */
+ #ifdef MSDOS
+ 	if ( (pureRCSname = strstr(*argv, "rcs/")) != NULL ||
+ 	     (pureRCSname = strstr(*argv, "rcs\\")) != NULL ||
+ 	     (pureRCSname = strstr(*argv, "RCS\\")) != NULL ) {
+                 /* RCS file name given*/
+ 		RCS1 = (*argv);
+                 /* derive workfilename*/
+ 		sp = purefname; tp=tempfilename;
+ 		while( *sp != '\0' ) *tp++=*sp++; *tp= '\0';
+                 workfilename=findpairfile(argc-1,argv+1,tempfilename);
+ 		if( strlen(pureRCSname) > NCPFN + 4 ) {
+ 			/* To avoid, ambiguous file name. eg."RCS\RCS\foo.c" */
+ 			if( strlen(pureRCSname + 4) != (int) NULL ){
+ 				error("file name %s is ambiguous", RCS1);
+ 				return 0;
+ 			}
+ 			error("RCS file name %s too long",RCS1);
+ 			return 0;
+ 		}
+ 	} else {
+                 /* working file given; now try to find RCS file */
+ 		workfilename=*argv;
+ 		/* derive RCS file name*/
+ 		strcpy( tempfilename, "rcs/" );
+ 		strcat( tempfilename, purefname );
+                 RCS1=findpairfile(argc-1,argv+1,tempfilename);
+ 		if ( (pureRCSname = strstr(RCS1, "rcs/")) == NULL )
+ 		  if ( (pureRCSname = strstr(RCS1, "rcs\\")) == NULL )
+ 			pureRCSname = strstr( RCS1, "RCS\\" );
+ 		if (strlen(pureRCSname)>NCPFN+4) {
+                         error("working file name %s too long",workfilename);
+                         return 0;
+                 }
+         }
+ 	if( strchr( workfilename, '/' ) != NULL ||
+ 	    strchr( workfilename, '\\' ) != NULL ){
+ 		error("Sorry, file name %s confuses RCS", workfilename );
+ 		return 0;
+ 	}
+ #else /* MSDOS */
X          lastsep=rindex(purefname, RCSSEP);
X          if (lastsep!= 0 && *(lastsep+1)==RCSSUF && *(lastsep+2)=='\0') {
X                  /* RCS file name given*/
***************
*** 460,467 ****
--- 577,612 ----
X                          return 0;
X                  }
X          }
+ #endif /* MSDOS */
X          /* now we have a (tentative) RCS filename in RCS1 and workfilename  */
X          /* Try to find the right RCS file */
+ #ifdef MSDOS
+ 	RCSfilename=pureRCSname;
+ 	if (pureRCSname != RCS1){
+ 		error("Sorry, file name %s confuse RCS", RCS1);
+ 		return 0;
+ 	}else{
+ 		opened = ( ( finptr=fopen(pureRCSname, "r" ) ) != NULL );
+ 		if(opened){
+ 			returncode = 1;
+ 		}else{
+                         if (mustread) {
+ 				error("Can't find %s",RCSfilename);
+                                 return 0;
+ 			}else{
+ 				if( stat("RCS", &dirstat) == -1 ){
+ 					error("Can't find RCS subdirectory");
+ 					return 0;
+ 				}else{
+ 					if( !( dirstat.st_mode & S_IFDIR ) ){
+ 						error("RCS is really directory?");
+ 						return 0;
+ 					}else returncode = -1;
+ 				}
+ 			}
+ 		}
+ 	}
+ #else /* MSDOS */
X          if (pureRCSname!=RCS1) {
X                  /* a path for RCSfile is given; single RCS file to look for */
X                  finptr=fopen(RCSfilename=RCS1, "r");
***************
*** 521,527 ****
X                          }
X                  }
X          }
!
X          if (returncode == 1) { /* RCS file open */
X                  haveRCSstat=fstat(fileno(finptr),&RCSstat);
X                  if ((haveRCSstat== 0) && ((RCSstat.st_mode & S_IFDIR) == S_IFDIR)) {
--- 666,672 ----
X                          }
X                  }
X          }
! #endif /* MSDOS */
X          if (returncode == 1) { /* RCS file open */
X                  haveRCSstat=fstat(fileno(finptr),&RCSstat);
X                  if ((haveRCSstat== 0) && ((RCSstat.st_mode & S_IFDIR) == S_IFDIR)) {
***************
*** 540,545 ****
--- 685,694 ----
X                  /* file names was given in the argument list        */
X                  warn("Option -p is set; ignoring output file %s",workfilename);
X
+ #ifdef MSDOS
+         _unixpath(RCSfilename);
+         _unixpath(workfilename);
+ #endif
X          return returncode;
X  }
X
***************
*** 549,555 ****
X   * Calls getwd(), but only once.
X   * removes leading "../" and "./".
X   */
! {       static char pathbuf[NCPPN];
X          static char namebuf[NCPPN];
X          static int  pathlength;
X
--- 698,712 ----
X   * Calls getwd(), but only once.
X   * removes leading "../" and "./".
X   */
! {
! #ifdef MSDOS
!         static char pathbuf[NCPPN];
!
!         _fullpath(pathbuf, RCSfilename, sizeof(pathbuf));
!         _unixpath(pathbuf);
!         return pathbuf;
! #else
!         static char pathbuf[NCPPN];
X          static char namebuf[NCPPN];
X          static int  pathlength;
X
***************
*** 604,613 ****
X                      return(namebuf);
X                  }
X          }
X  }
X
!
!
X  int trydiraccess(filename)
X  char * filename;
X  /* checks write permission in directory of filename and returns
--- 761,771 ----
X                      return(namebuf);
X                  }
X          }
+ #endif
X  }
X
! /* In MSDOS and (perhaps) OS/2, any directries are writable. 	*/
! /* So, the below check is NON-SENSE !! : $Author: lfk $ 		*/
X  int trydiraccess(filename)
X  char * filename;
X  /* checks write permission in directory of filename and returns
***************
*** 616,621 ****
--- 774,783 ----
X  {
X          char pathname[NCPPN];
X          register char * tp, *sp, *lp;
+
+ #ifdef MSDOS
+ 	return true;
+ #else
X          lp = rindex(filename,'/');
X          if (lp==0) {
X                  /* check current directory */
***************
*** 637,642 ****
--- 799,805 ----
X                  error("Directory %s not writable", pathname);
X                  return false;
X          }
+ #endif /* MSDOS */
X  }
X
X
***************
*** 644,650 ****
X  #ifndef V4_2BSD
X  /* rename() and getwd() will be provided in bsd 4.2 */
X
!
X  int rename(from, to)
X  char * from, *to;
X  /* Function: renames a file with the name given by from to the name given by to.
--- 807,813 ----
X  #ifndef V4_2BSD
X  /* rename() and getwd() will be provided in bsd 4.2 */
X
! #ifndef MSDOS
X  int rename(from, to)
X  char * from, *to;
X  /* Function: renames a file with the name given by from to the name given by to.
***************
*** 733,742 ****
X  fail:   VOID fclose(file);
X          return NULL;
X  }
X
!
X  #endif
X
X
X  #ifdef PAIRTEST
X  /* test program for pairfilenames() and getfullRCSname() */
--- 896,930 ----
X  fail:   VOID fclose(file);
X          return NULL;
X  }
+ #else /* MSDOS */
X
! char *getwd(name)
! char	*name;
! {
! 	int a,i;
! 	(void)getcwd(name, NCPPN);
! 	strlwr(name);
! 	a = strlen(name);
! 	for ( i = 0; i <= a; i++)
! 		if(name[i] == '\\')
! 			name[i] = '/';
! 	return name;
! }
! #endif /* MSODS */
X  #endif
+ #ifdef MSDOS
+ char *gettmpdir()
+ {
+ 	char tp[NCPPN];
+
+ 	strcpy( tp, (char *) getenv("TMP") );
+ 	if( *tp == (char) NULL ) strcpy( tp, "." );
+ 	if( tp[strlen(tp) - 1] != '\\' )
+ 		strcat( tp, "\\" );
+ 	return tp;
+ }
X
+ #endif /* MSDOS */
X
X  #ifdef PAIRTEST
X  /* test program for pairfilenames() and getfullRCSname() */
diff -cbBwr rcs43/src/rcsgen.c rcs43-2/src/rcsgen.c
*** rcs43/src/rcsgen.c	Wed Sep 19 19:02:56 1990
--- rcs43-2/src/rcsgen.c	Fri Sep 21 15:08:02 1990
***************
*** 107,114 ****
X  extern FILE * fcopy;       /* result file during editing                    */
X  extern char * resultfile;  /* file name for fcopy                           */
X  extern int    rewriteflag; /* indicates whether to rewrite the input file   */
X
-
X  char    curlogmsg[logsize]; /* buffer for current log message                */
X
X  enum stringwork {copy, edit, expand, edit_expand };
--- 107,116 ----
X  extern FILE * fcopy;       /* result file during editing                    */
X  extern char * resultfile;  /* file name for fcopy                           */
X  extern int    rewriteflag; /* indicates whether to rewrite the input file   */
+ #ifdef MSDOS
+ extern char tmpdir[NCPPN];
+ #endif /* MSDOS */
X
X  char    curlogmsg[logsize]; /* buffer for current log message                */
X
X  enum stringwork {copy, edit, expand, edit_expand };
***************
*** 151,157 ****
--- 153,163 ----
X                  }
X          } else {
X                  /* several revisions to generate */
+ #ifdef MSDOS
+                 initeditfiles(dir?dir: tmpdir);
+ #else
X                  initeditfiles(dir?dir:"/tmp/");
+ #endif /* MSDOS */
X                  /* write initial revision into fcopy, no keyword expansion */
X                  scandeltatext(deltas[0],copy);
X                  i = 1;
***************
*** 285,291 ****
--- 291,301 ----
X                  }
X                  /* read text from stdin */
X                  if (ttystdin()) {
+ #ifdef MSDOS
+                     VOID fputs("enter description, terminated with ^Z or '.':\n",stderr);
+ #else
X                      VOID fputs("enter description, terminated with ^D or '.':\n",stderr);
+ #endif /* MSDOS */
X                      VOID fputs("NOTE: This is NOT the log message!\n>> ",stderr);
X  		    if (feof(stdin))
X  		            clearerr(stdin);
diff -cbBwr rcs43/src/rcslex.c rcs43-2/src/rcslex.c
*** rcs43/src/rcslex.c	Wed Sep 19 19:02:54 1990
--- rcs43-2/src/rcslex.c	Fri Sep 21 15:08:04 1990
***************
*** 137,143 ****
--- 137,147 ----
X                              /*into the symbol table. Handle with care.      */
X  int             nextc;      /*next input character, initialized by Lexinit  */
X
+ #ifdef MSDOS
+ int             eoftok;        /*end-of-file indicator, set to >0 on end of file*/
+ #else
X  int             eof;        /*end-of-file indicator, set to >0 on end of file*/
+ #endif /* MSDOS */
X  int             line;       /*current line-number of input                  */
X  int             nerror;     /*counter for errors                            */
X  int             nwarn;      /*counter for warnings                          */
***************
*** 241,247 ****
--- 245,255 ----
X                  hshtab[c].num = nil;
X          }
X
+ #ifdef MSDOS
+         hshenter=true; eoftok=0; line=1; nerror=0; nwarn=0;
+ #else
X          hshenter=true; eof=0; line=1; nerror=0; nwarn=0;
+ #endif /* MSDOS */
X          NextString=nil; Topchar = &StringTab[0];
X          if (finptr) {
X                  nextc = GETC(finptr,frewrite,rewriteflag); /*initial character*/
***************
*** 272,278 ****
--- 280,290 ----
X          register char * sp;
X          register enum tokens d;
X
+ #ifdef MSDOS
+         if (eoftok) {
+ #else
X          if (eof) {
+ #endif /* MSDOS */
X                  nexttok=EOFILE;
X                  return;
X          }
***************
*** 299,305 ****
--- 311,321 ----
X                  goto loop;
X
X          case EOFILE:
+ #ifdef MSDOS
+                 eoftok++;
+ #else
X                  eof++;
+ #endif /* MSDOS */
X                  nexttok=EOFILE;
X                  return;
X
***************
*** 692,702 ****
--- 708,722 ----
X  	va_list ap;
X
X  	va_start(ap);
+ #ifdef MSDOS
+ 	VOID vfprintf(iop, fmt, ap);
+ #else
X  #ifdef VFPRINTF
X  	VOID vfprintf(iop, fmt, ap);
X  #else
X  	_doprnt(fmt, ap, iop);
X  #endif
+ #endif /* MSDOS */
X          if (ferror(iop)) {
X  		writeerror();
X                  value = EOF;
diff -cbBwr rcs43/src/rcsmerge.c rcs43-2/src/rcsmerge.c
*** orig/src/rcsmerge.c	Mon Oct 01 19:03:34 1990
--- rcs/src/rcsmerge.c	Mon Oct 01 18:47:56 1990
***************
*** 88,93 ****
--- 88,98 ----
X  extern struct hshentry * genrevs(); /*generate delta numbers                */
X  extern int  nerror;                 /*counter for errors                    */
X
+ #ifdef MSDOS
+ extern char *getmpdir();
+ char	tmpdir[NCPPN];
+ #endif /* MSODS */
+
X  char *RCSfilename;
X  char *workfilename;
X  char * temp1file, * temp2file;
***************
*** 135,140 ****
--- 140,149 ----
X          if (argc<1) faterror("No input file\n%s",cmdusage);
X          if (revnums<1) faterror("no base revision number given");
X
+ #ifdef MSDOS
+ 	strcpy( tmpdir, (char *) gettmpdir() );
+ #endif /* MSDOS */
+
X          /* now handle all filenames */
X
X          if (pairfilenames(argc,argv,true,false)==1) {
***************
*** 175,182 ****
--- 184,196 ----
X  			goto end;
X  		}
X
+ #ifdef MSDOS
+                 temp1file=mktempfile(tmpdir,TMPFILE1);
+                 temp2file=mktempfile(tmpdir,TMPFILE2);
+ #else
X                  temp1file=mktempfile("/tmp/",TMPFILE1);
X                  temp2file=mktempfile("/tmp/",TMPFILE2);
+ #endif /* MSDOS */
X
X                  diagnose("retrieving revision %s",rev1);
X                  VOID sprintf(commarg,"-p%s",rev1);
***************
*** 194,201 ****
--- 208,220 ----
X
X                  if (
X  		      tostdout
+ #ifdef MSDOS
+ 			? run((char*)nil,(char*)nil,"sh",merge,"-p",workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)
+ 		    : run((char*)nil,(char*)nil,"sh",merge,     workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)) {
+ #else
X  		    ? run((char*)nil,(char*)nil,merge,"-p",workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)
X  		    : run((char*)nil,(char*)nil,merge,     workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)) {
+ #endif
X                          faterror("merge failed");
X                  }
X          }
diff -cbBwr rcs43/src/rcsrev.c rcs43-2/src/rcsrev.c
*** rcs43/src/rcsrev.c	Wed Sep 19 19:02:56 1990
--- rcs43-2/src/rcsrev.c	Fri Sep 21 15:08:06 1990
***************
*** 713,716 ****
X  cleanup(){}
X  /*dummy*/
X
! #endif REVTEST
--- 713,716 ----
X  cleanup(){}
X  /*dummy*/
X
! #endif /* REVTEST */
diff -cbBwr rcs43/src/rcsutil.c rcs43-2/src/rcsutil.c
*** rcs43/src/rcsutil.c	Wed Sep 19 19:02:52 1990
--- rcs43-2/src/rcsutil.c	Fri Sep 21 16:04:12 1990
***************
*** 110,116 ****
--- 110,118 ----
X  #include <sys/stat.h>
X  #include <signal.h>
X  #include "rcsbase.h"
+ #ifndef MSDOS
X  #include <pwd.h>
+ #endif /* NOT MSDOS */
X  #include <varargs.h>
X
X  #if defined(USG) || defined(V4_2BSD)
***************
*** 117,133 ****
X  #include <fcntl.h>
X  #endif
X
X  #ifndef V4_2BSD
X  #define vfork fork
X  #endif
X
X  extern char * bindex();
X  extern FILE * finptr;
X  extern char * RCSfilename;
X  extern char * getlogin();
X  extern struct passwd *getpwuid();
- extern char * malloc();
X  extern int errno;
X
X
X  char * talloc(size)
--- 119,139 ----
X  #include <fcntl.h>
X  #endif
X
+ #ifndef MSDOS
X  #ifndef V4_2BSD
X  #define vfork fork
X  #endif
+ #endif /* NOT MSDOS */
X
X  extern char * bindex();
X  extern FILE * finptr;
X  extern char * RCSfilename;
+ #ifndef MSDOS
X  extern char * getlogin();
X  extern struct passwd *getpwuid();
X  extern int errno;
+ #endif /* NOT MSDOS */
+ extern char * malloc();
X
X
X  char * talloc(size)
***************
*** 140,152 ****
X  	return p;
X  }
X
!
X
X  char * getcaller()
X  /* Function: gets the callers login from his uid.
X   * If the uid is root, tries to get the true login with getlogin().
X   */
! {       char * name;
X  	int uid;
X  	uid=getuid();
X  	if (uid==0) {
--- 146,173 ----
X  	return p;
X  }
X
! #ifdef MSDOS
! char * getenv( char * var );
! #endif
X
X  char * getcaller()
X  /* Function: gets the callers login from his uid.
X   * If the uid is root, tries to get the true login with getlogin().
X   */
! {
! 	char *name = "Unknown";
! 	char *tmpname;
! #ifdef MSDOS
! #	ifndef MKS
! 	if ((tmpname = getenv("USR")) != NULL)
! #	else
! 	if ((tmpname = getenv("LOGNAME")) != NULL)
! #	endif
! 		name = tmpname;
! 	else if ((tmpname = getenv("USER")) != NULL)
! 		name = tmpname;
! 	return name;
! #else
X  	int uid;
X  	uid=getuid();
X  	if (uid==0) {
***************
*** 156,161 ****
--- 177,183 ----
X  			return name;
X  	}
X  	return(getpwuid(uid)->pw_name);
+ #endif /* MSDOS */
X  }
X
X
***************
*** 281,287 ****
--- 303,313 ----
X          register struct access * next;
X          struct stat statbuf;
X
+ #ifdef MSDOS
+         if ((AccessList==nil) || (strcmp(who,"ROOT_DOS")==0))
+ #else
X          if ((AccessList==nil) || (strcmp(who,"root")==0))
+ #endif /* MSDOS */
X                  return true;
X
X          next=AccessList;
***************
*** 291,305 ****
--- 317,340 ----
X                  next=next->nextaccess;
X          } while (next!=nil);
X
+ #ifdef MSDOS
+ #else
X          VOID fstat(fileno(finptr),&statbuf);  /* get owner of file */
X          if (getuid() == statbuf.st_uid) return true;
+ #endif /* MSDOS */
X
X          error("User %s not on the access list",who);
X          return false;
X  }
X
+ /* In MSDOS, we have a few signals. 	*/
+ /* So, we set signal handlar for only SIGINT. $Author: lfk $	*/
X
+ #ifdef MSDOS
+ void catchsig(void)
+ #else
X  static SIGNAL_TYPE catchsig(s)
+ #endif /* MSDOS */
X  {
X  	ignoreints();
X          diagnose("\nRCS: cleaning up\n");
***************
*** 310,341 ****
X  #endif
X  }
X
X  static sig[] = {SIGINT,SIGHUP,SIGQUIT,SIGPIPE,SIGTERM};
X  #define SIGS (sizeof(sig)/sizeof(*sig))
X  static SIGNAL_TYPE (*catcher[SIGS])();
!
X    void catchints()
X    {
X  	register i;
X  	for (i=SIGS; 0<=--i; )
X  	    catcher[i]  =
X  		signal(sig[i],SIG_IGN) == SIG_IGN  ?  SIG_IGN  :  catchsig;
X  	restoreints();
X    }
X
X    void ignoreints()
X    {
X  	register i;
X  	for (i=SIGS; 0<=--i; )
X  		VOID signal(sig[i], SIG_IGN);
X    }
X
X  void restoreints()
X  {
X  	register i;
X  	for (i=SIGS; 0<=--i; )
X  		if (catcher[i] != SIG_IGN)
X  			VOID signal(sig[i], catcher[i]);
X  }
X
X  fastcopy(inf,outf)
--- 345,390 ----
X  #endif
X  }
X
+ #ifndef MSDOS
X  static sig[] = {SIGINT,SIGHUP,SIGQUIT,SIGPIPE,SIGTERM};
X  #define SIGS (sizeof(sig)/sizeof(*sig))
X  static SIGNAL_TYPE (*catcher[SIGS])();
! #endif /* NOT MSDOS */
X    void catchints()
X    {
+ #ifdef MSDOS
+ 	signal(SIGINT, catchsig); /* $Author: lfk $ fixed this so Ctrl-C halts processing */
+ 	restoreints();
+ #else
X  	register i;
X  	for (i=SIGS; 0<=--i; )
X  	    catcher[i]  =
X  		signal(sig[i],SIG_IGN) == SIG_IGN  ?  SIG_IGN  :  catchsig;
X  	restoreints();
+ #endif /* MSDOS */
X    }
X
X    void ignoreints()
X    {
+ #ifdef MSDOS
+ 	VOID signal(SIGINT, SIG_IGN);
+ #else
X  	register i;
X  	for (i=SIGS; 0<=--i; )
X  		VOID signal(sig[i], SIG_IGN);
+ #endif /* MSDOS */
X    }
X
X  void restoreints()
X  {
+ #ifdef MSDOS
+ 	VOID signal(SIGINT, catchsig);
+ #else
X  	register i;
X  	for (i=SIGS; 0<=--i; )
X  		if (catcher[i] != SIG_IGN)
X  			VOID signal(sig[i], catcher[i]);
+ #endif /* MSDOS */
X  }
X
X  fastcopy(inf,outf)
***************
*** 455,460 ****
--- 504,525 ----
X  static int run_back(inoutargs)
X  	char **inoutargs;
X  {
+ #ifdef MSDOS
+ 	int result, si, so;
+
+ 	if (fflush(stdout) == EOF  ||  fflush(stderr) == EOF)
+ 		return -1;
+         si = dup(0);
+         so = dup(1);
+ 	tryopen(fileno(stdin), inoutargs[0], 0);
+ 	tryopen(fileno(stdout), inoutargs[1], -1);
+ 	result = spawnvp( 0, inoutargs[2], &inoutargs[2] );
+ 	dup2(si, 0);
+ 	dup2(so, 1);
+         close(si);
+         close(so);
+ 	return result;
+ #else
X  	int pid;
X  	register char **p;
X  	if (fflush(stdout) == EOF  ||  fflush(stderr) == EOF)
***************
*** 473,478 ****
--- 538,544 ----
X  		_exit(2);
X  	}
X  	return pid;
+ #endif /* MSDOS */
X  }
X
X  #define CARGSMAX 20
***************
*** 498,508 ****
--- 564,593 ----
X  	}
X  	va_end(ap);
X  	pid = run_back(rgargs);
+ #ifndef MSDOS
X  	if (pid < 0)
+ #endif /* MSDOS */
X  		return pid;
+ #ifndef MSDOS
X  	for (;;)
X  		if ((w = wait(&wstatus)) < 0)
X  			return w;
X  		else if (w == pid)
X  			return wstatus;
+ #endif /* NOT MSDOS */
+ }
+
+ #ifdef MSDOS
+ int Rename( from, to )
+ char	*from;
+ char	*to;
+ {
+ 	if ( access( to, 0 ) == 0 ) {
+ 		if ( chmod( to, S_IWRITE | S_IREAD ) == -1 )
+ 			return (-1);
+ 		if ( unlink(to) != 0 )
+ 			return (-1);
+ 	}
+ 		return ( rename( from, to ) );
X  }
+ #endif /* MSDOS */
SHAR_EOF
chmod 0666 patches.os2 ||
echo 'restore of patches.os2 failed'
Wc_c="`wc -c 'patches.os2'`"
test 57157 -eq "$Wc_c" ||
	echo 'patches.os2: original size 57157, current size' "$Wc_c"
fi
# ============= ci.cs ==============
if test -f 'ci.cs' -a X"$1" != X"-c"; then
	echo 'x - skipping ci.cs (File already exists)'
else
echo 'x - extracting ci.cs (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ci.cs' &&
(-W0 -DUSG -DSTRICT_LOCKING=1 -DGNUDIFF -DDIFF=\"diff.exe\"
ci.c rcslex.c rcssyn.c rcsgen.c rcsedit.c
rcskeys.c rcsrev.c rcsutil.c rcsfnms.c partime.c
maketime.c rcskeep.c rcsfcmp.c
)
setargv.obj
ci.exe
ci.def
-AS -LB -S0x2000
SHAR_EOF
chmod 0666 ci.cs ||
echo 'restore of ci.cs failed'
Wc_c="`wc -c 'ci.cs'`"
test 227 -eq "$Wc_c" ||
	echo 'ci.cs: original size 227, current size' "$Wc_c"
fi
# ============= co.cs ==============
if test -f 'co.cs' -a X"$1" != X"-c"; then
	echo 'x - skipping co.cs (File already exists)'
else
echo 'x - extracting co.cs (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'co.cs' &&
(-W0 -DUSG -DSTRICT_LOCKING=1 -DCO=\"co.exe\" -DMERGE=\"merge.cmd\"
co.c rcslex.c rcssyn.c rcsgen.c rcsedit.c rcskeys.c
rcsrev.c rcsutil.c rcsfnms.c partime.c maketime.c
)
setargv.obj
co.exe
co.def
-AS -LB -S0x2000
SHAR_EOF
chmod 0666 co.cs ||
echo 'restore of co.cs failed'
Wc_c="`wc -c 'co.cs'`"
test 215 -eq "$Wc_c" ||
	echo 'co.cs: original size 215, current size' "$Wc_c"
fi
# ============= ident.cs ==============
if test -f 'ident.cs' -a X"$1" != X"-c"; then
	echo 'x - skipping ident.cs (File already exists)'
else
echo 'x - extracting ident.cs (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ident.cs' &&
(-W0 -DUSG -DSTRICT_LOCKING=1
ident.c rcskeys.c
)
setargv.obj
ident.exe
ident.def
-AS -LB -S0x2000
SHAR_EOF
chmod 0666 ident.cs ||
echo 'restore of ident.cs failed'
Wc_c="`wc -c 'ident.cs'`"
test 99 -eq "$Wc_c" ||
	echo 'ident.cs: original size 99, current size' "$Wc_c"
fi
# ============= rcs.cs ==============
if test -f 'rcs.cs' -a X"$1" != X"-c"; then
	echo 'x - skipping rcs.cs (File already exists)'
else
echo 'x - extracting rcs.cs (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rcs.cs' &&
(-W0 -DUSG -DSTRICT_LOCKING=1 -DGNUDIFF -DDIFF=\"diff.exe\"
rcs.c rcslex.c rcssyn.c rcsrev.c rcsutil.c
rcsgen.c rcsedit.c rcskeys.c rcsfnms.c
)
setargv.obj
rcs.exe
rcs.def
-AS -LB -S0x2000
SHAR_EOF
chmod 0666 rcs.cs ||
echo 'restore of rcs.cs failed'
Wc_c="`wc -c 'rcs.cs'`"
test 189 -eq "$Wc_c" ||
	echo 'rcs.cs: original size 189, current size' "$Wc_c"
fi
# ============= rcsclean.cs ==============
if test -f 'rcsclean.cs' -a X"$1" != X"-c"; then
	echo 'x - skipping rcsclean.cs (File already exists)'
else
echo 'x - extracting rcsclean.cs (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rcsclean.cs' &&
(-W0 -DUSG -DSTRICT_LOCKING=1 -DCO=\"co.exe\" -DRCS_CMD=\"rcs.exe\"
rcsclean.c rcsfnms.c rcssyn.c rcslex.c
rcsrev.c rcsutil.c
)
setargv.obj
rcsclean.exe
rcsclean.def
-AS -LB -S0x2000
SHAR_EOF
chmod 0666 rcsclean.cs ||
echo 'restore of rcsclean.cs failed'
Wc_c="`wc -c 'rcsclean.cs'`"
test 183 -eq "$Wc_c" ||
	echo 'rcsclean.cs: original size 183, current size' "$Wc_c"
fi
# ============= rcsdiff.cs ==============
if test -f 'rcsdiff.cs' -a X"$1" != X"-c"; then
	echo 'x - skipping rcsdiff.cs (File already exists)'
else
echo 'x - extracting rcsdiff.cs (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rcsdiff.cs' &&
(-W0 -DUSG -DSTRICT_LOCKING=1 -DCO=\"co.exe\" -DDIFF=\"diff.exe\"
rcsdiff.c rcsutil.c rcsfnms.c rcsrev.c rcssyn.c rcslex.c
)
setargv.obj
rcsdiff.exe
rcsdiff.def
-AS -LB -S0x2000
SHAR_EOF
chmod 0666 rcsdiff.cs ||
echo 'restore of rcsdiff.cs failed'
Wc_c="`wc -c 'rcsdiff.cs'`"
test 178 -eq "$Wc_c" ||
	echo 'rcsdiff.cs: original size 178, current size' "$Wc_c"
fi
# ============= rcsmerge.cs ==============
if test -f 'rcsmerge.cs' -a X"$1" != X"-c"; then
	echo 'x - skipping rcsmerge.cs (File already exists)'
else
echo 'x - extracting rcsmerge.cs (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rcsmerge.cs' &&
(-W0 -DUSG -DSTRICT_LOCKING=1 -DCO=\"co.exe\" -DMERGE=\"merge.cmd\"
rcsmerge.c rcsutil.c rcsfnms.c rcsrev.c rcssyn.c rcslex.c
)
setargv.obj
rcsmerge.exe
rcsmerge.def
-AS -LB -S0x2000
SHAR_EOF
chmod 0666 rcsmerge.cs ||
echo 'restore of rcsmerge.cs failed'
Wc_c="`wc -c 'rcsmerge.cs'`"
test 183 -eq "$Wc_c" ||
	echo 'rcsmerge.cs: original size 183, current size' "$Wc_c"
fi
# ============= rlog.cs ==============
if test -f 'rlog.cs' -a X"$1" != X"-c"; then
	echo 'x - skipping rlog.cs (File already exists)'
else
echo 'x - extracting rlog.cs (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rlog.cs' &&
(-W0 -DUSG -DSTRICT_LOCKING=1
rlog.c rcslex.c rcssyn.c rcsrev.c rcsutil.c partime.c maketime.c rcsfnms.c
)
setargv.obj
rlog.exe
rlog.def
-AC -LB -S0x2000
SHAR_EOF
chmod 0666 rlog.cs ||
echo 'restore of rlog.cs failed'
Wc_c="`wc -c 'rlog.cs'`"
test 154 -eq "$Wc_c" ||
	echo 'rlog.cs: original size 154, current size' "$Wc_c"
fi
# ============= ci.def ==============
if test -f 'ci.def' -a X"$1" != X"-c"; then
	echo 'x - skipping ci.def (File already exists)'
else
echo 'x - extracting ci.def (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ci.def' &&
NAME CI WINDOWCOMPAT NEWFILES
DESCRIPTION 'RCS 4.3 - for MS-DOS and OS/2'
SHAR_EOF
chmod 0666 ci.def ||
echo 'restore of ci.def failed'
Wc_c="`wc -c 'ci.def'`"
test 74 -eq "$Wc_c" ||
	echo 'ci.def: original size 74, current size' "$Wc_c"
fi
# ============= co.def ==============
if test -f 'co.def' -a X"$1" != X"-c"; then
	echo 'x - skipping co.def (File already exists)'
else
echo 'x - extracting co.def (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'co.def' &&
NAME CO WINDOWCOMPAT NEWFILES
DESCRIPTION 'RCS 4.3 - for MS-DOS and OS/2'
SHAR_EOF
chmod 0666 co.def ||
echo 'restore of co.def failed'
Wc_c="`wc -c 'co.def'`"
test 74 -eq "$Wc_c" ||
	echo 'co.def: original size 74, current size' "$Wc_c"
fi
# ============= ident.def ==============
if test -f 'ident.def' -a X"$1" != X"-c"; then
	echo 'x - skipping ident.def (File already exists)'
else
echo 'x - extracting ident.def (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'ident.def' &&
NAME IDENT WINDOWCOMPAT NEWFILES
DESCRIPTION 'RCS 4.3 - for MS-DOS and OS/2'
SHAR_EOF
chmod 0666 ident.def ||
echo 'restore of ident.def failed'
Wc_c="`wc -c 'ident.def'`"
test 77 -eq "$Wc_c" ||
	echo 'ident.def: original size 77, current size' "$Wc_c"
fi
# ============= rcs.def ==============
if test -f 'rcs.def' -a X"$1" != X"-c"; then
	echo 'x - skipping rcs.def (File already exists)'
else
echo 'x - extracting rcs.def (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rcs.def' &&
NAME RCS WINDOWCOMPAT NEWFILES
DESCRIPTION 'RCS 4.3 - for MS-DOS and OS/2'
SHAR_EOF
chmod 0666 rcs.def ||
echo 'restore of rcs.def failed'
Wc_c="`wc -c 'rcs.def'`"
test 75 -eq "$Wc_c" ||
	echo 'rcs.def: original size 75, current size' "$Wc_c"
fi
# ============= rcsclean.def ==============
if test -f 'rcsclean.def' -a X"$1" != X"-c"; then
	echo 'x - skipping rcsclean.def (File already exists)'
else
echo 'x - extracting rcsclean.def (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rcsclean.def' &&
NAME RCSCLEAN WINDOWCOMPAT NEWFILES
DESCRIPTION 'RCS 4.3 - for MS-DOS and OS/2'
SHAR_EOF
chmod 0666 rcsclean.def ||
echo 'restore of rcsclean.def failed'
Wc_c="`wc -c 'rcsclean.def'`"
test 80 -eq "$Wc_c" ||
	echo 'rcsclean.def: original size 80, current size' "$Wc_c"
fi
# ============= rcsdiff.def ==============
if test -f 'rcsdiff.def' -a X"$1" != X"-c"; then
	echo 'x - skipping rcsdiff.def (File already exists)'
else
echo 'x - extracting rcsdiff.def (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rcsdiff.def' &&
NAME RCSDIFF WINDOWCOMPAT NEWFILES
DESCRIPTION 'RCS 4.3 - for MS-DOS and OS/2'
SHAR_EOF
chmod 0666 rcsdiff.def ||
echo 'restore of rcsdiff.def failed'
Wc_c="`wc -c 'rcsdiff.def'`"
test 79 -eq "$Wc_c" ||
	echo 'rcsdiff.def: original size 79, current size' "$Wc_c"
fi
# ============= rcsmerge.def ==============
if test -f 'rcsmerge.def' -a X"$1" != X"-c"; then
	echo 'x - skipping rcsmerge.def (File already exists)'
else
echo 'x - extracting rcsmerge.def (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rcsmerge.def' &&
NAME RCSMERGE WINDOWCOMPAT NEWFILES
DESCRIPTION 'RCS 4.3 - for MS-DOS and OS/2'
SHAR_EOF
chmod 0666 rcsmerge.def ||
echo 'restore of rcsmerge.def failed'
Wc_c="`wc -c 'rcsmerge.def'`"
test 80 -eq "$Wc_c" ||
	echo 'rcsmerge.def: original size 80, current size' "$Wc_c"
fi
# ============= rlog.def ==============
if test -f 'rlog.def' -a X"$1" != X"-c"; then
	echo 'x - skipping rlog.def (File already exists)'
else
echo 'x - extracting rlog.def (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'rlog.def' &&
NAME RLOG WINDOWCOMPAT NEWFILES
DESCRIPTION 'RCS 4.3 - for MS-DOS and OS/2'
SHAR_EOF
chmod 0666 rlog.def ||
echo 'restore of rlog.def failed'
Wc_c="`wc -c 'rlog.def'`"
test 76 -eq "$Wc_c" ||
	echo 'rlog.def: original size 76, current size' "$Wc_c"
fi
# ============= makefile.msc ==============
if test -f 'makefile.msc' -a X"$1" != X"-c"; then
	echo 'x - skipping makefile.msc (File already exists)'
else
echo 'x - extracting makefile.msc (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'makefile.msc' &&
# Makefile for RCS
# $Id: makefile.msc,v 5.5 90/07/16 22:41:45 lfk Exp $
#
# $Log:	makefile.msc,v $
# Revision 5.5  90/07/16  22:41:45  lfk
# a number of small changes for MODEL compilation of rlog.exe
#
# Revision 5.4  90/07/16  21:38:10  lfk
# checkin for release compilation
#
# Revision 5.3  90/07/15  22:54:12  lfk
# Almost the end of major revison for MS-DOS version of RCS
#
# Revision 5.2  90/07/15  11:31:47  ROOT_DOS
# DOS version of RCS 4.0 checked in for MODS
# by lfk@athena.mit.edu
# Also update to MSC 6.0
#
# Revision 1.2  90/02/07  04:17:09  koya
# Added "SETARGV" macro and delete from "install"
# all.
#
X
X.SUFFIXES .c .o .exe
X
MODEL = 	#default model = small, rlog needs compact
LOCKING = 1
CC = cl
LD = link
X
# $Author: lfk $ $Date: 90/07/16 22:41:45 $
# rlog.exe needs to be compiled with the compact memory model
# -AC while all the rest is small model (default with MSC).
# see MODEL =
CFLAGS = $(MODEL) -Ox -DMKS -DUSG -DSTRICT_LOCKING=$(LOCKING)
# CFLAGS = -Od -Zi -DMKS -DUSG -DSTRICT_LOCKING=$(LOCKING)
LDFLAGS = /noi /noe /exe /packc /batch
# LDFLAGS = /co /li /map
RCSDIR = /usr/bin
DEFS = -DCO=\"co.exe\" -DDIFF=\"diff.exe\"
SETARGV =
X
X.c.o :
X	$(CC) $(DEFS) $(CFLAGS) -Fo$*.o -c $*.c
X
all: ci.exe co.exe rlog.exe rcs.exe rcsdiff.exe ident.exe rcsmerge.exe
X
CIFILES = ci.o rcslex.o rcssyn.o rcsgen.o rcsedit.o \
X	  rcskeys.o rcsrev.o rcsutil.o rcsfnms.o partime.o \
X	  maketime.o rcskeep.o rcsfcmp.o
X
ci.exe:   $(CIFILES)
X	$(LD) $(CIFILES) $(SETARGV), ci, ci, $(LDFLAGS);
X
COFILES = co.o rcslex.o rcssyn.o rcsgen.o rcsedit.o rcskeys.o \
X	  rcsrev.o rcsutil.o rcsfnms.o partime.o maketime.o
X
co.exe:   $(COFILES)
X	$(LD) $(COFILES) $(SETARGV), co, co, $(LDFLAGS);
X
RLOG = rlog.o rcslex.o rcssyn.o rcsrev.o rcsutil.o partime.o \
X	maketime.o rcsfnms.o
X
rlog.o : rlog.c
X	$(CC)  $(CFLAGS) -DCO=\"co.exe\" -DMERGE=\"$(RCSDIR)/merge.ksh\" -Forlog.o -c rlog.c
X
rlog.exe: $(RLOG)
X	$(LD) $(RLOG) $(SETARGV), rlog, rlog, $(LDFLAGS);
X
RCS = rcs.o rcslex.o rcssyn.o rcsrev.o rcsutil.o \
X	rcsgen.o rcsedit.o rcskeys.o rcsfnms.o
X
rcs.exe:	$(RCS)
X	$(LD) $(RCS) $(SETARGV), rcs, rcs, $(LDFLAGS);
X
RCSDIFF = rcsdiff.o rcsutil.o rcsfnms.o rcsrev.o rcssyn.o rcslex.o
X
rcsdiff.exe: $(RCSDIFF)
X	$(LD) $(RCSDIFF) $(SETARGV), rcsdiff, rcsdiff, $(LDFLAGS);
X
IDENTFILES = ident.o rcskeys.o
X
ident.exe: $(IDENTFILES)
X	$(LD) $(IDENTFILES) $(SETARGV), ident, ident, $(LDFLAGS);
X
RCSMERGEFILE = rcsmerge.o rcsutil.o rcsfnms.o rcsrev.o rcssyn.o rcslex.o
X
merge.exe: $(RCSMERGEFILE)
X	$(LD) $(RCSMERGEFILE) $(SETARGV), rcsmerge, rcsmerge, $(LDFLAGS);
X
snoop.exe: snoop.o
X	$(LD) snoop.o $(SETARGV), snoop, snoop, $(LDFLAGS);
X
RCSCLEANFILE = rcsclean.o rcsfnms.o
X
rcsclean.exe: $(RCSCLEANFILE)
X	$(LD) $(RCSCLEANFILE) $(SETARGV), rcsclean, rcsclean, $(LDFLAGS);
X
X
RCSMERGE = rcsmerge.o rcsutil.o rcsfnms.o rcsrev.o rcssyn.o rcslex.o
X
rcsmerge.o : rcsmerge.c
X	$(CC) $(CFLAGS) -DCO=\"$(RCSDIR)/co.exe\" -DMERGE=\"$(RCSDIR)/merge.ksh\" -Forcsmerge.o -c rcsmerge.c
X
rcsmerge.exe:	$(RCSMERGE)
X	$(LD) $(SETARGV) $(RCSMERGE), rcsmerge, rcsmerge, $(LDFLAGS) ;
X
INSTALL = copy
X
install:
X	$(INSTALL) ci.exe $(RCSDIR)
X	$(INSTALL) co.exe $(RCSDIR)
X	$(INSTALL) rcs.exe $(RCSDIR)
X	$(INSTALL) rlog.exe $(RCSDIR)
X	$(INSTALL) rcsdiff.exe $(RCSDIR)
X	$(INSTALL) ident.exe $(RCSDIR)
X
RM = rm
TAR = LHarc a
TARFILE = RCSWORK.LZH
X
clean: tar
X	$(RM) *.o *.exe *.map
X
tar:
X	$(TAR) $(TARFILE) *.c *.h *.o *.exe makefile copying
X
lint:
X	cc -Zs -W4 $(DEFS) $(CFLAGS) *.c
SHAR_EOF
chmod 0666 makefile.msc ||
echo 'restore of makefile.msc failed'
Wc_c="`wc -c 'makefile.msc'`"
test 3438 -eq "$Wc_c" ||
	echo 'makefile.msc: original size 3438, current size' "$Wc_c"
fi
# ============= merge.cmd ==============
if test -f 'merge.cmd' -a X"$1" != X"-c"; then
	echo 'x - skipping merge.cmd (File already exists)'
else
echo 'x - extracting merge.cmd (Text)'
sed 's/^X//' << 'SHAR_EOF' > 'merge.cmd' &&
extproc sh
X
#	$Id: merge.sh,v 1.3 88/11/08 12:06:42 narten Exp $
X
DIFF=diff
DIFF3=diff3
p=w
case $1 in
-p)
X	p='1,$p'
X	shift
esac
X
case $# in
0|1|2)
X        echo >&2 ""
X	echo >&2 "Usage: merge [-p] file1 file2 file3"
X	exit 1
esac
X
case $p in
w)
X	if test ! -w $1
X	then
X		echo >&2 "$1 not writeable"
X		exit 1
X	fi
esac
X
trap 's=$?; rm -f d3a$$ d3b$$; exit $s' 0
trap exit 1 2 3 13 15
umask 077
X
$DIFF $1 $3 >d3a$$
case $? in
0|1) ;;
*) exit
esac
X
$DIFF $2 $3 >d3b$$
case $? in
0|1) ;;
*) exit
esac
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
} | ed - $1
SHAR_EOF
chmod 0777 merge.cmd ||
echo 'restore of merge.cmd failed'
Wc_c="`wc -c 'merge.cmd'`"
test 691 -eq "$Wc_c" ||
	echo 'merge.cmd: original size 691, current size' "$Wc_c"
fi
exit 0
--
/* Kai Uwe Rommel
 * Munich
 * rommel@lan.informatik.tu-muenchen.dbp.de
 */