RCS file: RCS/ci.c,v
retrieving revision 3.9
retrieving revision 3.10
diff -c -r3.9 -r3.10
*** /tmp/,RCSt1002072	Sat Feb  1 11:36:39 1986
--- /tmp/,RCSt2002072	Sat Feb  1 11:36:45 1986
***************
*** 2,8
   *                     RCS checkin operation
   */
   static char rcsid[]=
!  "$Header: ci.c,v 3.9 83/02/15 15:25:44 wft Exp $ Purdue CS";
  /*******************************************************************
   *                       check revisions into RCS files
   *******************************************************************

--- 2,8 -----
   *                     RCS checkin operation
   */
   static char rcsid[]=
!  "$Header: ci.c,v 3.10 86/01/21 20:15:26 mann Exp $ Purdue CS";
  /*******************************************************************
   *                       check revisions into RCS files
   *******************************************************************
***************
*** 21,26
  
  
  /* $Log:	ci.c,v $
   * Revision 3.9  83/02/15  15:25:44  wft
   * *** empty log message ***
   * 

--- 21,29 -----
  
  
  /* $Log:	ci.c,v $
+  * Revision 3.10  86/01/21  20:15:26  mann
+  * Ported to V
+  * 
   * Revision 3.9  83/02/15  15:25:44  wft
   * *** empty log message ***
   * 
***************
*** 70,75
  #include "rcsbase.h"
  static char rcsbaseid[] = RCSBASE;
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <pwd.h>
  

--- 73,79 -----
  #include "rcsbase.h"
  static char rcsbaseid[] = RCSBASE;
  #include <sys/types.h>
+ #ifndef Vsystem
  #include <sys/stat.h>
  #endif Vsystem
  #include <pwd.h>
***************
*** 71,76
  static char rcsbaseid[] = RCSBASE;
  #include <sys/types.h>
  #include <sys/stat.h>
  #include <pwd.h>
  
  extern int    rename();                /*rename files                       */

--- 75,81 -----
  #include <sys/types.h>
  #ifndef Vsystem
  #include <sys/stat.h>
+ #endif Vsystem
  #include <pwd.h>
  
  extern int    rename();                /*rename files                       */
***************
*** 129,134
          char * cmdusage;         /* holds command format                    */
          char command[NCPPN+50];  /* holds diff commands                     */
          char curdate[datelength];/* date for new delta                      */
          struct stat filestatus;  /* used for getting the mode               */
          int  msglen;             /* length of message given by -m           */
          int exit_stats;          /* return code for system() calls          */

--- 134,142 -----
          char * cmdusage;         /* holds command format                    */
          char command[NCPPN+50];  /* holds diff commands                     */
          char curdate[datelength];/* date for new delta                      */
+ #ifdef Vsystem
+ 	ArbitraryDescriptor filestatus, tempstatus;
+ #else
          struct stat filestatus;  /* used for getting the mode               */
  #endif Vsystem
          int  msglen;             /* length of message given by -m           */
***************
*** 130,135
          char command[NCPPN+50];  /* holds diff commands                     */
          char curdate[datelength];/* date for new delta                      */
          struct stat filestatus;  /* used for getting the mode               */
          int  msglen;             /* length of message given by -m           */
          int exit_stats;          /* return code for system() calls          */
  

--- 138,144 -----
  	ArbitraryDescriptor filestatus, tempstatus;
  #else
          struct stat filestatus;  /* used for getting the mode               */
+ #endif Vsystem
          int  msglen;             /* length of message given by -m           */
          int exit_stats;          /* return code for system() calls          */
  
***************
*** 139,145
          rev = state = msg = symbol = textfile = caller = nil;
          initflag= rcsinitflag= symrebindflag= textflag= quietflag= false;
          forceciflag= lockflag= keepworkingfile= keepflag= false;
!         caller=getpwuid(getuid())->pw_name;
  
          while (--argc,++argv, argc>=1 && ((*argv)[0] == '-')) {
                  switch ((*argv)[1]) {

--- 148,154 -----
          rev = state = msg = symbol = textfile = caller = nil;
          initflag= rcsinitflag= symrebindflag= textflag= quietflag= false;
          forceciflag= lockflag= keepworkingfile= keepflag= false;
! 	caller = UserName(0);
  
          while (--argc,++argv, argc>=1 && ((*argv)[0] == '-')) {
                  switch ((*argv)[1]) {
***************
*** 233,239
  
          if (argc<1) faterror("No input file\n%s",cmdusage);
  
!         if (!isatty(fileno(stdin)) && msg==nil && textflag && textfile==nil) {
                  /* would need both log message and descriptive text from a file */
                  faterror("Can't take both log and description from redirected stdin; use -ttextfile");
          }

--- 242,248 -----
  
          if (argc<1) faterror("No input file\n%s",cmdusage);
  
!         if (!Interactive(stdin) && msg==nil && textflag && textfile==nil) {
                  /* would need both log message and descriptive text from a file */
                  faterror("Can't take both log and description from redirected stdin; use -ttextfile");
          }
***************
*** 273,278
          }
  
          if (initflag || rcsinitflag) /* get mode for RCSfile from workfile*/
              stat(workfilename, &filestatus);
          else /* otherwise keep the one from the RCS file.*/
              fstat(fileno(finptr), &filestatus);

--- 282,292 -----
          }
  
          if (initflag || rcsinitflag) /* get mode for RCSfile from workfile*/
+ #ifdef Vsystem
+ 	    NReadDescriptor(workfilename, &filestatus);
+         else /* otherwise keep the one from the RCS file.*/
+             ReadDescriptor(FileServer(finptr), FileId(finptr), &filestatus);
+ #else
              stat(workfilename, &filestatus);
          else /* otherwise keep the one from the RCS file.*/
              fstat(fileno(finptr), &filestatus);
***************
*** 276,281
              stat(workfilename, &filestatus);
          else /* otherwise keep the one from the RCS file.*/
              fstat(fileno(finptr), &filestatus);
  
          if (!trydiraccess(RCSfilename)) continue; /* give up */
          if (!initflag && !checkaccesslist(caller))   continue; /* give up */

--- 290,296 -----
              stat(workfilename, &filestatus);
          else /* otherwise keep the one from the RCS file.*/
              fstat(fileno(finptr), &filestatus);
+ #endif
  
          if (!trydiraccess(RCSfilename)) continue; /* give up */
          if (!initflag && !checkaccesslist(caller))   continue; /* give up */
***************
*** 420,426
                  if(!putdtext(newdelnum,newdelta.log,workfilename,frewrite)) continue;
                  ffclose(frewrite); frewrite=NULL;
          } else {
!                 diffilename=mktempfile("/tmp/",DIFFILE);
                  if (&newdelta==Head) {
                          /* prepend new one */
                          rewriteflag=false;

--- 435,441 -----
                  if(!putdtext(newdelnum,newdelta.log,workfilename,frewrite)) continue;
                  ffclose(frewrite); frewrite=NULL;
          } else {
!                 diffilename=mktempfile(TMPDIR, DIFFILE);
                  if (&newdelta==Head) {
                          /* prepend new one */
                          rewriteflag=false;
***************
*** 425,431
                          /* prepend new one */
                          rewriteflag=false;
                          if (!(expfilename=
!                               buildrevision(gendeltas,targetdelta,"/tmp/",false))) continue;
                          if (!mustcheckin(expfilename,targetdelta)) continue;
                                  /* don't check in files that aren't different, unless forced*/
                          newdelta.log=getlogmsg();

--- 440,446 -----
                          /* prepend new one */
                          rewriteflag=false;
                          if (!(expfilename=
!                               buildrevision(gendeltas,targetdelta,TMPDIR,false))) continue;
                          if (!mustcheckin(expfilename,targetdelta)) continue;
                                  /* don't check in files that aren't different, unless forced*/
                          newdelta.log=getlogmsg();
***************
*** 432,438
                          sprintf(command,"%s -n %s %s > %s\n", DIFF,
                                  workfilename,expfilename,diffilename);
                          exit_stats = system (command);
!                         if (exit_stats != 0 && exit_stats != (1 << BYTESIZ))
                              faterror ("diff failed");
                          /* diff returns 2 in the upper byte on failure */
                          if(!putdtext(newdelnum,newdelta.log,workfilename,frewrite)) continue;

--- 447,453 -----
                          sprintf(command,"%s -n %s %s > %s\n", DIFF,
                                  workfilename,expfilename,diffilename);
                          exit_stats = system (command);
!                         if (exit_stats != 0 && exit_stats != DIFFERENT)
                              faterror ("diff failed");
                          /* diff returns 2 in the upper byte on failure */
                          if(!putdtext(newdelnum,newdelta.log,workfilename,frewrite)) continue;
***************
*** 441,447
                          /* insert new delta text */
                          rewriteflag=true;
                          if (!(expfilename=
!                               buildrevision(gendeltas,targetdelta,"/tmp/",false))) continue;
                          if (!mustcheckin(expfilename,targetdelta)) continue;
                                  /* don't check in files that aren't different, unless forced*/
                          newdelta.log=getlogmsg();

--- 456,462 -----
                          /* insert new delta text */
                          rewriteflag=true;
                          if (!(expfilename=
!                               buildrevision(gendeltas,targetdelta,TMPDIR,false))) continue;
                          if (!mustcheckin(expfilename,targetdelta)) continue;
                                  /* don't check in files that aren't different, unless forced*/
                          newdelta.log=getlogmsg();
***************
*** 448,454
                          sprintf(command,"%s -n %s %s > %s\n", DIFF,
                                  expfilename,workfilename,diffilename);
                          exit_stats = system (command);
!                         if (exit_stats != 0 && exit_stats != (1 << BYTESIZ))
                              faterror ("diff failed");
                          if(!putdtext(newdelnum,newdelta.log,diffilename,frewrite)) continue;
                  }

--- 463,469 -----
                          sprintf(command,"%s -n %s %s > %s\n", DIFF,
                                  expfilename,workfilename,diffilename);
                          exit_stats = system (command);
!                         if (exit_stats != 0 && exit_stats != DIFFERENT)
                              faterror ("diff failed");
                          if(!putdtext(newdelnum,newdelta.log,diffilename,frewrite)) continue;
                  }
***************
*** 467,472
                  break;
          }
          newRCSfilename[0]='\0'; /* avoid re-unlinking by cleanup()*/
          if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0)
                  warn("Can't set mode of %s",RCSfilename);
  

--- 482,493 -----
                  break;
          }
          newRCSfilename[0]='\0'; /* avoid re-unlinking by cleanup()*/
+ #ifdef Vsystem
+ 	if (NReadDescriptor(RCSfilename, &tempstatus) != OK ||
+ 	    CopyPerms(&tempstatus, &filestatus) != OK ||
+ 	    NoWrite(&tempstatus) != OK ||
+ 	    NWriteDescriptor(RCSfilename, &tempstatus) != OK)
+ #else
          if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0)
  #endif
                  warn("Can't set mode of %s",RCSfilename);
***************
*** 468,473
          }
          newRCSfilename[0]='\0'; /* avoid re-unlinking by cleanup()*/
          if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0)
                  warn("Can't set mode of %s",RCSfilename);
  
  	catchints();

--- 489,495 -----
  	    NWriteDescriptor(RCSfilename, &tempstatus) != OK)
  #else
          if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0)
+ #endif
                  warn("Can't set mode of %s",RCSfilename);
  
  	catchints();
***************
*** 484,490
                  if (!newworkfilename) continue; /* expand failed */
  		ignoreints();
                  unlink(workfilename);
!                 if (link(newworkfilename,workfilename)<0) {
                      error("Can't expand keywords in %s",workfilename);
  		    catchints();
                      continue;

--- 506,512 -----
                  if (!newworkfilename) continue; /* expand failed */
  		ignoreints();
                  unlink(workfilename);
!                 if (rename(newworkfilename,workfilename)<0) {
                      error("Can't expand keywords in %s",workfilename);
  		    catchints();
                      continue;
***************
*** 489,494
  		    catchints();
                      continue;
                  }
                  if (chmod(workfilename, WORKMODE(filestatus.st_mode))<0)
                      warn("Can't adjust mode of %s",workfilename);
  		catchints();

--- 511,523 -----
  		    catchints();
                      continue;
                  }
+ 		newworkfilename = NULL;	/* no need to delete in cleanup() */
+ #ifdef Vsystem
+ 		if (NReadDescriptor(workfilename, &tempstatus) != OK ||
+ 		    CopyPerms(&tempstatus, &filestatus) != OK ||
+ 		    WorkPerms(&tempstatus, lockflag || !StrictLocks) != OK ||
+ 		    NWriteDescriptor(workfilename, &tempstatus) != OK)
+ #else
                  if (chmod(workfilename, WORKMODE(filestatus.st_mode))<0)
  #endif
                      warn("Can't adjust mode of %s",workfilename);
***************
*** 490,495
                      continue;
                  }
                  if (chmod(workfilename, WORKMODE(filestatus.st_mode))<0)
                      warn("Can't adjust mode of %s",workfilename);
  		catchints();
          }

--- 519,525 -----
  		    NWriteDescriptor(workfilename, &tempstatus) != OK)
  #else
                  if (chmod(workfilename, WORKMODE(filestatus.st_mode))<0)
+ #endif
                      warn("Can't adjust mode of %s",workfilename);
  
  		catchints();
***************
*** 491,496
                  }
                  if (chmod(workfilename, WORKMODE(filestatus.st_mode))<0)
                      warn("Can't adjust mode of %s",workfilename);
  		catchints();
          }
          diagnose("done");

--- 521,527 -----
                  if (chmod(workfilename, WORKMODE(filestatus.st_mode))<0)
  #endif
                      warn("Can't adjust mode of %s",workfilename);
+ 
  		catchints();
          }
          diagnose("done");
***************
*** 594,599
  {
          register struct lock * next, * trail;
          char * num;
          struct stat statbuf;
          struct lock dummy;
          int owner, whomatch, nummatch;

--- 625,633 -----
  {
          register struct lock * next, * trail;
          char * num;
+ #ifdef Vsystem
+ 	ArbitraryDescriptor statbuf;
+ #else
          struct stat statbuf;
  #endif
          struct lock dummy;
***************
*** 595,600
          register struct lock * next, * trail;
          char * num;
          struct stat statbuf;
          struct lock dummy;
          int owner, whomatch, nummatch;
  

--- 629,635 -----
  	ArbitraryDescriptor statbuf;
  #else
          struct stat statbuf;
+ #endif
          struct lock dummy;
          int owner, whomatch, nummatch;
  
***************
*** 624,629
                  next->delta->lockedby=nil; /* reset locked-by */
                  return next->delta;
          } else {
                  fstat(fileno(finptr), &statbuf);
                  owner= (StrictLocks==false) && (getuid() == statbuf.st_uid);
                  if (!owner) {

--- 659,672 -----
                  next->delta->lockedby=nil; /* reset locked-by */
                  return next->delta;
          } else {
+ #ifdef Vsystem	
+ 		/* %%% This code implements "owner can ci w/o lock if
+ 		 * %%% locking is nonstrict."  We don't permit this
+ 		 * %%% under V for now since it requires translating between
+ 		 * %%% Unix and V user numbers if the file is on Unix.
+ 		 */
+ 		owner = 0;		
+ #else
                  fstat(fileno(finptr), &statbuf);
                  owner= (StrictLocks==false) && (getuid() == statbuf.st_uid);
  #endif
***************
*** 626,631
          } else {
                  fstat(fileno(finptr), &statbuf);
                  owner= (StrictLocks==false) && (getuid() == statbuf.st_uid);
                  if (!owner) {
                          if (num==nil) error("no lock set by %s",who);
                          else          error("no lock set by %s for revision %s",who,num);

--- 669,675 -----
  #else
                  fstat(fileno(finptr), &statbuf);
                  owner= (StrictLocks==false) && (getuid() == statbuf.st_uid);
+ #endif
                  if (!owner) {
                          if (num==nil) error("no lock set by %s",who);
                          else          error("no lock set by %s for revision %s",who,num);
***************
*** 712,718
          /* files are the same */
          diagnose("File %s is unchanged with respect to revision %s",
                  workfilename,delta->num);
!         if (quietflag || !isatty(fileno(stdin))) {
                  /* Files are the same, but can't ask, so don't checkin*/
                  result=false;
          } else {

--- 756,762 -----
          /* files are the same */
          diagnose("File %s is unchanged with respect to revision %s",
                  workfilename,delta->num);
!         if (quietflag || !Interactive(stdin)) {
                  /* Files are the same, but can't ask, so don't checkin*/
                  result=false;
          } else {
***************
*** 768,774
                  return initiallog;
          if (logyet) {
                  /*previous log available*/
!                 if (!isatty(fileno(stdin))) return logmsg; /* reuse if stdin is not a terminal*/
                  /* otherwise ask */
                  fputs("reuse log message of previous file? [yn](y): ",stdout);
                  cin=getchar();

--- 812,818 -----
                  return initiallog;
          if (logyet) {
                  /*previous log available*/
!                 if (!Interactive(stdin)) return logmsg; /* reuse if stdin is not a terminal*/
                  /* otherwise ask */
                  fputs("reuse log message of previous file? [yn](y): ",stdout);
                  cin=getchar();
***************
*** 781,787
          }
  
          /* now read string from terminal */
!         if (isatty(fileno(stdin)))
                 fputs("enter log message:\n(terminate with ^D or single '.')\n>> ",stdout);
          tp=logmsg; old1='\n'; old2=' ';
          for (;;) {

--- 825,834 -----
          }
  
          /* now read string from terminal */
!         if (Interactive(stdin))
! #ifdef Vsystem
!                fputs("enter log message:\n(terminate with ^Z or single '.')\n>> ",stdout);
! #else
                 fputs("enter log message:\n(terminate with ^D or single '.')\n>> ",stdout);
  #endif Vsystem
          tp=logmsg; old1='\n'; old2=' ';
***************
*** 783,788
          /* now read string from terminal */
          if (isatty(fileno(stdin)))
                 fputs("enter log message:\n(terminate with ^D or single '.')\n>> ",stdout);
          tp=logmsg; old1='\n'; old2=' ';
          for (;;) {
                  cin=getchar();

--- 830,836 -----
                 fputs("enter log message:\n(terminate with ^Z or single '.')\n>> ",stdout);
  #else
                 fputs("enter log message:\n(terminate with ^D or single '.')\n>> ",stdout);
+ #endif Vsystem
          tp=logmsg; old1='\n'; old2=' ';
          for (;;) {
                  cin=getchar();
***************
*** 787,793
          for (;;) {
                  cin=getchar();
                  if (cin==EOF) {
!                         if(isatty(fileno(stdin))) putc('\n',stdout);
                          if (*(tp-1) != '\n') *tp++ = '\n'; /* append newline */
                          *tp = '\0'; /*terminate*/
                          break;

--- 835,841 -----
          for (;;) {
                  cin=getchar();
                  if (cin==EOF) {
!                         if(Interactive(stdin)) putc('\n',stdout);
                          if (*(tp-1) != '\n') *tp++ = '\n'; /* append newline */
                          *tp = '\0'; /*terminate*/
  			clearerr(stdin);
***************
*** 790,795
                          if(isatty(fileno(stdin))) putc('\n',stdout);
                          if (*(tp-1) != '\n') *tp++ = '\n'; /* append newline */
                          *tp = '\0'; /*terminate*/
                          break;
                  }
                  if (cin=='\n' && old1=='.' && old2=='\n') {

--- 838,844 -----
                          if(Interactive(stdin)) putc('\n',stdout);
                          if (*(tp-1) != '\n') *tp++ = '\n'; /* append newline */
                          *tp = '\0'; /*terminate*/
+ 			clearerr(stdin);
                          break;
                  }
                  if (cin=='\n' && old1=='.' && old2=='\n') {
***************
*** 797,803
                          break;
                  }
                  if (tp>=logmsg+logsize-2) { /* overflow */
!                         if (!isatty(fileno(stdin))) {
                                  warn("log message truncated to %d characters",logsize);
                                  logmsg[logsize-2]='\n';logmsg[logsize-1]='\0';
                                  return logmsg;

--- 846,852 -----
                          break;
                  }
                  if (tp>=logmsg+logsize-2) { /* overflow */
!                         if (!Interactive(stdin)) {
                                  warn("log message truncated to %d characters",logsize);
                                  logmsg[logsize-2]='\n';logmsg[logsize-1]='\0';
                                  return logmsg;
***************
*** 808,814
                          while (cin!='\n') cin=getchar(); /*skip line */
                          continue;
                  }
!                 if (cin=='\n' && isatty(fileno(stdin))) fputs(">> ",stdout);
                  *tp++ = cin; old2=old1; old1=cin; /* this is the actual work!*/
                  /*SDELIM will be changed to double SDELIM by putdtext*/
          } /* end for */

--- 857,863 -----
                          while (cin!='\n') cin=getchar(); /*skip line */
                          continue;
                  }
!                 if (cin=='\n' && Interactive(stdin)) fputs(">> ",stdout);
                  *tp++ = cin; old2=old1; old1=cin; /* this is the actual work!*/
                  /*SDELIM will be changed to double SDELIM by putdtext*/
          } /* end for */
RCS file: RCS/co.c,v
retrieving revision 3.7
retrieving revision 3.8
diff -c -r3.7 -r3.8
*** /tmp/,RCSt1002062	Sat Feb  1 11:36:09 1986
--- /tmp/,RCSt2002062	Sat Feb  1 11:36:11 1986
***************
*** 2,8
   *                     RCS checkout operation
   */
   static char rcsid[]=
!  "$Header: co.c,v 3.7 83/02/15 15:27:07 wft Exp $ Purdue CS";
  /*****************************************************************************
   *                       check out revisions from RCS files
   *****************************************************************************

--- 2,8 -----
   *                     RCS checkout operation
   */
   static char rcsid[]=
!  "$Header: co.c,v 3.8 86/01/21 20:15:57 mann Exp $ Purdue CS";
  /*****************************************************************************
   *                       check out revisions from RCS files
   *****************************************************************************
***************
*** 20,25
  
  
  /* $Log:	co.c,v $
   * Revision 3.7  83/02/15  15:27:07  wft
   * *** empty log message ***
   * 

--- 20,28 -----
  
  
  /* $Log:	co.c,v $
+  * Revision 3.8  86/01/21  20:15:57  mann
+  * Ported to V
+  * 
   * Revision 3.7  83/02/15  15:27:07  wft
   * *** empty log message ***
   * 
***************
*** 114,119
  {
          register c;
          char * cmdusage;
          struct stat RCSstat;
          struct tm parseddate, *ftm;
          char * rawdate;

--- 117,125 -----
  {
          register c;
          char * cmdusage;
+ #ifdef Vsystem
+ 	ArbitraryDescriptor RCSstat, tempstatus;
+ #else
          struct stat RCSstat;
  #endif Vsystem
          struct tm parseddate, *ftm;
***************
*** 115,120
          register c;
          char * cmdusage;
          struct stat RCSstat;
          struct tm parseddate, *ftm;
          char * rawdate;
          long unixtime;

--- 121,127 -----
  	ArbitraryDescriptor RCSstat, tempstatus;
  #else
          struct stat RCSstat;
+ #endif Vsystem
          struct tm parseddate, *ftm;
          char * rawdate;
          long unixtime;
***************
*** 124,130
          cmdusage = "command format:\nco -l[rev] -p[rev] -q[rev] -r[rev] -ddate -sstate -w[login] -jjoinlist file ...";
          date = rev = state = author = join = nil;
          lockflag = tostdout = quietflag = false;
!         caller=getpwuid(getuid())->pw_name;
  
          while (--argc,++argv, argc>=1 && ((*argv)[0] == '-')) {
                  switch ((*argv)[1]) {

--- 131,137 -----
          cmdusage = "command format:\nco -l[rev] -p[rev] -q[rev] -r[rev] -ddate -sstate -w[login] -jjoinlist file ...";
          date = rev = state = author = join = nil;
          lockflag = tostdout = quietflag = false;
!         caller=UserName(0);
  
          while (--argc,++argv, argc>=1 && ((*argv)[0] == '-')) {
                  switch ((*argv)[1]) {
***************
*** 205,210
           */
          diagnose("%s  -->  %s", RCSfilename,tostdout?"stdout":workfilename);
  
          fstat(fileno(finptr),&RCSstat); /* get file status, esp. the mode  */
  
          if (!tostdout && !trydiraccess(workfilename)) continue; /* give up */

--- 212,220 -----
           */
          diagnose("%s  -->  %s", RCSfilename,tostdout?"stdout":workfilename);
  
+ #ifdef Vsystem
+ 	ReadDescriptor(FileServer(finptr), FileId(finptr), &RCSstat);
+ #else
          fstat(fileno(finptr),&RCSstat); /* get file status, esp. the mode  */
  #endif
  
***************
*** 206,211
          diagnose("%s  -->  %s", RCSfilename,tostdout?"stdout":workfilename);
  
          fstat(fileno(finptr),&RCSstat); /* get file status, esp. the mode  */
  
          if (!tostdout && !trydiraccess(workfilename)) continue; /* give up */
          if (lockflag && !checkaccesslist(caller)) continue;     /* give up */

--- 216,222 -----
  	ReadDescriptor(FileServer(finptr), FileId(finptr), &RCSstat);
  #else
          fstat(fileno(finptr),&RCSstat); /* get file status, esp. the mode  */
+ #endif
  
          if (!tostdout && !trydiraccess(workfilename)) continue; /* give up */
          if (lockflag && !checkaccesslist(caller)) continue;     /* give up */
***************
*** 258,264
                  getdesc(false); /* don't echo*/
  
                  if (!(neworkfilename=buildrevision(gendeltas,targetdelta,
!                       tostdout?(join!=nil?"/tmp/":nil):workfilename,true)))
                                  continue;
  
                  if (lockflag&&nerror==0) {

--- 269,275 -----
                  getdesc(false); /* don't echo*/
  
                  if (!(neworkfilename=buildrevision(gendeltas,targetdelta,
!                       tostdout?(join!=nil?TMPDIR:nil):workfilename,true)))
                                  continue;
  
                  if (lockflag&&nerror==0) {
***************
*** 274,279
                                  break;
                          }
                          newRCSfilename[0]='\0'; /* avoid re-deletion by cleanup()*/
                          if (chmod(RCSfilename,RCSstat.st_mode & ~0222)<0)
                              warn("Can't preserve mode of %s",RCSfilename);
  			catchints();

--- 285,296 -----
                                  break;
                          }
                          newRCSfilename[0]='\0'; /* avoid re-deletion by cleanup()*/
+ #ifdef Vsystem
+ 			if (NReadDescriptor(RCSfilename, &tempstatus) != OK ||
+ 			    CopyPerms(&tempstatus, &RCSstat) != OK ||
+ 			    NoWrite(&tempstatus) != OK ||
+ 			    NWriteDescriptor(RCSfilename, &tempstatus) != OK)
+ #else
                          if (chmod(RCSfilename,RCSstat.st_mode & ~0222)<0)
  #endif
                              warn("Can't preserve mode of %s",RCSfilename);
***************
*** 275,280
                          }
                          newRCSfilename[0]='\0'; /* avoid re-deletion by cleanup()*/
                          if (chmod(RCSfilename,RCSstat.st_mode & ~0222)<0)
                              warn("Can't preserve mode of %s",RCSfilename);
  			catchints();
                  }

--- 292,298 -----
  			    NWriteDescriptor(RCSfilename, &tempstatus) != OK)
  #else
                          if (chmod(RCSfilename,RCSstat.st_mode & ~0222)<0)
+ #endif
                              warn("Can't preserve mode of %s",RCSfilename);
  
  			catchints();
***************
*** 276,281
                          newRCSfilename[0]='\0'; /* avoid re-deletion by cleanup()*/
                          if (chmod(RCSfilename,RCSstat.st_mode & ~0222)<0)
                              warn("Can't preserve mode of %s",RCSfilename);
  			catchints();
                  }
  

--- 294,300 -----
                          if (chmod(RCSfilename,RCSstat.st_mode & ~0222)<0)
  #endif
                              warn("Can't preserve mode of %s",RCSfilename);
+ 
  			catchints();
                  }
  
***************
*** 288,294
                          if (!buildjoin(neworkfilename,tostdout)) continue;
                  }
                  if (!tostdout) {
!                         if (link(neworkfilename,workfilename) <0) {
                                  error("Can't create %s; see %s",workfilename,neworkfilename);
                                  neworkfilename[0]= '\0'; /*avoid deletion*/
                                  continue;

--- 307,313 -----
                          if (!buildjoin(neworkfilename,tostdout)) continue;
                  }
                  if (!tostdout) {
!                         if (rename(neworkfilename,workfilename) <0) {
                                  error("Can't create %s; see %s",workfilename,neworkfilename);
                                  neworkfilename[0]= '\0'; /*avoid deletion*/
                                  continue;
***************
*** 296,301
  		}
          }
          if (!tostdout)
              if (chmod(workfilename, WORKMODE(RCSstat.st_mode))<0)
                  warn("Can't adjust mode of %s",workfilename);
  

--- 315,326 -----
  		}
          }
          if (!tostdout)
+ #ifdef Vsystem
+ 	    if (NReadDescriptor(workfilename, &tempstatus) != OK ||
+ 		CopyPerms(&tempstatus, &RCSstat) != OK ||
+ 		WorkPerms(&tempstatus, lockflag || !StrictLocks) != OK ||
+ 		NWriteDescriptor(workfilename, &tempstatus) != OK)
+ #else
              if (chmod(workfilename, WORKMODE(RCSstat.st_mode))<0)
  #endif
                  warn("Can't adjust mode of %s",workfilename);
***************
*** 297,302
          }
          if (!tostdout)
              if (chmod(workfilename, WORKMODE(RCSstat.st_mode))<0)
                  warn("Can't adjust mode of %s",workfilename);
  
          if (!tostdout) diagnose("done");

--- 322,328 -----
  		NWriteDescriptor(workfilename, &tempstatus) != OK)
  #else
              if (chmod(workfilename, WORKMODE(RCSstat.st_mode))<0)
+ #endif
                  warn("Can't adjust mode of %s",workfilename);
  
          if (!tostdout) diagnose("done");
***************
*** 323,328
   */
  {
          int response, c;    /* holds user response to queries */
          struct stat buf;
  
          if (stat (ofile, &buf) < 0)         /* File doesn't exist */

--- 349,357 -----
   */
  {
          int response, c;    /* holds user response to queries */
+ #ifdef Vsystem
+         ArbitraryDescriptor buf;
+ #else
          struct stat buf;
  #endif Vsystem
  
***************
*** 324,329
  {
          int response, c;    /* holds user response to queries */
          struct stat buf;
  
          if (stat (ofile, &buf) < 0)         /* File doesn't exist */
              return (true);                  /* No problem         */

--- 353,359 -----
          ArbitraryDescriptor buf;
  #else
          struct stat buf;
+ #endif Vsystem
  
  #ifdef Vsystem
          if (NReadDescriptor(ofile, &buf) != OK) /* File doesn't exist */
***************
*** 325,330
          int response, c;    /* holds user response to queries */
          struct stat buf;
  
          if (stat (ofile, &buf) < 0)         /* File doesn't exist */
              return (true);                  /* No problem         */
  

--- 355,363 -----
          struct stat buf;
  #endif Vsystem
  
+ #ifdef Vsystem
+         if (NReadDescriptor(ofile, &buf) != OK) /* File doesn't exist */
+ #else
          if (stat (ofile, &buf) < 0)         /* File doesn't exist */
  #endif Vsystem
              return (true);                  /* No problem         */
***************
*** 326,331
          struct stat buf;
  
          if (stat (ofile, &buf) < 0)         /* File doesn't exist */
              return (true);                  /* No problem         */
  
          if (buf.st_mode & 0222) {            /* File is writable */

--- 359,365 -----
          if (NReadDescriptor(ofile, &buf) != OK) /* File doesn't exist */
  #else
          if (stat (ofile, &buf) < 0)         /* File doesn't exist */
+ #endif Vsystem
              return (true);                  /* No problem         */
  
  #ifdef Vsystem
***************
*** 328,333
          if (stat (ofile, &buf) < 0)         /* File doesn't exist */
              return (true);                  /* No problem         */
  
          if (buf.st_mode & 0222) {            /* File is writable */
              if (!quietflag) {
                  fprintf(stderr,"writable %s exists; overwrite? [ny](n): ",ofile);

--- 362,370 -----
  #endif Vsystem
              return (true);                  /* No problem         */
  
+ #ifdef Vsystem
+ 	if (IsWriteable(&buf)) {
+ #else
          if (buf.st_mode & 0222) {            /* File is writable */
  #endif Vsystem
              if (!quietflag) {
***************
*** 329,334
              return (true);                  /* No problem         */
  
          if (buf.st_mode & 0222) {            /* File is writable */
              if (!quietflag) {
                  fprintf(stderr,"writable %s exists; overwrite? [ny](n): ",ofile);
                  /* must be stderr in case of IO redirect */

--- 366,372 -----
  	if (IsWriteable(&buf)) {
  #else
          if (buf.st_mode & 0222) {            /* File is writable */
+ #endif Vsystem
              if (!quietflag) {
                  fprintf(stderr,"writable %s exists; overwrite? [ny](n): ",ofile);
                  /* must be stderr in case of IO redirect */
***************
*** 343,348
                  return false;
              }
          }
          /* now unlink: either not writable, or permission given */
          if (unlink(ofile) != 0) {            /* Remove failed   */
              error("Can't unlink %s",ofile);

--- 381,387 -----
                  return false;
              }
          }
+ 
          /* now unlink: either not writable, or permission given */
          if (unlink(ofile) != 0) {            /* Remove failed   */
              error("Can't unlink %s",ofile);
***************
*** 358,363
   * Removes an existing file with the same name with rmoldfile().
   */
  {
          int  fdesc;              /* file descriptor */
  
          if (!rmoldfile(file)) return false;

--- 397,406 -----
   * Removes an existing file with the same name with rmoldfile().
   */
  {
+ #ifdef Vsystem
+ 	File *fad;
+ 	SystemCode err;
+ #else
          int  fdesc;              /* file descriptor */
  #endif 
  
***************
*** 359,364
   */
  {
          int  fdesc;              /* file descriptor */
  
          if (!rmoldfile(file)) return false;
          fdesc=creat(file,0666);

--- 402,408 -----
  	SystemCode err;
  #else
          int  fdesc;              /* file descriptor */
+ #endif 
  
          if (!rmoldfile(file)) return false;
  
***************
*** 361,366
          int  fdesc;              /* file descriptor */
  
          if (!rmoldfile(file)) return false;
          fdesc=creat(file,0666);
          if (fdesc < 0) {
                  faterror("Cannot create %s",file);

--- 405,424 -----
  #endif 
  
          if (!rmoldfile(file)) return false;
+ 
+ #ifdef Vsystem
+ 	fad = Open(file, FCREATE, &err);
+ 	if (err != OK)
+ 	  {
+ 	    faterror("Cannot create %s: %s", file, ErrorString(err));
+ 	    return false;
+ 	  }
+ 	else
+ 	  {
+ 	    Close(fad);
+ 	    return true;
+ 	  }
+ #else
          fdesc=creat(file,0666);
          if (fdesc < 0) {
                  faterror("Cannot create %s",file);
***************
*** 369,374
                  close(fdesc); /* empty file */
                  return true;
          }
  }
  
  

--- 427,433 -----
                  close(fdesc); /* empty file */
                  return true;
          }
+ #endif Vsystem
  }
  
  
***************
*** 479,486
          char * rev2, * rev3;
          int i;
  
!         rev2=mktempfile("/tmp/",JOINFIL2);
!         rev3=mktempfile("/tmp/",JOINFIL3);
  
          i=0;
          while (i<lastjoin) {

--- 538,545 -----
          char * rev2, * rev3;
          int i;
  
!         rev2=mktempfile(TMPDIR,JOINFIL2);
!         rev3=mktempfile(TMPDIR,JOINFIL3);
  
          i=0;
          while (i<lastjoin) {
RCS file: RCS/ident.c,v
retrieving revision 3.4
retrieving revision 3.5
diff -c -r3.4 -r3.5
*** /tmp/,RCSt1002049	Sat Feb  1 11:35:28 1986
--- /tmp/,RCSt2002049	Sat Feb  1 11:35:29 1986
***************
*** 2,8
   *                     RCS identification operation
   */
   static char rcsid[] =
!  "$Header: ident.c,v 3.4 83/02/18 17:37:49 wft Exp $Purdue CS";
  /*****************************************************************************
   *****************************************************************************
   *

--- 2,8 -----
   *                     RCS identification operation
   */
   static char rcsid[] =
!  "$Header: ident.c,v 3.5 86/01/21 20:30:17 mann Exp $Purdue CS";
  /*****************************************************************************
   *****************************************************************************
   *
***************
*** 18,23
   */
  
  /* $Log:	ident.c,v $
   * Revision 3.4  83/02/18  17:37:49  wft
   * *** empty log message ***
   * 

--- 18,26 -----
   */
  
  /* $Log:	ident.c,v $
+  * Revision 3.5  86/01/21  20:30:17  mann
+  * Ported to V
+  * 
   * Revision 3.4  83/02/18  17:37:49  wft
   * *** empty log message ***
   * 
***************
*** 38,43
  #define fflsbuf _flsbuf
  /* redefinition of _flsbuf in putc not needed */
  static char rcsbaseid[] = RCSBASE;
  
  main(argc, argv)
  int  argc; char  *argv[];

--- 41,50 -----
  #define fflsbuf _flsbuf
  /* redefinition of _flsbuf in putc not needed */
  static char rcsbaseid[] = RCSBASE;
+ 
+ #ifdef main
+ #undef main
+ #endif main
  
  main(argc, argv)
  int  argc; char  *argv[];
RCS file: RCS/rcs.c,v
retrieving revision 3.9
retrieving revision 3.11
diff -c -r3.9 -r3.11
*** /tmp/,RCSt1002040	Sat Feb  1 11:35:05 1986
--- /tmp/,RCSt2002040	Sat Feb  1 11:35:11 1986
***************
*** 2,8
   *                      RCS create/change operation
   */
   static char rcsid[]=
!  "$Header: rcs.c,v 3.9 83/02/15 15:38:39 wft Exp $ Purdue CS";
  /***************************************************************************
   *                       create RCS files or change RCS file attributes
   *                       Compatibility with release 2: define COMPAT2

--- 2,8 -----
   *                      RCS create/change operation
   */
   static char rcsid[]=
!  "$Header: rcs.c,v 3.11 86/01/21 21:08:19 mann Exp $ Purdue CS";
  /***************************************************************************
   *                       create RCS files or change RCS file attributes
   *                       Compatibility with release 2: define COMPAT2
***************
*** 21,26
  
  
  /* $Log:	rcs.c,v $
   * Revision 3.9  83/02/15  15:38:39  wft
   * *** empty log message ***
   * 

--- 21,32 -----
  
  
  /* $Log:	rcs.c,v $
+  * Revision 3.11  86/01/21  21:08:19  mann
+  * Eliminated need to define V4_2BSD when compiling Vsystem version.
+  * 
+  * Revision 3.10  86/01/21  20:16:15  mann
+  * Ported to V
+  * 
   * Revision 3.9  83/02/15  15:38:39  wft
   * *** empty log message ***
   * 
***************
*** 107,112
  
  FILE * fcut;        /* temporary file to rebuild delta tree                 */
  int    rewriteflag; /* indicates whether input should be echoed to frewrite */
  struct stat filestatus; /* used for preserving mode of an exisiting RCS file*/
  int  oldumask;      /* saves umask */
  

--- 113,121 -----
  
  FILE * fcut;        /* temporary file to rebuild delta tree                 */
  int    rewriteflag; /* indicates whether input should be echoed to frewrite */
+ #ifdef Vsystem
+ ArbitraryDescriptor filestatus, tempstatus;
+ #else
  struct stat filestatus; /* used for preserving mode of an exisiting RCS file*/
  #endif Vsystem
  int  oldumask;      /* saves umask */
***************
*** 108,113
  FILE * fcut;        /* temporary file to rebuild delta tree                 */
  int    rewriteflag; /* indicates whether input should be echoed to frewrite */
  struct stat filestatus; /* used for preserving mode of an exisiting RCS file*/
  int  oldumask;      /* saves umask */
  
  int initflag, strictlock, strict_selected, textflag;

--- 117,123 -----
  ArbitraryDescriptor filestatus, tempstatus;
  #else
  struct stat filestatus; /* used for preserving mode of an exisiting RCS file*/
+ #endif Vsystem
  int  oldumask;      /* saves umask */
  
  int initflag, strictlock, strict_selected, textflag;
***************
*** 177,183
          initflag= textflag = false;
          strict_selected = 0;
  
!         caller=getpwuid(getuid())->pw_name;
          laststate = statelst = nil;
          lastassoc = assoclst = nil;
          curlock = rmvlock = newlocklst = rmvlocklst = nil;

--- 187,193 -----
          initflag= textflag = false;
          strict_selected = 0;
  
!         caller=UserName(0);
          laststate = statelst = nil;
          lastassoc = assoclst = nil;
          curlock = rmvlock = newlocklst = rmvlocklst = nil;
***************
*** 385,390
                  case -1: continue;    /*  not exist    */
                  case  0: continue;    /*  can't open   */
                  case  1:              /*  file exists  */
                           fstat(fileno(finptr), &filestatus);/*grab mode*/
                           break;
              }

--- 395,404 -----
                  case -1: continue;    /*  not exist    */
                  case  0: continue;    /*  can't open   */
                  case  1:              /*  file exists  */
+ #ifdef Vsystem
+                          ReadDescriptor(FileServer(finptr), FileId(finptr),
+ 			 	&filestatus);/*grab mode*/
+ #else
                           fstat(fileno(finptr), &filestatus);/*grab mode*/
  #endif
                           break;
***************
*** 386,391
                  case  0: continue;    /*  can't open   */
                  case  1:              /*  file exists  */
                           fstat(fileno(finptr), &filestatus);/*grab mode*/
                           break;
              }
  	}

--- 400,406 -----
  			 	&filestatus);/*grab mode*/
  #else
                           fstat(fileno(finptr), &filestatus);/*grab mode*/
+ #endif
                           break;
              }
  	}
***************
*** 516,521
                  break;
              }
              newRCSfilename[0]='\0'; /* avoid re-unlinking by cleanup()*/
              if (!initflag) /* preserve mode bits */
                  if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0)
                          warn("Can't set mode of %s",RCSfilename);

--- 531,537 -----
                  break;
              }
              newRCSfilename[0]='\0'; /* avoid re-unlinking by cleanup()*/
+ 
              if (!initflag) /* preserve mode bits */
  #ifdef Vsystem
  	    if (NReadDescriptor(RCSfilename, &tempstatus) != OK ||
***************
*** 517,522
              }
              newRCSfilename[0]='\0'; /* avoid re-unlinking by cleanup()*/
              if (!initflag) /* preserve mode bits */
                  if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0)
                          warn("Can't set mode of %s",RCSfilename);
  

--- 533,544 -----
              newRCSfilename[0]='\0'; /* avoid re-unlinking by cleanup()*/
  
              if (!initflag) /* preserve mode bits */
+ #ifdef Vsystem
+ 	    if (NReadDescriptor(RCSfilename, &tempstatus) != OK ||
+ 		CopyPerms(&tempstatus, &filestatus) != OK ||
+ 		NoWrite(&tempstatus) != OK ||
+ 		NWriteDescriptor(workfilename, &tempstatus) != OK)
+ #else
                  if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0)
  #endif Vsystem
                          warn("Can't set mode of %s",RCSfilename);
***************
*** 518,523
              newRCSfilename[0]='\0'; /* avoid re-unlinking by cleanup()*/
              if (!initflag) /* preserve mode bits */
                  if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0)
                          warn("Can't set mode of %s",RCSfilename);
  
  	    catchints();		/* catch them all again */

--- 540,546 -----
  		NWriteDescriptor(workfilename, &tempstatus) != OK)
  #else
                  if (chmod(RCSfilename,filestatus.st_mode & ~0222)<0)
+ #endif Vsystem
                          warn("Can't set mode of %s",RCSfilename);
  
  	    catchints();		/* catch them all again */
***************
*** 928,934
          if (response=='\n'||response=='n'||response=='N') return false;
  
          /* go ahead with breaking  */
!         messagefile=mktempfile("/tmp/", "RCSmailXXXXX");
          if ( (mailmess = fopen(messagefile, "w")) == NULL) {
              faterror("Can't open file %s", messagefile);
          }

--- 951,957 -----
          if (response=='\n'||response=='n'||response=='N') return false;
  
          /* go ahead with breaking  */
!         messagefile=mktempfile(TMPDIR, "RCSmailXXXXX");
          if ( (mailmess = fopen(messagefile, "w")) == NULL) {
              faterror("Can't open file %s", messagefile);
          }
***************
*** 937,942
          fprintf(mailmess, "Your lock on revision %s of file %s\n",Delta, getfullRCSname());
          fprintf(mailmess,"has been broken by %s for the following reason:\n",caller);
          fputs("State the reason for breaking the lock:\n", stdout);
          fputs("(terminate with ^D or single '.')\n>> ", stdout);
  
          old1 = '\n';    old2 = ' ';

--- 960,968 -----
          fprintf(mailmess, "Your lock on revision %s of file %s\n",Delta, getfullRCSname());
          fprintf(mailmess,"has been broken by %s for the following reason:\n",caller);
          fputs("State the reason for breaking the lock:\n", stdout);
+ #ifdef Vsystem
+         fputs("(terminate with ^Z or single '.')\n>> ", stdout);
+ #else
          fputs("(terminate with ^D or single '.')\n>> ", stdout);
  #endif Vsystem
  
***************
*** 938,943
          fprintf(mailmess,"has been broken by %s for the following reason:\n",caller);
          fputs("State the reason for breaking the lock:\n", stdout);
          fputs("(terminate with ^D or single '.')\n>> ", stdout);
  
          old1 = '\n';    old2 = ' ';
          for (; ;) {

--- 964,970 -----
          fputs("(terminate with ^Z or single '.')\n>> ", stdout);
  #else
          fputs("(terminate with ^D or single '.')\n>> ", stdout);
+ #endif Vsystem
  
          old1 = '\n';    old2 = ' ';
          for (; ;) {
***************
*** 945,950
              if ( c == EOF ) {
                  putc('\n',stdout);
                  fprintf(mailmess, "%c\n", old1);
                  break;
              }
              else if ( c == '\n' && old1 == '.' && old2 == '\n')

--- 972,978 -----
              if ( c == EOF ) {
                  putc('\n',stdout);
                  fprintf(mailmess, "%c\n", old1);
+ 		clearerr(stdin);
                  break;
              }
              else if ( c == '\n' && old1 == '.' && old2 == '\n')
***************
*** 956,962
              }
          }
          ffclose(mailmess);
! #ifdef V4_2BSD
          sprintf(command, "/usr/lib/sendmail %s < %s",who,messagefile);
  #else
          sprintf(command, "/etc/delivermail -w %s < %s",who,messagefile);

--- 984,990 -----
              }
          }
          ffclose(mailmess);
! #if defined(V4_2BSD) || defined(Vsystem)  /* %%% questionable for V */
          sprintf(command, "/usr/lib/sendmail %s < %s",who,messagefile);
  #else
          sprintf(command, "/etc/delivermail -w %s < %s",who,messagefile);
***************
*** 985,991
          dummy.nextlock=next=Locks;
          trail = &dummy;
          while (next!=nil) {
!                numr = strcmp(num, next->delta->num);
                 if ((whor=strcmp(who,next->login))==0 &&
                    (num==nil || numr==0))
                          break; /* found a lock */

--- 1013,1019 -----
          dummy.nextlock=next=Locks;
          trail = &dummy;
          while (next!=nil) {
! 	       numr = (num==nil) ? -1 : strcmp(num, next->delta->num);
                 if ((whor=strcmp(who,next->login))==0 &&
                    (num==nil || numr==0))
                          break; /* found a lock */
***************
*** 1324,1330
          int  i, c, exit_stats;
  
          cuttail->selector = DELETE;
!         initeditfiles("/tmp/");
          scanlogtext(deltas[0], copy);
          i = 1;
          if ( cuthead )  {

--- 1352,1358 -----
          int  i, c, exit_stats;
  
          cuttail->selector = DELETE;
!         initeditfiles(TMPDIR);
          scanlogtext(deltas[0], copy);
          i = 1;
          if ( cuthead )  {
***************
*** 1328,1334
          scanlogtext(deltas[0], copy);
          i = 1;
          if ( cuthead )  {
!             cutfilename=mktempfile("/tmp/", "RCScutXXXXXX");
              if ( (fcut = fopen(cutfilename, "w")) == NULL) {
                  faterror("Can't open temporary file %s", cutfilename);
              }

--- 1356,1362 -----
          scanlogtext(deltas[0], copy);
          i = 1;
          if ( cuthead )  {
!             cutfilename=mktempfile(TMPDIR, "RCScutXXXXXX");
              if ( (fcut = fopen(cutfilename, "w")) == NULL) {
                  faterror("Can't open temporary file %s", cutfilename);
              }
***************
*** 1348,1354
          finishedit(nil);    ffclose(fcopy);
  
          if ( cuthead ) {
!             diffilename=mktempfile("/tmp/", "RCSdifXXXXXX");
              sprintf(command, "%s -n %s %s > %s", DIFF,cutfilename, resultfile, diffilename);
              exit_stats = system (command);
              if (exit_stats != 0 && exit_stats != (1 << BYTESIZ))

--- 1376,1382 -----
          finishedit(nil);    ffclose(fcopy);
  
          if ( cuthead ) {
!             diffilename=mktempfile(TMPDIR, "RCSdifXXXXXX");
              sprintf(command, "%s -n %s %s > %s", DIFF,cutfilename, resultfile, diffilename);
              exit_stats = system (command);
              if (exit_stats != 0 && exit_stats != DIFFERENT)
***************
*** 1351,1357
              diffilename=mktempfile("/tmp/", "RCSdifXXXXXX");
              sprintf(command, "%s -n %s %s > %s", DIFF,cutfilename, resultfile, diffilename);
              exit_stats = system (command);
!             if (exit_stats != 0 && exit_stats != (1 << BYTESIZ))
                  faterror ("diff failed");
              if(!putdtext(cuttail->num,curlogmsg,diffilename,frewrite)) return;
          }

--- 1379,1385 -----
              diffilename=mktempfile(TMPDIR, "RCSdifXXXXXX");
              sprintf(command, "%s -n %s %s > %s", DIFF,cutfilename, resultfile, diffilename);
              exit_stats = system (command);
!             if (exit_stats != 0 && exit_stats != DIFFERENT)
                  faterror ("diff failed");
              if(!putdtext(cuttail->num,curlogmsg,diffilename,frewrite)) return;
          }
RCS file: RCS/rcsbase.h,v
retrieving revision 3.6
retrieving revision 3.8
diff -c -r3.6 -r3.8
*** /tmp/,RCSt1002030	Sat Feb  1 11:34:19 1986
--- /tmp/,RCSt2002030	Sat Feb  1 11:34:22 1986
***************
*** 2,8
  /*
   *                     RCS common definitions and data structures
   */
! #define RCSBASE "$Header: rcsbase.h,v 3.6 83/01/15 16:43:28 wft Exp $"
  /*****************************************************************************
   * INSTRUCTIONS:
   * =============

--- 2,8 -----
  /*
   *                     RCS common definitions and data structures
   */
! #define RCSBASE "$Header: rcsbase.h,v 3.8 86/01/21 21:07:41 mann Exp $"
  /*****************************************************************************
   * INSTRUCTIONS:
   * =============
***************
*** 28,33
  
  
  /* $Log:	rcsbase.h,v $
   * Revision 3.6  83/01/15  16:43:28  wft
   * *** empty log message ***
   * 

--- 28,39 -----
  
  
  /* $Log:	rcsbase.h,v $
+  * Revision 3.8  86/01/21  21:07:41  mann
+  * Eliminated need to define V4_2BSD when compiling Vsystem version.
+  * 
+  * Revision 3.7  86/01/21  20:17:53  mann
+  * Ported to V
+  * 
   * Revision 3.6  83/01/15  16:43:28  wft
   * *** empty log message ***
   * 
***************
*** 60,65
  
  
  #include <stdio.h>
  #undef putc         /* will be redefined */
  
  

--- 66,72 -----
  
  
  #include <stdio.h>
+ #ifndef Vsystem
  #undef putc         /* will be redefined */
  #endif Vsystem
  
***************
*** 61,66
  
  #include <stdio.h>
  #undef putc         /* will be redefined */
  
  
  #ifdef USG

--- 68,74 -----
  #include <stdio.h>
  #ifndef Vsystem
  #undef putc         /* will be redefined */
+ #endif Vsystem
  
  #ifdef USG
  #       define rindex    strrchr
***************
*** 62,68
  #include <stdio.h>
  #undef putc         /* will be redefined */
  
- 
  #ifdef USG
  #       define rindex    strrchr
  #       define DATEFORM  "%.2d.%.2d.%.2d.%.2d.%.2d.%.2d"

--- 70,75 -----
  #undef putc         /* will be redefined */
  #endif Vsystem
  
  #ifdef USG
  #       define rindex    strrchr
  #       define DATEFORM  "%.2d.%.2d.%.2d.%.2d.%.2d.%.2d"
***************
*** 100,106
  #define KDELIM            '$' /* delimiter for keywords                     */
  #define VDELIM            ':' /* separates keywords from values             */
  #define DEFAULTSTATE    "Exp" /* default state of revisions                 */
! #ifdef V4_2BSD
  #  define NCPFN           256 /* number of characters per filename          */
  #  define NCPPN          1024 /* number of characters per pathname          */
  #else

--- 107,113 -----
  #define KDELIM            '$' /* delimiter for keywords                     */
  #define VDELIM            ':' /* separates keywords from values             */
  #define DEFAULTSTATE    "Exp" /* default state of revisions                 */
! #if defined(V4_2BSD) || defined(Vsystem)
  #  define NCPFN           256 /* number of characters per filename          */
  #  define NCPPN          1024 /* number of characters per pathname          */
  #else
***************
*** 131,136
  #define JOINFIL3    ",RCSj3XXXXXX"
  
  
  #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(unsigned)(x))):fflsbuf((unsigned)(x),p))
  /* This version of putc prints a char, but aborts on write error            */
  

--- 138,144 -----
  #define JOINFIL3    ",RCSj3XXXXXX"
  
  
+ #ifndef Vsystem
  #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(unsigned)(x))):fflsbuf((unsigned)(x),p))
  /* This version of putc prints a char, but aborts on write error            */
  #endif Vsystem
***************
*** 133,138
  
  #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(unsigned)(x))):fflsbuf((unsigned)(x),p))
  /* This version of putc prints a char, but aborts on write error            */
  
  #define GETC(in,out,echo) (echo?putc(getc(in),out):getc(in))
  /* GETC writes a del-character (octal 177) on end of file                   */

--- 141,147 -----
  #ifndef Vsystem
  #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(unsigned)(x))):fflsbuf((unsigned)(x),p))
  /* This version of putc prints a char, but aborts on write error            */
+ #endif Vsystem
  
  #define GETC(in,out,echo) (echo?putc(getc(in),out):getc(in))
  /* GETC writes a del-character (octal 177) on end of file                   */
***************
*** 137,142
  #define GETC(in,out,echo) (echo?putc(getc(in),out):getc(in))
  /* GETC writes a del-character (octal 177) on end of file                   */
  
  #define WORKMODE(RCSmode) (RCSmode&~0222)|((lockflag||!StrictLocks)?0600:0000)
  /* computes mode of working file: same as RCSmode, but write permission     */
  /* determined by lockflag and StrictLocks.                                  */

--- 146,152 -----
  #define GETC(in,out,echo) (echo?putc(getc(in),out):getc(in))
  /* GETC writes a del-character (octal 177) on end of file                   */
  
+ #ifndef Vsystem
  #define WORKMODE(RCSmode) (RCSmode&~0222)|((lockflag||!StrictLocks)?0600:0000)
  /* computes mode of working file: same as RCSmode, but write permission     */
  /* determined by lockflag and StrictLocks.                                  */
***************
*** 140,145
  #define WORKMODE(RCSmode) (RCSmode&~0222)|((lockflag||!StrictLocks)?0600:0000)
  /* computes mode of working file: same as RCSmode, but write permission     */
  /* determined by lockflag and StrictLocks.                                  */
  
  
  /* character classes and token codes */

--- 150,157 -----
  #define WORKMODE(RCSmode) (RCSmode&~0222)|((lockflag||!StrictLocks)?0600:0000)
  /* computes mode of working file: same as RCSmode, but write permission     */
  /* determined by lockflag and StrictLocks.                                  */
+ #define NOWRITE(RCSmode) (RCSmode & ~0222)
+ #endif Vsystem
  
  /* character classes and token codes */
  enum tokens {
***************
*** 141,147
  /* computes mode of working file: same as RCSmode, but write permission     */
  /* determined by lockflag and StrictLocks.                                  */
  
- 
  /* character classes and token codes */
  enum tokens {
  /* char classes*/  DIGIT, IDCHAR, NEWLN, LETTER, PERIOD, SBEGIN, SPACE, UNKN,

--- 153,158 -----
  #define NOWRITE(RCSmode) (RCSmode & ~0222)
  #endif Vsystem
  
  /* character classes and token codes */
  enum tokens {
  /* char classes*/  DIGIT, IDCHAR, NEWLN, LETTER, PERIOD, SBEGIN, SPACE, UNKN,
***************
*** 263,268
  extern int serror();
  extern int faterror();
  extern int fatserror();
  
  /*
   * Markers for keyword expansion (used in co and ident)

--- 274,283 -----
  extern int serror();
  extern int faterror();
  extern int fatserror();
+ #ifdef Vsystem
+ extern SystemCode NReadDescriptor(), NWriteDescriptor(), CopyPerms(),
+ 		  NoWrite(), WorkPerms();
+ #endif Vsystem
  
  /*
   * Markers for keyword expansion (used in co and ident)
***************
*** 285,287
  /* set by rcs -o and used by puttree() in rcssyn */
  
  typedef int void;

--- 300,317 -----
  /* set by rcs -o and used by puttree() in rcssyn */
  
  typedef int void;
+ 
+ #ifdef Vsystem
+ #include <Vdirectory.h>
+ #define getuid() User(0)
+ #define umask(x) 0
+ #define main main_	/* so real main() can invoke main_() as a process */
+ #define DIFFERENT 1
+ #define TMPDIR "[tmp]"
+ extern char *UserName();
+ #else /* UNIX */
+ #define Interactive(file) isatty(fileno(file))
+ #define UserName(pid) getpwuid(getuid())->pw_name  /* assumes pid is ours */
+ #define DIFFERENT (1 << BYTESIZ)
+ #define TMPDIR "/tmp/"
+ #endif Vsystem
RCS file: RCS/rcsdiff.c,v
retrieving revision 3.6
retrieving revision 3.7
diff -c -r3.6 -r3.7
*** /tmp/,RCSt1002014	Sat Feb  1 11:33:31 1986
--- /tmp/,RCSt2002014	Sat Feb  1 11:33:33 1986
***************
*** 2,8
   *                     RCS rcsdiff operation
   */
   static char rcsid[]=
!  "$Header: rcsdiff.c,v 3.6 83/01/15 17:52:40 wft Exp $ Purdue CS";
  /*****************************************************************************
   *                       generate difference between RCS revisions
   *****************************************************************************

--- 2,8 -----
   *                     RCS rcsdiff operation
   */
   static char rcsid[]=
!  "$Header: rcsdiff.c,v 3.7 86/01/21 20:17:00 mann Exp $ Purdue CS";
  /*****************************************************************************
   *                       generate difference between RCS revisions
   *****************************************************************************
***************
*** 20,25
  
  
  /* $Log:	rcsdiff.c,v $
   * Revision 3.6  83/01/15  17:52:40  wft
   * *** empty log message ***
   * 

--- 20,28 -----
  
  
  /* $Log:	rcsdiff.c,v $
+  * Revision 3.7  86/01/21  20:17:00  mann
+  * Ported to V
+  * 
   * Revision 3.6  83/01/15  17:52:40  wft
   * *** empty log message ***
   * 
***************
*** 143,149
                  }
  
  
!                 temp1file=mktempfile("/tmp/",TMPFILE1);
                  diagnose("retrieving revision %s",xrev1);
                  sprintf(command,"%s/co -q -p%s %s > %s\n",
                          TARGETDIR,xrev1,RCSfilename,temp1file);

--- 146,152 -----
                  }
  
  
!                 temp1file=mktempfile(TMPDIR,TMPFILE1);
                  diagnose("retrieving revision %s",xrev1);
                  sprintf(command,"%s/co -q -p%s %s > %s\n",
                          TARGETDIR,xrev1,RCSfilename,temp1file);
***************
*** 147,152
                  diagnose("retrieving revision %s",xrev1);
                  sprintf(command,"%s/co -q -p%s %s > %s\n",
                          TARGETDIR,xrev1,RCSfilename,temp1file);
                  if (system(command)){
                          error("co failed");
                          continue;

--- 150,157 -----
                  diagnose("retrieving revision %s",xrev1);
                  sprintf(command,"%s/co -q -p%s %s > %s\n",
                          TARGETDIR,xrev1,RCSfilename,temp1file);
+ 		fflush(stdout);
+ 		fflush(stderr);
                  if (system(command)){
                          error("co failed");
                          continue;
***************
*** 151,156
                          error("co failed");
                          continue;
                  }
                  if (revnums<=1) {
                          temp2file=workfilename;
                          diagnose("diff %s%s -r%s %s",boption,otheroption,xrev1,workfilename);

--- 156,168 -----
                          error("co failed");
                          continue;
                  }
+ #ifdef Vsystem
+ 		Resynch(stdin);
+ 		Resynch(stdout);
+ 		Resynch(stderr);
+ 		Seek(stdout, 0, FILE_END);
+ 		Seek(stderr, 0, FILE_END);
+ #endif
                  if (revnums<=1) {
                          temp2file=workfilename;
                          diagnose("diff %s%s -r%s %s",boption,otheroption,xrev1,workfilename);
***************
*** 155,161
                          temp2file=workfilename;
                          diagnose("diff %s%s -r%s %s",boption,otheroption,xrev1,workfilename);
                  } else {
!                         temp2file=mktempfile("/tmp/",TMPFILE2);
                          diagnose("retrieving revision %s",xrev2);
                          sprintf(command,"%s/co -q -p%s %s > %s\n",
                                  TARGETDIR,xrev2,RCSfilename,temp2file);

--- 167,173 -----
                          temp2file=workfilename;
                          diagnose("diff %s%s -r%s %s",boption,otheroption,xrev1,workfilename);
                  } else {
!                         temp2file=mktempfile(TMPDIR,TMPFILE2);
                          diagnose("retrieving revision %s",xrev2);
                          sprintf(command,"%s/co -q -p%s %s > %s\n",
                                  TARGETDIR,xrev2,RCSfilename,temp2file);
***************
*** 159,164
                          diagnose("retrieving revision %s",xrev2);
                          sprintf(command,"%s/co -q -p%s %s > %s\n",
                                  TARGETDIR,xrev2,RCSfilename,temp2file);
                          if (system(command)){
                                  error("co failed");
                                  continue;

--- 171,178 -----
                          diagnose("retrieving revision %s",xrev2);
                          sprintf(command,"%s/co -q -p%s %s > %s\n",
                                  TARGETDIR,xrev2,RCSfilename,temp2file);
+ 			fflush(stdout);
+ 			fflush(stderr);
                          if (system(command)){
                                  error("co failed");
                                  continue;
***************
*** 163,168
                                  error("co failed");
                                  continue;
                          }
                          diagnose("diff %s%s -r%s -r%s",boption,otheroption,xrev1,xrev2);
                  }
                  sprintf(command,"%s %s %s %s %s\n",DIFF,boption,

--- 177,189 -----
                                  error("co failed");
                                  continue;
                          }
+ #ifdef Vsystem
+ 			Resynch(stdin);
+ 			Resynch(stdout);
+ 			Resynch(stderr);
+ 			Seek(stdout, 0, FILE_END);
+ 			Seek(stderr, 0, FILE_END);
+ #endif
                          diagnose("diff %s%s -r%s -r%s",boption,otheroption,xrev1,xrev2);
                  }
                  sprintf(command,"%s %s %s %s %s\n",DIFF,boption,
***************
*** 167,172
                  }
                  sprintf(command,"%s %s %s %s %s\n",DIFF,boption,
                          otheroption, temp1file, temp2file);
                  exit_stats = system (command);
                  if (exit_stats != 0 && exit_stats != (1 << BYTESIZ)) {
                          error ("diff failed");

--- 188,195 -----
                  }
                  sprintf(command,"%s %s %s %s %s\n",DIFF,boption,
                          otheroption, temp1file, temp2file);
+ 		fflush(stdout);
+ 		fflush(stderr);
                  exit_stats = system (command);
  #ifdef Vsystem
  		Resynch(stdin);
***************
*** 168,174
                  sprintf(command,"%s %s %s %s %s\n",DIFF,boption,
                          otheroption, temp1file, temp2file);
                  exit_stats = system (command);
!                 if (exit_stats != 0 && exit_stats != (1 << BYTESIZ)) {
                          error ("diff failed");
                          continue;
                  }

--- 191,205 -----
  		fflush(stdout);
  		fflush(stderr);
                  exit_stats = system (command);
! #ifdef Vsystem
! 		Resynch(stdin);
! 		Resynch(stdout);
! 		Resynch(stderr);
! 		Seek(stdout, 0, FILE_END);
! 		Seek(stderr, 0, FILE_END);
! #endif Vsystem
! 
!                 if (exit_stats != 0 && exit_stats != DIFFERENT) {
                          error ("diff failed");
                          continue;
                  }
RCS file: RCS/rcsfnms.c,v
retrieving revision 3.7
retrieving revision 3.8
diff -c -r3.7 -r3.8
*** /tmp/,RCSt1002008	Sat Feb  1 11:33:38 1986
--- /tmp/,RCSt2002008	Sat Feb  1 11:33:45 1986
***************
*** 2,8
   *                     RCS file name handling
   */
   static char rcsid[]=
!  "$Header: rcsfnms.c,v 3.7 83/05/11 15:01:58 wft Exp $ Purdue CS";
  /****************************************************************************
   *                     creation and deletion of semaphorefile,
   *                     creation of temporary filenames and cleanup()

--- 2,8 -----
   *                     RCS file name handling
   */
   static char rcsid[]=
!  "$Header: rcsfnms.c,v 3.8 86/01/21 20:21:11 mann Exp $ Purdue CS";
  /****************************************************************************
   *                     creation and deletion of semaphorefile,
   *                     creation of temporary filenames and cleanup()
***************
*** 23,28
  
  
  /* $Log:	rcsfnms.c,v $
   * Revision 3.7  83/05/11  15:01:58  wft
   * *** empty log message ***
   * 

--- 23,31 -----
  
  
  /* $Log:	rcsfnms.c,v $
+  * Revision 3.8  86/01/21  20:21:11  mann
+  * Ported to V
+  * 
   * Revision 3.7  83/05/11  15:01:58  wft
   * *** empty log message ***
   * 
***************
*** 157,162
                  return false;
          }
          if (makesema) {
                  if ((fdesc=creat(semafilename, 000)) == -1) {
                       error("Can't create semaphore file for RCS file %s",RCSfilename);
                       return false;

--- 160,176 -----
                  return false;
          }
          if (makesema) {
+ #ifdef Vsystem
+ 	        File *fad;
+ 	        SystemCode err;
+ 	    
+ 	        if ( (fad = Open(semafilename, FCREATE, &err)) == NULL ) {
+                      error("Can't create semaphore file for RCS file %s",RCSfilename);
+                      return false;
+                 } else
+                      Close(fad);
+                      madesema=true;
+ #else
                  if ((fdesc=creat(semafilename, 000)) == -1) {
                       error("Can't create semaphore file for RCS file %s",RCSfilename);
                       return false;
***************
*** 163,168
                  } else
                       close(fdesc);
                       madesema=true;
          }
          return true;
  }

--- 177,183 -----
                  } else
                       close(fdesc);
                       madesema=true;
+ #endif
          }
          return true;
  }
***************
*** 493,498
   * true if writable, false otherwise
   */
  {
          char pathname[NCPPN];
          register char * tp, *sp, *lp;
          lp = rindex(filename,'/');

--- 508,517 -----
   * true if writable, false otherwise
   */
  {
+ #ifdef Vsystem
+ 	/*%%% punt this under V */
+ 	return true;
+ #else
          char pathname[NCPPN];
          register char * tp, *sp, *lp;
          lp = rindex(filename,'/');
***************
*** 516,521
                  error("Directory %s not writable", pathname);
                  return false;
          }
  }
  
  

--- 535,541 -----
                  error("Directory %s not writable", pathname);
                  return false;
          }
+ #endif
  }
  
  
***************
*** 520,526
  
  
  
! #ifndef V4_2BSD
  /* rename() and getwd() will be provided in bsd 4.2 */
  
  

--- 540,554 -----
  
  
  
! #ifdef Vsystem
! char *getwd(dest)
!   char *dest;
!   {
!     strcpy(dest, PerProcess->ctxname);
!   }
! #endif
! 
! #if !defined(V4_2BSD) && !defined(Vsystem)
  /* rename() and getwd() will be provided in bsd 4.2 */
  
  
RCS file: RCS/rcsgen.c,v
retrieving revision 3.3
retrieving revision 3.4
diff -c -r3.3 -r3.4
*** /tmp/,RCSt1002004	Sat Feb  1 11:33:15 1986
--- /tmp/,RCSt2002004	Sat Feb  1 11:33:19 1986
***************
*** 2,8
   *                     RCS revision generation
   */
   static char rcsid[]=
!  "$Header: rcsgen.c,v 3.3 82/11/28 21:36:49 wft Exp $ Purdue CS";
  /*********************************************************************************
   *********************************************************************************
   *

--- 2,8 -----
   *                     RCS revision generation
   */
   static char rcsid[]=
!  "$Header: rcsgen.c,v 3.4 86/01/21 20:31:08 mann Exp $ Purdue CS";
  /*********************************************************************************
   *********************************************************************************
   *
***************
*** 19,24
  
  
  /* $Log:	rcsgen.c,v $
   * Revision 3.3  82/11/28  21:36:49  wft
   * *** empty log message ***
   * 

--- 19,27 -----
  
  
  /* $Log:	rcsgen.c,v $
+  * Revision 3.4  86/01/21  20:31:08  mann
+  * Ported to V
+  * 
   * Revision 3.3  82/11/28  21:36:49  wft
   * *** empty log message ***
   * 
***************
*** 106,112
                  }
          } else {
                  /* several revisions to generate */
!                 initeditfiles(dir?dir:"/tmp/");
                  /* write initial revision into fcopy, no keyword expansion */
                  scandeltatext(deltas[0],copy);
                  i = 1;

--- 109,115 -----
                  }
          } else {
                  /* several revisions to generate */
!                 initeditfiles(dir?dir:TMPDIR);
                  /* write initial revision into fcopy, no keyword expansion */
                  scandeltatext(deltas[0],copy);
                  i = 1;
***************
*** 225,231
                          return true;
                  }
                  /* read text from stdin */
!                 if (isatty(fileno(stdin))) {
                      fputs("enter description, terminated with ^D or '.':\n",stdout);
                      fputs("NOTE: This is NOT the log message!\n>> ",stdout);
                  }

--- 228,237 -----
                          return true;
                  }
                  /* read text from stdin */
!                 if (Interactive(stdin)) {
! #ifdef Vsystem
!                     fputs("enter description, terminated with ^Z or '.':\n",stdout);
! #else
                      fputs("enter description, terminated with ^D or '.':\n",stdout);
  #endif Vsystem
                      fputs("NOTE: This is NOT the log message!\n>> ",stdout);
***************
*** 227,232
                  /* read text from stdin */
                  if (isatty(fileno(stdin))) {
                      fputs("enter description, terminated with ^D or '.':\n",stdout);
                      fputs("NOTE: This is NOT the log message!\n>> ",stdout);
                  }
                  c = '\0'; old2= '\n';

--- 233,239 -----
                      fputs("enter description, terminated with ^Z or '.':\n",stdout);
  #else
                      fputs("enter description, terminated with ^D or '.':\n",stdout);
+ #endif Vsystem
                      fputs("NOTE: This is NOT the log message!\n>> ",stdout);
                  }
                  c = '\0'; old2= '\n';
***************
*** 230,236
                      fputs("NOTE: This is NOT the log message!\n>> ",stdout);
                  }
                  c = '\0'; old2= '\n';
!                 if ((old1=getchar())==EOF && isatty(fileno(stdin)))
                       putc('\n',stdout);
                  else for (;;) {
                              c=getchar();

--- 237,243 -----
                      fputs("NOTE: This is NOT the log message!\n>> ",stdout);
                  }
                  c = '\0'; old2= '\n';
!                 if ((old1=getchar())==EOF && Interactive(stdin))
                       putc('\n',stdout);
                  else for (;;) {
                              c=getchar();
***************
*** 235,241
                  else for (;;) {
                              c=getchar();
                              if (c==EOF) {
!                                     if (isatty(fileno(stdin))) putc('\n',stdout);
                                      putc(old1,frewrite);
                                      if (old1!='\n') putc('\n',frewrite);
                                      break;

--- 242,248 -----
                  else for (;;) {
                              c=getchar();
                              if (c==EOF) {
!                                     if (Interactive(stdin)) putc('\n',stdout);
                                      putc(old1,frewrite);
                                      if (old1!='\n') putc('\n',frewrite);
                                      break;
***************
*** 243,249
                              if (c=='\n' && old1=='.' && old2=='\n') {
                                      break;
                              }
!                             if (c=='\n' && isatty(fileno(stdin))) fputs(">> ",stdout);
                              if(old1==SDELIM) putc(old1,frewrite); /* double up*/
                              putc(old1,frewrite);
                              old2=old1;

--- 250,256 -----
                              if (c=='\n' && old1=='.' && old2=='\n') {
                                      break;
                              }
!                             if (c=='\n' && Interactive(stdin)) fputs(">> ",stdout);
                              if(old1==SDELIM) putc(old1,frewrite); /* double up*/
                              putc(old1,frewrite);
                              old2=old1;
***************
*** 250,255
                              old1=c;
                      } /* end for */
                  putc(SDELIM,frewrite);fputs("\n\n",frewrite);
                  return true;
          }
  }

--- 257,263 -----
                              old1=c;
                      } /* end for */
                  putc(SDELIM,frewrite);fputs("\n\n",frewrite);
+ 		clearerr(stdin);
                  return true;
          }
  }
RCS file: RCS/rcslex.c,v
retrieving revision 3.3
retrieving revision 3.4
diff -c -r3.3 -r3.4
*** /tmp/,RCSt1001992	Sat Feb  1 11:32:56 1986
--- /tmp/,RCSt2001992	Sat Feb  1 11:33:02 1986
***************
*** 2,8
   *                     RCS file input
   */
   static char rcsid[]=
!  "$Header: rcslex.c,v 3.3 82/12/10 16:22:37 wft Exp $ Purdue CS";
  /*********************************************************************************
   *                     Lexical Analysis.
   *                     Character mapping table,

--- 2,8 -----
   *                     RCS file input
   */
   static char rcsid[]=
!  "$Header: rcslex.c,v 3.4 86/01/21 20:31:53 mann Exp $ Purdue CS";
  /*********************************************************************************
   *                     Lexical Analysis.
   *                     Character mapping table,
***************
*** 25,30
   */
  
  /* $Log:	rcslex.c,v $
   * Revision 3.3  82/12/10  16:22:37  wft
   * *** empty log message ***
   * 

--- 25,33 -----
   */
  
  /* $Log:	rcslex.c,v $
+  * Revision 3.4  86/01/21  20:31:53  mann
+  * Ported to V
+  * 
   * Revision 3.3  82/12/10  16:22:37  wft
   * *** empty log message ***
   * 
***************
*** 579,584
  
  
  
  fflsbuf(c, iop)
  int c; register FILE * iop;
  /* Function: Flush iop.

--- 582,588 -----
  
  
  
+ #ifndef Vsystem
  fflsbuf(c, iop)
  int c; register FILE * iop;
  /* Function: Flush iop.
***************
*** 589,595
                  faterror("write error");
          return result;
  }
! 
  
  fputs(s, iop)
  register char *s;

--- 593,599 -----
                  faterror("write error");
          return result;
  }
! #endif Vsystem
  
  fputs(s, iop)
  register char *s;
RCS file: RCS/rcsmerge.c,v
retrieving revision 3.3
retrieving revision 3.4
diff -c -r3.3 -r3.4
*** /tmp/,RCSt1002081	Sat Feb  1 11:36:57 1986
--- /tmp/,RCSt2002081	Sat Feb  1 11:36:59 1986
***************
*** 2,8
   *                       rcsmerge operation
   */
   static char rcsid[]=
!  "$Header: rcsmerge.c,v 3.3 82/12/24 15:29:00 wft Exp $ Purdue CS";
  /*****************************************************************************
   *                       join 2 revisions with respect to a third
   *****************************************************************************

--- 2,8 -----
   *                       rcsmerge operation
   */
   static char rcsid[]=
!  "$Header: rcsmerge.c,v 3.4 86/01/21 20:32:53 mann Exp $ Purdue CS";
  /*****************************************************************************
   *                       join 2 revisions with respect to a third
   *****************************************************************************
***************
*** 20,25
  
  
  /* $Log:	rcsmerge.c,v $
   * Revision 3.3  82/12/24  15:29:00  wft
   * *** empty log message ***
   * 

--- 20,28 -----
  
  
  /* $Log:	rcsmerge.c,v $
+  * Revision 3.4  86/01/21  20:32:53  mann
+  * Ported to V
+  * 
   * Revision 3.3  82/12/24  15:29:00  wft
   * *** empty log message ***
   * 
***************
*** 112,119
                  if (!(target=genrevs(numericrev,nil,nil,nil,gendeltas))) goto end;
                  rev2=target->num;
  
!                 temp1file=mktempfile("/tmp/",TMPFILE1);
!                 temp2file=mktempfile("/tmp/",TMPFILE2);
  
                  diagnose("retrieving revision %s",rev1);
                  sprintf(command,"%s/co -q -p%s %s > %s\n",

--- 115,122 -----
                  if (!(target=genrevs(numericrev,nil,nil,nil,gendeltas))) goto end;
                  rev2=target->num;
  
!                 temp1file=mktempfile(TMPDIR,TMPFILE1);
!                 temp2file=mktempfile(TMPDIR,TMPFILE2);
  
                  diagnose("retrieving revision %s",rev1);
                  sprintf(command,"%s/co -q -p%s %s > %s\n",
RCS file: RCS/rcsutil.c,v
retrieving revision 3.8
retrieving revision 3.10
diff -c -r3.8 -r3.10
*** /tmp/,RCSt1002098	Sat Feb  1 11:37:53 1986
--- /tmp/,RCSt2002098	Sat Feb  1 11:37:55 1986
***************
*** 2,8
   *                     RCS utilities
   */
   static char rcsid[]=
!  "$Header: rcsutil.c,v 3.8 83/02/15 15:41:49 wft Exp $ Purdue CS";
  /*****************************************************************************
   *****************************************************************************
   *

--- 2,8 -----
   *                     RCS utilities
   */
   static char rcsid[]=
!  "$Header: rcsutil.c,v 3.10 86/01/21 22:03:59 mann Exp $ Purdue CS";
  /*****************************************************************************
   *****************************************************************************
   *
***************
*** 20,25
  
  
  /* $Log:	rcsutil.c,v $
   * Revision 3.8  83/02/15  15:41:49  wft
   * *** empty log message ***
   * 

--- 20,31 -----
  
  
  /* $Log:	rcsutil.c,v $
+  * Revision 3.10  86/01/21  22:03:59  mann
+  * small bugfix in WorkPerms
+  * 
+  * Revision 3.9  86/01/21  20:17:40  mann
+  * Ported to V
+  * 
   * Revision 3.8  83/02/15  15:41:49  wft
   * *** empty log message ***
   * 
***************
*** 164,169
                  next=next->nextaccess;
          } while (next!=nil);
  
          fstat(fileno(finptr),&statbuf);  /* get owner of file */
          if (getuid() == statbuf.st_uid) return true;
  

--- 170,178 -----
                  next=next->nextaccess;
          } while (next!=nil);
  
+ #ifdef Vsystem
+ 	/* %%% ignore this case for now */
+ #else
          fstat(fileno(finptr),&statbuf);  /* get owner of file */
          if (getuid() == statbuf.st_uid) return true;
  #endif Vsystem
***************
*** 166,171
  
          fstat(fileno(finptr),&statbuf);  /* get owner of file */
          if (getuid() == statbuf.st_uid) return true;
  
          error("User %s not on the access list",who);
          return false;

--- 175,181 -----
  #else
          fstat(fileno(finptr),&statbuf);  /* get owner of file */
          if (getuid() == statbuf.st_uid) return true;
+ #endif Vsystem
  
          error("User %s not on the access list",who);
          return false;
***************
*** 171,176
          return false;
  }
  
  void catchsig(sig)
  {
  	signal(sig, SIG_IGN);

--- 181,232 -----
          return false;
  }
  
+ #ifdef Vsystem
+ ProcessId WorkPid;
+ int ReturnValue;
+ int RootStackSize = 2000;
+ 
+ /* We arrange to be able to catch ^C and clean up
+  *  by having all the work done in a son of the team root
+  *  process, with the son also set to be the break process.
+  *  Thus when the son exits the root regains control and
+  *  can clean up if necessary.
+  */
+ #undef main
+ 
+ main(argc, argv)
+   int argc;
+   char **argv;
+   {
+     int WorkProc();
+     MsgStruct msg;
+     
+     DefineTempArea();	/* define [tmp] */
+ 
+     WorkPid = Create(3, WorkProc, 4000);
+     Ready(WorkPid, 2, argc, argv);
+     ReceiveSpecific(&msg, WorkPid);
+ 
+     if (WorkPid == 0)
+         exit(ReturnValue);
+     else
+       {
+         diagnose("\nRCS: cleaning up\n");
+         cleanup();
+         exit(1);
+       }
+   }
+ 
+ WorkProc(argc, argv)
+   int argc;
+   char **argv;
+   {
+     ReturnValue = main_(argc, argv);
+     WorkPid = 0;	/* indicate we finished up okay */
+   }
+ 
+ #else	/* UNIX */
+ 
  void catchsig(sig)
  {
  	signal(sig, SIG_IGN);
***************
*** 178,183
          cleanup();
          exit(1);
  }
  
  void catchints()
  {

--- 234,240 -----
          cleanup();
          exit(1);
  }
+ #endif Vsystem
  
  void catchints()
  {
***************
*** 181,186
  
  void catchints()
  {
          signal(SIGINT,catchsig); signal(SIGHUP,catchsig);
          signal(SIGQUIT,catchsig); signal(SIGPIPE,catchsig);
  	signal(SIGTERM,catchsig);

--- 238,246 -----
  
  void catchints()
  {
+ #ifdef Vsystem
+ 	if (Interactive(stdin)) SetBreakProcess(stdin, WorkPid);
+ #else
          signal(SIGINT,catchsig); signal(SIGHUP,catchsig);
          signal(SIGQUIT,catchsig); signal(SIGPIPE,catchsig);
  	signal(SIGTERM,catchsig);
***************
*** 184,189
          signal(SIGINT,catchsig); signal(SIGHUP,catchsig);
          signal(SIGQUIT,catchsig); signal(SIGPIPE,catchsig);
  	signal(SIGTERM,catchsig);
  }
  
  void ignoreints()

--- 244,250 -----
          signal(SIGINT,catchsig); signal(SIGHUP,catchsig);
          signal(SIGQUIT,catchsig); signal(SIGPIPE,catchsig);
  	signal(SIGTERM,catchsig);
+ #endif Vsystem
  }
  
  void ignoreints()
***************
*** 188,193
  
  void ignoreints()
  {
          signal(SIGINT,SIG_IGN); signal(SIGHUP,SIG_IGN);
          signal(SIGQUIT,SIG_IGN); signal(SIGPIPE,SIG_IGN);
  	signal(SIGTERM,SIG_IGN);

--- 249,257 -----
  
  void ignoreints()
  {
+ #ifdef Vsystem
+ 	if (Interactive(stdin)) SetBreakProcess(stdin, 0);
+ #else
          signal(SIGINT,SIG_IGN); signal(SIGHUP,SIG_IGN);
          signal(SIGQUIT,SIG_IGN); signal(SIGPIPE,SIG_IGN);
  	signal(SIGTERM,SIG_IGN);
***************
*** 191,196
          signal(SIGINT,SIG_IGN); signal(SIGHUP,SIG_IGN);
          signal(SIGQUIT,SIG_IGN); signal(SIGPIPE,SIG_IGN);
  	signal(SIGTERM,SIG_IGN);
  }
  
  

--- 255,261 -----
          signal(SIGINT,SIG_IGN); signal(SIGHUP,SIG_IGN);
          signal(SIGQUIT,SIG_IGN); signal(SIGPIPE,SIG_IGN);
  	signal(SIGTERM,SIG_IGN);
+ #endif Vsystem
  }
  
  
***************
*** 196,201
  
  fastcopy(inf,outf)
  FILE * inf, * outf;
  /* Function: copies the remainder of file inf to outf. First copies the
   * rest that is in the IO-buffer of inf character by character, and then
   * copies the remainder in blocks.

--- 261,294 -----
  
  fastcopy(inf,outf)
  FILE * inf, * outf;
+ #ifdef Vsystem
+ /* Function: copies the remainder of file inf to outf. Tries to go
+  * fast without being too dirty.
+  */
+ {	register char *buffer;
+ 	register SystemCode r;
+ 	register int bytes, blocksize, c;
+ 
+ #ifdef BRAVE
+ 	while (!BufferEmpty(inf)) putc(getc(inf), outf);
+ 	blocksize = BlockSize(inf);
+ 	SeekBlock(BytePosition(inf)/blocksize);	/* normalize block posn */
+ 	buffer = malloc(BlockSize(inf));
+ 	do
+ 	  {
+ 	    bytes = Read(inf, buffer, blocksize);
+ 	    fwrite(buffer, blocksize, 1, outf);
+ 	  }
+ 	while ( (r = Eof(outf)) == OK && (r = FileException(inf)) == OK );
+ 
+ 	free(buffer);
+ 	if (r != END_OF_FILE)
+ 	    faterror("i/o error in fastcopy");
+ #else
+ 	while ( (c = getc(inf)) != EOF ) putc(c, outf);
+ #endif BRAVE
+ }
+ #else
  /* Function: copies the remainder of file inf to outf. First copies the
   * rest that is in the IO-buffer of inf character by character, and then
   * copies the remainder in blocks.
***************
*** 217,222
                  }
          }
  }
  
  
  

--- 310,316 -----
                  }
          }
  }
+ #endif
  
  
  
***************
*** 222,228
  
  
  
- 
  #ifdef SNOOPFILE
  
  #include "time.h"

--- 316,321 -----
  
  
  
  #ifdef SNOOPFILE
  
  #include "time.h"
***************
*** 264,267
                  curdate,login,getfullRCSname());
          system(command);
  }
  #endif

--- 357,493 -----
                  curdate,login,getfullRCSname());
          system(command);
  }
+ #endif
+ 
+ 
+ #ifdef Vsystem
+ #include <Vio.h>
+ 
+ #ifndef R_OK
+ #define R_OK 4
+ #define W_OK 2
+ #define X_OK 1
+ #define F_OK 0
+ #endif R_OK
+ 
+ access(name, mode)
+   {
+     File *fad;
+     SystemCode error;
+     int vmode, ret;
+ 
+     vmode = (mode & W_OK) ? FAPPEND : FREAD;
+     
+     fad = Open(name, vmode, &error);
+     if (error != OK)
+       {
+         if (mode == F_OK && error == NO_PERMISSION)
+ 	  return 0;
+ 	else
+ 	  return -1;
+       }
+ 
+     ret = 0;
+ 
+     if ( (mode & (R_OK|X_OK)) && !(fad->type & READABLE) ) ret = -1;
+     if ( (mode & W_OK) && !(fad->type & WRITEABLE) ) ret = -1;
+ 
+     Close(fad);
+     return ret;
+   }
+ 
+ 
+ /*
+  * Copy permissions from indesc to outdesc
+  */
+ SystemCode CopyPerms(outdesc, indesc)
+   register ArbitraryDescriptor *indesc, *outdesc;
+   {
+     if (indesc->e.descriptortype != outdesc->e.descriptortype)
+       return BAD_ARGS;
+ 
+     switch (indesc->e.descriptortype)
+       {
+ 	case FILE_DESCRIPTOR:
+ 	  if (outdesc->f.perms == indesc->f.perms) return OK;
+ 	  outdesc->f.perms = indesc->f.perms;
+ 	  break;
+ 
+ 	case UNIXFILE_DESCRIPTOR:
+ 	  if (outdesc->u.st_mode == indesc->u.st_mode) return OK;
+ 	  outdesc->u.st_mode = indesc->u.st_mode;
+ 	  break;
+ 
+ 	default:
+ 	  return BAD_ARGS;
+       }
+ 
+     return OK;
+   }
+ 
+ 
+ /* Modify perms in desc to turn off all write permission */
+ #include <Vstorage.h>
+ SystemCode NoWrite(desc)
+   register ArbitraryDescriptor *desc;
+   {
+     switch (desc->e.descriptortype)
+       {
+ 	case FILE_DESCRIPTOR:
+ 	  desc->f.perms &= ~(SS_WRITE + (SS_WRITE<<5) + (SS_WRITE<<10));
+ 	  break;
+ 
+ 	case UNIXFILE_DESCRIPTOR:
+ 	  desc->u.st_mode &= ~0222;
+ 	  break;
+ 
+ 	default:
+ 	  return BAD_ARGS;
+       }
+     return OK;
+   }
+ 
+ 
+ /* Modify perms in desc to be appropriate for a working file */
+ SystemCode WorkPerms(desc, owneraccess)
+   register ArbitraryDescriptor *desc;
+   {
+     switch (desc->e.descriptortype)
+       {
+ 	case FILE_DESCRIPTOR:
+ 	  desc->f.perms &= ~(SS_WRITE + (SS_WRITE<<5) + (SS_WRITE<<10));
+ 	  if (owneraccess) desc->f.perms |= SS_WRITE + SS_READ;
+ 	  break;
+ 
+ 	case UNIXFILE_DESCRIPTOR:
+ 	  desc->u.st_mode &= ~0222;
+ 	  if (owneraccess) desc->u.st_mode |= 0600;
+ 	  break;
+ 
+ 	default:
+ 	  return BAD_ARGS;
+       }
+     return OK;
+   }
+ 
+ 
+ /* Return 1 if permissions allow writing, 0 otherwise */
+ #include <Vstorage.h>
+ IsWriteable(desc)
+   register ArbitraryDescriptor *desc;
+   {
+     switch (desc->e.descriptortype)
+       {
+ 	case FILE_DESCRIPTOR:
+ 	  return (desc->f.perms & (SS_WRITE + (SS_WRITE<<5) +
+ 			(SS_WRITE<<10))) != 0;
+ 
+ 	case UNIXFILE_DESCRIPTOR:
+ 	  return (desc->u.st_mode & 0222) != 0;
+ 
+ 	default:
+ 	  return BAD_ARGS;
+       }
+   }
+ 
  #endif
RCS file: RCS/rlog.c,v
retrieving revision 3.7
retrieving revision 3.8
diff -c -r3.7 -r3.8
*** /tmp/,RCSt1002112	Sat Feb  1 11:38:27 1986
--- /tmp/,RCSt2002112	Sat Feb  1 11:38:32 1986
***************
*** 2,8
   *                       RLOG    operation
   */
  static char rcsid[]=
! "$Header: rlog.c,v 3.7 83/05/11 14:24:13 wft Exp $ Purdue CS";
  /*****************************************************************************
   *                       print contents of RCS files
   *****************************************************************************

--- 2,8 -----
   *                       RLOG    operation
   */
  static char rcsid[]=
! "$Header: rlog.c,v 3.8 86/01/21 20:32:17 mann Exp $ Purdue CS";
  /*****************************************************************************
   *                       print contents of RCS files
   *****************************************************************************
***************
*** 20,25
  
  
  /* $Log:	rlog.c,v $
   * Revision 3.7  83/05/11  14:24:13  wft
   * *** empty log message ***
   * 

--- 20,28 -----
  
  
  /* $Log:	rlog.c,v $
+  * Revision 3.8  86/01/21  20:32:17  mann
+  * Ported to V
+  * 
   * Revision 3.7  83/05/11  14:24:13  wft
   * *** empty log message ***
   * 
***************
*** 157,163
          statelist = nil;
          Revlst = revlist = nil;
          duelst = datelist = nil;
!         caller=getpwuid(getuid())->pw_name;
  
          while (--argc,++argv, argc>=1 && ((*argv)[0] == '-')) {
                  switch ((*argv)[1]) {

--- 160,166 -----
          statelist = nil;
          Revlst = revlist = nil;
          duelst = datelist = nil;
!         caller=UserName(0);
  
          while (--argc,++argv, argc>=1 && ((*argv)[0] == '-')) {
                  switch ((*argv)[1]) {
