home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 1 / 1937 / patches.os2 < prev    next >
Encoding:
Text File  |  1990-12-28  |  55.5 KB  |  1,893 lines

  1. Only in rcs43-2: readme.os2
  2. Only in rcs43-2: patches.os2
  3. Only in rcs43-2/src: makefile.msc
  4. Only in rcs43-2/src: ci.cs
  5. Only in rcs43-2/src: ci.def
  6. Only in rcs43-2/src: co.cs
  7. Only in rcs43-2/src: co.def
  8. Only in rcs43-2/src: ident.cs
  9. Only in rcs43-2/src: ident.def
  10. Only in rcs43-2/src: rcs.cs
  11. Only in rcs43-2/src: rcs.def
  12. Only in rcs43-2/src: rcsclean.cs
  13. Only in rcs43-2/src: rcsclean.def
  14. Only in rcs43-2/src: rcsdiff.cs
  15. Only in rcs43-2/src: rcsdiff.def
  16. Only in rcs43-2/src: rcsmerge.cs
  17. Only in rcs43-2/src: rcsmerge.def
  18. Only in rcs43-2/src: rlog.cs
  19. Only in rcs43-2/src: rlog.def
  20. diff -cbBwr rcs43/src/ci.c rcs43-2/src/ci.c
  21. *** rcs43/src/ci.c    Wed Sep 19 19:02:52 1990
  22. --- rcs43-2/src/ci.c    Fri Sep 21 15:11:44 1990
  23. ***************
  24. *** 179,184 ****
  25. --- 179,190 ----
  26.  
  27.   char * newRCSfilename, * diffilename;
  28.   char * RCSfilename,*workfilename,*expfilename,*newworkfilename;
  29. +
  30. + #ifdef MSDOS
  31. + char tmpdir[NCPPN];
  32. + extern char *gettmpdir();
  33. + #endif /* MSDOS */
  34. +
  35.   extern struct stat RCSstat, workstat; /* file status of RCS and work file   */
  36.   extern int  haveRCSstat, haveworkstat;/* status indicators                  */
  37.  
  38. ***************
  39. *** 358,363 ****
  40. --- 364,372 ----
  41.                   faterror("Can't take both log and description from redirected stdin; use -ttextfile");
  42.           }
  43.           /* now handle all filenames */
  44. + #ifdef MSDOS
  45. +     strcpy( tmpdir, gettmpdir());
  46. + #endif /* MSDOS */
  47.           do {
  48.           gendeltas[0] = nil;
  49.           copyflag=rewriteflag=false;
  50. ***************
  51. *** 486,503 ****
  52. --- 495,532 ----
  53.                   if(!putdtext(newdelnum,newdelta.log,workfilename,frewrite)) continue;
  54.                   ffclose(frewrite); frewrite=NULL;
  55.           } else {
  56. + #ifdef MSDOS
  57. +                 diffilename=mktempfile(tmpdir,DIFFILE);
  58. + #else
  59.                   diffilename=mktempfile("/tmp/",DIFFILE);
  60. + #endif /* MSDOS */
  61.                   if (&newdelta==Head) {
  62.                           /* prepend new one */
  63.                           rewriteflag=false;
  64.                           if (!(expfilename=
  65. + #ifdef MSDOS
  66. +                               buildrevision(gendeltas,targetdelta,tmpdir,false))) continue;
  67. + #else
  68.                                 buildrevision(gendeltas,targetdelta,"/tmp/",false))) continue;
  69. + #endif /* MSDOS */
  70.                           if (!mustcheckin(expfilename,targetdelta)) continue;
  71.                                   /* don't check in files that aren't different, unless forced*/
  72.                           newdelta.log=getlogmsg();
  73.                           exit_stats = run((char*)nil, diffilename,
  74. + #ifdef MSDOS
  75. + #    ifdef GNUDIFF
  76. +                 DIFF,"-a","-n",workfilename,expfilename, (char*)nil);
  77. + #    elif MKS
  78. +                 DIFF,"-n",workfilename,expfilename, (char*)nil);
  79. + #    endif
  80. + #else
  81.                   DIFF,"-n",workfilename,expfilename, (char*)nil);
  82. + #endif /* MSDOS */
  83. + #ifdef MSDOS
  84. +                         if (exit_stats != 0 && exit_stats != 1 )
  85. + #else
  86.                           if (exit_stats != 0 && exit_stats != (1 << BYTESIZ))
  87. + #endif /* MSDOS */
  88.                               faterror ("diff failed");
  89.                           /* diff returns 2 in the upper byte on failure */
  90.                           if(!putdtext(newdelnum,newdelta.log,workfilename,frewrite)) continue;
  91. ***************
  92. *** 506,518 ****
  93. --- 535,563 ----
  94.                           /* insert new delta text */
  95.                           rewriteflag=true;
  96.                           if (!(expfilename=
  97. + #ifdef MSDOS
  98. +                               buildrevision(gendeltas,targetdelta,tmpdir,false))) continue;
  99. + #else
  100.                                 buildrevision(gendeltas,targetdelta,"/tmp/",false))) continue;
  101. + #endif /* MSDOS */
  102.                           if (!mustcheckin(expfilename,targetdelta)) continue;
  103.                                   /* don't check in files that aren't different, unless forced*/
  104.                           newdelta.log=getlogmsg();
  105.                           exit_stats = run((char*)nil, diffilename,
  106. + #ifdef MSDOS
  107. + #ifdef GNUDIFF
  108. +                 DIFF,"-a","-n",expfilename,workfilename, (char*)nil);
  109. + #    elif MKS
  110. +                 DIFF,"-n",expfilename,workfilename, (char*)nil);
  111. + #    endif
  112. + #else
  113.                   DIFF,"-n",expfilename,workfilename, (char*)nil);
  114. + #endif /* MSDOS */
  115. + #ifdef MSDOS
  116. +                         if (exit_stats != 0 && exit_stats != 1 )
  117. + #else
  118.                           if (exit_stats != 0 && exit_stats != (1 << BYTESIZ))
  119. + #endif /* MSDOS */
  120.                               faterror ("diff failed");
  121.                           if(!putdtext(newdelnum,newdelta.log,diffilename,frewrite)) continue;
  122.                   }
  123. ***************
  124. *** 520,528 ****
  125. --- 565,578 ----
  126.                   /* rewrite rest of RCS file */
  127.                   fastcopy(finptr,frewrite);
  128.                   ffclose(frewrite); frewrite=NULL;
  129. +                 ffclose(finptr);   finptr=NULL;
  130.           }
  131.       ignoreints();
  132. + #ifdef MSDOS
  133. +         if (Rename(newRCSfilename,RCSfilename)<0) {
  134. + #else
  135.           if (rename(newRCSfilename,RCSfilename)<0) {
  136. + #endif /* MSDOS */
  137.                   error("Can't write new RCS file %s; saved in %s",
  138.                         RCSfilename,newRCSfilename);
  139.                   newRCSfilename[0]='\0'; /* avoid deletion by cleanup*/
  140. ***************
  141. *** 532,538 ****
  142. --- 582,592 ----
  143.           }
  144.           newRCSfilename[0]='\0'; /* avoid re-unlinking by cleanup()*/
  145.  
  146. + #ifdef MSDOS
  147. +     newRCSmode= (initflag|rcsinitflag?workstat.st_mode:RCSstat.st_mode)& ~S_IWRITE;
  148. + #else
  149.       newRCSmode= (initflag|rcsinitflag?workstat.st_mode:RCSstat.st_mode)& ~0222;
  150. + #endif /* MSDOS */
  151.       /* newRCSmode is also used to adjust mode of working file for -u and -l */
  152.       if (chmod(RCSfilename,newRCSmode)<0)
  153.                   warn("Can't set mode of %s",RCSfilename);
  154. ***************
  155. *** 550,556 ****
  156. --- 604,614 ----
  157.                   xpandfile(workfilename,workfilename /*for directory*/,&newdelta);
  158.                   if (!newworkfilename) continue; /* expand failed */
  159.           ignoreints();
  160. + #ifdef MSDOS
  161. +         if (Rename(newworkfilename,workfilename) <0) {
  162. + #else
  163.           if (rename(newworkfilename,workfilename) <0) {
  164. + #endif /* MSDOS */
  165.                       error("Can't expand keywords in %s",workfilename);
  166.                       restoreints();
  167.                       continue;
  168. ***************
  169. *** 628,634 ****
  170. --- 686,696 ----
  171.                   } else {
  172.                       /* no existing lock; try Dbranch */
  173.                       /* update newdelnum */
  174. + #ifdef MSDOS
  175. +                     if (!(StrictLocks==false) ) {
  176. + #else
  177.                       if (!((StrictLocks==false) && (getuid() == RCSstat.st_uid))) {
  178. + #endif /* MSDOS */
  179.                           error("no lock set by %s",caller);
  180.                           return false;
  181.                       }
  182. ***************
  183. *** 797,803 ****
  184. --- 859,869 ----
  185.                   next->delta->lockedby=nil; /* reset locked-by */
  186.                   return next->delta;
  187.           } else {
  188. + #ifdef MSDOS
  189. +                 if (!(StrictLocks==false) ) {
  190. + #else
  191.                   if (!((StrictLocks==false) && (getuid() == RCSstat.st_uid))) {
  192. + #endif /* MSDOS */
  193.                       error("no lock set by %s for revision %s",who,num);
  194.                       return nil;
  195.                   } else {
  196. ***************
  197. *** 945,951 ****
  198. --- 1011,1021 ----
  199.  
  200.           /* now read string from stdin */
  201.           if (ttystdin()) {
  202. + #ifdef MSDOS
  203. +                 VOID fputs("enter log message:\n(terminate with ^Z or single '.')\n>> ",stderr);
  204. + #else
  205.                   VOID fputs("enter log message:\n(terminate with ^D or single '.')\n>> ",stderr);
  206. + #endif /* MSDOS */
  207.           } else {  /* redirected stdin */
  208.                   if (stdinread>0)
  209.                       faterror("Can't reread redirected stdin for log message; use -m");
  210. diff -cbBwr rcs43/src/co.c rcs43-2/src/co.c
  211. *** rcs43/src/co.c    Wed Sep 19 19:02:52 1990
  212. --- rcs43-2/src/co.c    Fri Sep 21 15:37:56 1990
  213. ***************
  214. *** 152,157 ****
  215. --- 152,161 ----
  216.  
  217.   char * newRCSfilename, * neworkfilename;
  218.   char * RCSfilename, * workfilename;
  219. + #ifdef MSDOS
  220. + char tmpdir[NCPPN];
  221. + char *gettmpdir();
  222. + #endif /* MSDOS */
  223.   extern struct stat RCSstat, workstat; /* file status of RCS and work file   */
  224.   extern int  haveRCSstat, haveworkstat;/* status indicators                  */
  225.  
  226. ***************
  227. *** 242,252 ****
  228. --- 246,260 ----
  229.                           break;
  230.  
  231.                   case 'j':
  232. + #ifdef MSDOS /* Current Version can't treat join */
  233. +             faterror("Current Version can't treat join");
  234. + #else
  235.                           if ((*argv)[2]!='\0'){
  236.                                   if (join!=nil)warn("Redefinition of -j option");
  237.                                   join = (*argv)+2;
  238.                           }
  239.                           break;
  240. + #endif /* MSDOS */
  241.  
  242.                   case 's':
  243.                           if ((*argv)[2]!='\0'){
  244. ***************
  245. *** 270,275 ****
  246. --- 278,286 ----
  247.  
  248.           if (argc<1) faterror("No input file\n%s",cmdusage);
  249.  
  250. + #ifdef MSDOS
  251. +     strcpy( tmpdir, gettmpdir() );
  252. + #endif /* MSDOS */
  253.           /* now handle all filenames */
  254.           do {
  255.           rewriteflag=false;
  256. ***************
  257. *** 353,359 ****
  258. --- 364,374 ----
  259.                   getdesc(false); /* don't echo*/
  260.  
  261.                   if (!(neworkfilename=buildrevision(gendeltas,targetdelta,
  262. + #ifdef MSDOS
  263. +                       tostdout?(join!=nil? tmpdir:(char *)nil):workfilename,true)))
  264. + #else
  265.                         tostdout?(join!=nil?"/tmp/":(char *)nil):workfilename,true)))
  266. + #endif /* MSDOS */
  267.                                   continue;
  268.  
  269.                   if ((lockflag||killock==1)&&nerror==0) {
  270. ***************
  271. *** 360,367 ****
  272. --- 375,387 ----
  273.                           /* rewrite the rest of the RCSfile */
  274.                           fastcopy(finptr,frewrite);
  275.                           ffclose(frewrite); frewrite=NULL;
  276. +                         ffclose(finptr);   finptr=NULL;
  277.               ignoreints();
  278. + #ifdef MSDOS
  279. +                         if (Rename(newRCSfilename,RCSfilename) != 0 ) {
  280. + #else
  281.                           if (rename(newRCSfilename,RCSfilename)<0) {
  282. + #endif /* MSDOS */
  283.                                   error("Can't rewrite %s; saved in: %s",
  284.                                   RCSfilename, newRCSfilename);
  285.                                   newRCSfilename[0]='\0'; /* avoid deletion*/
  286. ***************
  287. *** 369,375 ****
  288. --- 389,399 ----
  289.                                   break;
  290.                           }
  291.                           newRCSfilename[0]='\0'; /* avoid re-deletion by cleanup()*/
  292. + #ifdef MSDOS
  293. +                         if (chmod(RCSfilename,RCSstat.st_mode & ~S_IWRITE)<0)
  294. + #else
  295.                           if (chmod(RCSfilename,RCSstat.st_mode & ~0222)<0)
  296. + #endif /* MSDOS */
  297.                               warn("Can't preserve mode of %s",RCSfilename);
  298.                           restoreints();
  299.                   }
  300. ***************
  301. *** 383,389 ****
  302. --- 407,417 ----
  303.               if (!buildjoin(neworkfilename)) continue;
  304.                   }
  305.                   if (!tostdout) {
  306. + #ifdef MSDOS
  307. +             if (Rename(neworkfilename,workfilename) <0) {
  308. + #else
  309.               if (rename(neworkfilename,workfilename) <0) {
  310. + #endif /* MSDOS */
  311.                                   error("Can't create %s; see %s",workfilename,neworkfilename);
  312.                                   neworkfilename[0]= '\0'; /*avoid deletion*/
  313.                                   continue;
  314. ***************
  315. *** 423,429 ****
  316. --- 451,461 ----
  317.           if (haveworkstat< 0)      /* File doesn't exist; set by pairfilenames*/
  318.               return (true);        /* No problem */
  319.  
  320. + #ifdef MSDOS
  321. +     if ((workstat.st_mode & S_IWRITE)&&!forceflag) {    /* File is writable */
  322. + #else
  323.       if ((workstat.st_mode & 0222)&&!forceflag) {    /* File is writable */
  324. + #endif /* MSDOS */
  325.               if (!quietflag) {
  326.                   VOID fprintf(stderr,"writable %s exists; overwrite? [ny](n): ",workfilename);
  327.                   /* must be stderr in case of IO redirect */
  328. ***************
  329. *** 612,619 ****
  330. --- 644,656 ----
  331.           char * rev2, * rev3;
  332.           int i;
  333.  
  334. + #ifdef MSDOS
  335. +         rev2=mktempfile(tmpdir,JOINFIL2);
  336. +         rev3=mktempfile(tmpdir,JOINFIL3);
  337. + #else
  338.           rev2=mktempfile("/tmp/",JOINFIL2);
  339.           rev3=mktempfile("/tmp/",JOINFIL3);
  340. + #endif /* MSDOS */
  341.  
  342.           i=0;
  343.           while (i<lastjoin) {
  344. diff -cbBwr rcs43/src/ident.c rcs43-2/src/ident.c
  345. *** rcs43/src/ident.c    Wed Sep 19 19:02:56 1990
  346. --- rcs43-2/src/ident.c    Fri Sep 21 15:07:46 1990
  347. ***************
  348. *** 104,110 ****
  349. --- 104,114 ----
  350.      }
  351.  
  352.      while ( --argc > 0 ) {
  353. + #ifdef MSDOS
  354. +       if ( (fp = fopen(*++argv, "rb") ) == NULL ) {
  355. + #else
  356.         if ( (fp = fopen(*++argv, "r") ) == NULL ) {
  357. + #endif
  358.            VOID fprintf(stderr,  "ident error: can't open %s\n", *argv);
  359.            continue;
  360.         } else {
  361. diff -cbBwr rcs43/src/partime.c rcs43-2/src/partime.c
  362. *** rcs43/src/partime.c    Wed Sep 19 19:02:52 1990
  363. --- rcs43-2/src/partime.c    Fri Sep 21 15:11:46 1990
  364. ***************
  365. *** 468,474 ****
  366.   {    register char *cp, *mp;
  367.       register int c;
  368.       struct tmwent *lastptr;
  369. !     struct integ { int word; };   /* For getting at array ptr */
  370.       int i;
  371.  
  372.       lastptr = 0;
  373. --- 468,474 ----
  374.   {    register char *cp, *mp;
  375.       register int c;
  376.       struct tmwent *lastptr;
  377. !     struct integ { long word; };   /* For getting at array ptr */
  378.       int i;
  379.  
  380.       lastptr = 0;
  381. diff -cbBwr rcs43/src/rcs.c rcs43-2/src/rcs.c
  382. *** rcs43/src/rcs.c    Wed Sep 19 19:02:54 1990
  383. --- rcs43-2/src/rcs.c    Fri Sep 21 15:11:50 1990
  384. ***************
  385. *** 192,197 ****
  386. --- 192,202 ----
  387.   struct  access  *curaccess,  *rmaccess;
  388.   struct  hshentry        * gendeltas[hshsize];
  389.  
  390. + #ifdef MSDOS
  391. + extern char *gettmpdir();
  392. + char    tmpdir[NCPPN];
  393. + #endif /* MSDOS */
  394. +
  395.   struct  Lockrev {
  396.           char    * revno;
  397.           struct  Lockrev   * nextrev;
  398. ***************
  399. *** 449,455 ****
  400.               diagnose("%s aborted",cmdid);
  401.               exit(1);
  402.           }
  403. !
  404.           /* now handle all filenames */
  405.           do {
  406.           rewriteflag = false;
  407. --- 454,462 ----
  408.               diagnose("%s aborted",cmdid);
  409.               exit(1);
  410.           }
  411. ! #ifdef MSDOS
  412. !     strcpy( tmpdir, gettmpdir() );
  413. ! #endif /* MSDOS */
  414.           /* now handle all filenames */
  415.           do {
  416.           rewriteflag = false;
  417. ***************
  418. *** 557,564 ****
  419. --- 564,576 ----
  420.  
  421.  
  422.           /* prepare for rewriting the RCS file */
  423. + #ifdef MSDOS
  424. +         newRCSfilename=mktempfile(RCSfilename,NEWRCSFILE);
  425. +         oldumask = umask(S_IWRITE); /* turn off write bits */
  426. + #else
  427.           newRCSfilename=mktempfile(RCSfilename,NEWRCSFILE);
  428.           oldumask = umask(0222); /* turn off write bits */
  429. + #endif /* MSDOS */
  430.           if ((frewrite=fopen(newRCSfilename, "w"))==NULL) {
  431.                   VOID fclose(finptr);
  432.                   error("Can't open file %s",newRCSfilename);
  433. ***************
  434. *** 584,592 ****
  435. --- 596,609 ----
  436.               }
  437.           }
  438.           ffclose(frewrite);   frewrite = NULL;
  439. +         ffclose(finptr);     finptr=NULL;
  440.           if ( ! nerror ) {  /*  move temporary file to RCS file if no error */
  441.           ignoreints();        /* ignore interrupts */
  442. + #ifdef MSDOS
  443. +             if(Rename(newRCSfilename,RCSfilename)<0) {
  444. + #else
  445.               if(rename(newRCSfilename,RCSfilename)<0) {
  446. + #endif /* MSDOS */
  447.                   error("Can't create RCS file %s; saved in %s",
  448.                      RCSfilename, newRCSfilename);
  449.                   newRCSfilename[0] = '\0';  /*  avoid deletion by cleanup  */
  450. ***************
  451. *** 1022,1028 ****
  452. --- 1039,1049 ----
  453.           if (response=='\n'||response=='n'||response=='N') return false;
  454.  
  455.           /* go ahead with breaking  */
  456. + #ifdef MSDOS
  457. +         messagefile=mktempfile( tmpdir, "mmXXXXXX");
  458. + #else
  459.           messagefile=mktempfile("/tmp/", "RCSmailXXXXXX");
  460. + #endif /* MSDOS */
  461.           if ( (mailmess = fopen(messagefile, "w")) == NULL) {
  462.               faterror("Can't open file %s", messagefile);
  463.           }
  464. ***************
  465. *** 1490,1500 ****
  466. --- 1511,1529 ----
  467.           int  i, c, exit_stats;
  468.  
  469.           cuttail->selector = DELETE;
  470. + #ifdef MSDOS
  471. +         initeditfiles( tmpdir );
  472. + #else
  473.           initeditfiles("/tmp/");
  474. + #endif /* MSDOS */
  475.           scanlogtext(deltas[0], copy);
  476.           i = 1;
  477.           if ( cuthead )  {
  478. + #ifdef MSDOS
  479. +             cutfilename=mktempfile( tmpdir, "ctXXXXXX");
  480. + #else
  481.               cutfilename=mktempfile("/tmp/", "RCScutXXXXXX");
  482. + #endif /* MSDOS */
  483.               if ( (fcut = fopen(cutfilename, "w")) == NULL) {
  484.                   faterror("Can't open temporary file %s", cutfilename);
  485.               }
  486. ***************
  487. *** 1514,1523 ****
  488. --- 1543,1568 ----
  489.           finishedit((struct hshentry *)nil);    ffclose(fcopy);
  490.  
  491.           if ( cuthead ) {
  492. + #ifdef MSDOS
  493. +             diffilename=mktempfile( tmpdir, "dfXXXXXX");
  494. + #else
  495.               diffilename=mktempfile("/tmp/", "RCSdifXXXXXX");
  496. + #endif /* MSDOS */
  497.               exit_stats = run((char*)nil,diffilename,
  498. + #ifdef MSDOS
  499. + #    ifdef GNUDIFF
  500. +             DIFF,"-n","-a",cutfilename,resultfile,(char*)nil);
  501. + #    elif MKS
  502. +             DIFF,"-n",cutfilename,resultfile,(char*)nil);
  503. + #    endif
  504. + #else
  505.               DIFF,"-n",cutfilename,resultfile,(char*)nil);
  506. + #endif /* MSDOS */
  507. + #ifdef MSDOS
  508. +             if (exit_stats != 0 && exit_stats != 1 )
  509. + #else
  510.               if (exit_stats != 0 && exit_stats != (1 << BYTESIZ))
  511. + #endif /* MSDOS */
  512.                   faterror ("diff failed");
  513.               if(!putdtext(cuttail->num,curlogmsg,diffilename,frewrite)) return;
  514.           }
  515. diff -cbBwr rcs43/src/rcsbase.h rcs43-2/src/rcsbase.h
  516. *** rcs43/src/rcsbase.h    Wed Sep 19 19:02:54 1990
  517. --- rcs43-2/src/rcsbase.h    Fri Sep 21 15:17:16 1990
  518. ***************
  519. *** 127,132 ****
  520. --- 127,135 ----
  521.  
  522.  
  523.   #include <stdio.h>
  524. + #ifdef MKS
  525. + #define STREQ(a,b)    ( strcmp( (a), (b) ) == 0 )
  526. + #endif
  527.   #ifdef USG
  528.   #include <string.h>
  529.   #else
  530. ***************
  531. *** 137,143 ****
  532. --- 140,150 ----
  533.  
  534.   #ifdef USG
  535.   #       define rindex    strrchr
  536. + #ifdef MSDOS
  537. + #       define DATEFORM  "%02d.%02d.%02d.%02d.%02d.%02d"
  538. + #else
  539.   #       define DATEFORM  "%.2d.%.2d.%.2d.%.2d.%.2d.%.2d"
  540. + #endif
  541.   #else
  542.   #       define DATEFORM  "%02d.%02d.%02d.%02d.%02d.%02d"
  543.   #endif
  544. ***************
  545. *** 175,182 ****
  546. --- 182,194 ----
  547.   #define datelength         20 /* length of a date in RCS format             */
  548.   #define joinlength         20 /* number of joined revisions permitted       */
  549.   #define RCSDIR         "RCS/" /* subdirectory for RCS files                 */
  550. + #ifdef MSDOS        /* Added by $Author: lfk $ */
  551. + #define RCSSUF            '\0' /* suffix for RCS files                       */
  552. + #define RCSSEP            '\0' /* separator for RCSSUF                       */
  553. + #else
  554.   #define RCSSUF            'v' /* suffix for RCS files                       */
  555.   #define RCSSEP            ',' /* separator for RCSSUF                       */
  556. + #endif /* MSDOS */
  557.   #define KDELIM            '$' /* delimiter for keywords                     */
  558.   #define VDELIM            ':' /* separates keywords from values             */
  559.   #define DEFAULTSTATE    "Exp" /* default state of revisions                 */
  560. ***************
  561. *** 184,191 ****
  562. --- 196,208 ----
  563.   #  define NCPFN           256 /* number of characters per filename          */
  564.   #  define NCPPN          1024 /* number of characters per pathname          */
  565.   #else
  566. + #ifdef MSDOS        /* support OS/2 HPFS */
  567. + #  define NCPFN           256 /* number of characters per filename          */
  568. + #  define NCPPN             256 /* number of characters per pathname          */
  569. + #else
  570.   #  define NCPFN            14 /* number of characters per filename          */
  571.   #  define NCPPN       6*NCPFN /* number of characters per pathname          */
  572. + #endif /* MSDOS */
  573.   #endif
  574.   #define keylength          20 /* buffer length for expansion keywords       */
  575.   #define keyvallength NCPPN+revlength+datelength+60
  576. ***************
  577. *** 202,207 ****
  578. --- 219,233 ----
  579.  
  580.   /* temporary file names */
  581.  
  582. + #ifdef MSDOS            /* Added by $Author: lfk $ */
  583. + #define NEWRCSFILE  "nwXXXXXX"
  584. + #define DIFFILE     "ciXXXXXX"
  585. + #define TMPFILE1    "t1XXXXXX"
  586. + #define TMPFILE2    "t2XXXXXX"
  587. + #define TMPFILE3    "t3XXXXXX"
  588. + #define JOINFIL2    "j2XXXXXX"
  589. + #define JOINFIL3    "j3XXXXXX"
  590. + #else
  591.   #define NEWRCSFILE  ",RCSnewXXXXXX"
  592.   #define DIFFILE     ",RCSciXXXXXX"
  593.   #define TMPFILE1    ",RCSt1XXXXXX"
  594. ***************
  595. *** 209,214 ****
  596. --- 235,241 ----
  597.   #define TMPFILE3    ",RCSt3XXXXXX"
  598.   #define JOINFIL2    ",RCSj2XXXXXX"
  599.   #define JOINFIL3    ",RCSj3XXXXXX"
  600. + #endif /* MSDOS */
  601.  
  602.  
  603.   #define putc(x,p) (--(p)->_cnt>=0? ((int)(*(p)->_ptr++=(unsigned)(x))):fflsbuf((unsigned)(x),p))
  604. ***************
  605. *** 218,224 ****
  606. --- 245,255 ----
  607.   /* GETC modifies a local variable c; a kludge, but smaller and faster.      */
  608.   /* GETC writes a del-character (octal 177) on end of file                   */
  609.  
  610. + #ifdef MSDOS
  611. + #define WORKMODE(RCSmode) (RCSmode & ~S_IWRITE)|((lockflag||!StrictLocks)? ( S_IWRITE | S_IREAD ) : 0000 )
  612. + #else
  613.   #define WORKMODE(RCSmode) (RCSmode&~0222)|((lockflag||!StrictLocks)?0600:0000)
  614. + #endif /* MSDOS */
  615.   /* computes mode of working file: same as RCSmode, but write permission     */
  616.   /* determined by lockflag and StrictLocks.                                  */
  617.  
  618. diff -cbBwr rcs43/src/rcsclean.c rcs43-2/src/rcsclean.c
  619. *** rcs43/src/rcsclean.c    Wed Sep 19 19:02:56 1990
  620. --- rcs43-2/src/rcsclean.c    Fri Sep 21 16:25:54 1990
  621. ***************
  622. *** 66,71 ****
  623. --- 66,73 ----
  624.    *
  625.    */
  626.   #include "rcsbase.h"
  627. + #include <sys/types.h>
  628. + #include <sys/stat.h>
  629.   #define ERRCODE 2                   /*error code for exit status            */
  630.   #ifndef lint
  631.   static char rcsbaseid[] = RCSBASE;
  632. ***************
  633. *** 82,87 ****
  634. --- 84,94 ----
  635.   extern FILE * finptr;               /* RCS input file                       */
  636.   extern FILE * fopen();
  637.  
  638. + #ifdef MSDOS
  639. + extern char *gettmpdir();
  640. + char tmpdir[NCPPN];
  641. + #endif /* MSDOS */
  642. +
  643.   char *RCSfilename;
  644.   char *workfilename;
  645.   char * tempfile;
  646. ***************
  647. *** 130,135 ****
  648. --- 137,146 ----
  649.  
  650.       if (argc<1) fterror("No input file\n%s", cmdusage);
  651.  
  652. + #ifdef MSDOS
  653. +     strcpy( tmpdir, gettmpdir() );
  654. + #endif /* MSDOS */
  655. +
  656.           /* now handle all filenames */
  657.           do {
  658.                   finptr=NULL;
  659. ***************
  660. *** 159,165 ****
  661. --- 170,180 ----
  662.           if (!expandsym(rev,numericrev)) continue;
  663.                   if (!(target=genrevs(numericrev,(char *)nil,(char *)nil,(char *)nil,gendeltas))) continue;
  664.  
  665. + #ifdef MSDOS
  666. +         tempfile=mktempfile( tmpdir ,TMPFILE1);
  667. + #else
  668.           tempfile=mktempfile("/tmp/",TMPFILE1);
  669. + #endif /* MSDOS */
  670.           diagnose("retrieving revision %s",target->num);
  671.                   VOID sprintf(command,"%s -q -p%s %s > %s\n",
  672.               CO ,target->num,RCSfilename,tempfile);
  673. ***************
  674. *** 182,191 ****
  675. --- 197,209 ----
  676.                   /* identical files; can remove working file */
  677.                   result=0;
  678.                   diagnose("files identical; %s removed",workfilename);
  679. +                                 fclose(file2);
  680. +                                 chmod(workfilename, S_IREAD | S_IWRITE);
  681.                   if (unlink(workfilename)!=0) {
  682.                       error("Can't unlink %s",workfilename);
  683.                   }
  684.                   if (findlock(caller, false)) {
  685. +                                     VOID fclose(finptr); finptr=NULL;
  686.                       VOID sprintf(command,"%s -q -u%s %s\n",
  687.                            RCS_CMD, target->num, RCSfilename);
  688.                       if (system(command)) {
  689. diff -cbBwr rcs43/src/rcsdiff.c rcs43-2/src/rcsdiff.c
  690. *** rcs43/src/rcsdiff.c    Wed Sep 19 19:02:56 1990
  691. --- rcs43-2/src/rcsdiff.c    Fri Sep 21 15:10:10 1990
  692. ***************
  693. *** 111,116 ****
  694. --- 111,122 ----
  695.   char *workfilename;
  696.   char * temp1file, * temp2file;
  697.  
  698. + #ifdef MSDOS
  699. + int old_stdout;
  700. + char *gettmpdir();
  701. + char tmpdir[NCPPN];
  702. + #endif /* MSDOS */
  703. +
  704.   char bops[10];
  705.   char otherops[10];
  706.  
  707. ***************
  708. *** 197,202 ****
  709. --- 203,212 ----
  710.       }
  711.       if (argc<1) fterror("No input file\n%s",cmdusage);
  712.  
  713. + #ifdef MSDOS
  714. +     strcpy( tmpdir, gettmpdir() );
  715. +     old_stdout = dup(1);
  716. + #endif /* MSDOS */
  717.           /* now handle all filenames */
  718.           do {
  719.                   finptr=NULL;
  720. ***************
  721. *** 231,237 ****
  722. --- 241,251 ----
  723.                   }
  724.  
  725.  
  726. + #ifdef MSDOS
  727. +                 temp1file=mktempfile(tmpdir,TMPFILE1);
  728. + #else
  729.                   temp1file=mktempfile("/tmp/",TMPFILE1);
  730. + #endif /* MSDOS */
  731.                   diagnose("retrieving revision %s",xrev1);
  732.                   VOID sprintf(commarg,"-p%s",xrev1);
  733.                   if (run((char*)nil,temp1file, co,"-q",commarg,RCSfilename,(char*)nil)){
  734. ***************
  735. *** 242,248 ****
  736. --- 256,266 ----
  737.                           temp2file=workfilename;
  738.                           diagnose("diff%s%s -r%s %s",boption,otheroption,xrev1,workfilename);
  739.                   } else {
  740. + #ifdef MSDOS
  741. +                         temp2file=mktempfile(tmpdir,TMPFILE2);
  742. + #else
  743.                           temp2file=mktempfile("/tmp/",TMPFILE2);
  744. + #endif /* MSDOS */
  745.                           diagnose("retrieving revision %s",xrev2);
  746.               VOID sprintf(commarg,"-p%s",xrev2);
  747.                           if (run((char*)nil,temp2file, co,"-q",commarg,RCSfilename,(char *)nil)){
  748. ***************
  749. *** 251,267 ****
  750.                           }
  751.                           diagnose("diff%s%s -r%s -r%s",boption,otheroption,xrev1,xrev2);
  752.                   }
  753. !
  754.                   exit_stats =
  755.               *boption
  756.               ? *otheroption
  757.                 ? run((char*)nil,(char*)nil, DIFF, boption+1,    otheroption+1,    temp1file,temp2file,(char*)nil)
  758.                 : run((char*)nil,(char*)nil, DIFF, boption+1,            temp1file,temp2file,(char*)nil)
  759.               : *otheroption
  760.                 ? run((char*)nil,(char*)nil, DIFF,         otheroption+1,    temp1file,temp2file,(char*)nil)
  761.                 : run((char*)nil,(char*)nil, DIFF,                 temp1file,temp2file,(char*)nil);
  762.  
  763.                   if (exit_stats == (1 << BYTESIZ))
  764.               diffs_found = 1;
  765.                   else if (exit_stats != 0) {
  766.                           error ("diff failed");
  767. --- 269,312 ----
  768.                           }
  769.                           diagnose("diff%s%s -r%s -r%s",boption,otheroption,xrev1,xrev2);
  770.                   }
  771. ! #ifdef MSDOS
  772. ! #    ifdef MKS
  773. !         dup2( old_stdout, 1 );
  774. !                 exit_stats =
  775. !             *boption
  776. !             ? *otheroption
  777. !               ? spawnlp( 0, DIFF, DIFF, boption+1, otheroption+1, temp1file,temp2file,NULL)
  778. !               : spawnlp( 0, DIFF, DIFF, boption+1, temp1file, temp2file, NULL)
  779. !             : *otheroption
  780. !               ? spawnlp( 0, DIFF, DIFF, otheroption+1, temp1file,temp2file, NULL)
  781. !               : spawnlp( 0, DIFF, DIFF, temp1file, temp2file, NULL);
  782. ! #    else
  783. !         dup2( old_stdout, 1 );
  784.                   exit_stats =
  785.               *boption
  786.               ? *otheroption
  787. +               ? spawnlp( 0, DIFF, DIFF, "-a", boption+1, otheroption+1, temp1file,temp2file,NULL)
  788. +               : spawnlp( 0, DIFF, DIFF, "-a", boption+1, temp1file, temp2file, NULL)
  789. +             : *otheroption
  790. +               ? spawnlp( 0, DIFF, DIFF, "-a", otheroption+1, temp1file,temp2file, NULL)
  791. +               : spawnlp( 0, DIFF, DIFF, "-a", temp1file, temp2file, NULL);
  792. + #    endif
  793. + #else
  794. +                 exit_stats =
  795. +             *boption
  796. +             ? *otheroption
  797.                 ? run((char*)nil,(char*)nil, DIFF, boption+1,    otheroption+1,    temp1file,temp2file,(char*)nil)
  798.                 : run((char*)nil,(char*)nil, DIFF, boption+1,            temp1file,temp2file,(char*)nil)
  799.               : *otheroption
  800.                 ? run((char*)nil,(char*)nil, DIFF,         otheroption+1,    temp1file,temp2file,(char*)nil)
  801.                 : run((char*)nil,(char*)nil, DIFF,                 temp1file,temp2file,(char*)nil);
  802. + #endif /* MSDOS */
  803.  
  804. + #ifdef MSDOS
  805. +                 if (exit_stats == 1 )
  806. + #else
  807.                   if (exit_stats == (1 << BYTESIZ))
  808. + #endif /* MSDOS */
  809.               diffs_found = 1;
  810.                   else if (exit_stats != 0) {
  811.                           error ("diff failed");
  812. diff -cbBwr rcs43/src/rcsedit.c rcs43-2/src/rcsedit.c
  813. *** rcs43/src/rcsedit.c    Wed Sep 19 19:02:52 1990
  814. --- rcs43-2/src/rcsedit.c    Fri Sep 21 15:57:46 1990
  815. ***************
  816. *** 474,480 ****
  817. --- 474,484 ----
  818.       case Header:
  819.           VOID putc(VDELIM,out); VOID putc(' ',out);
  820.           if (marker==Id)
  821. + #ifdef MSDOS
  822.                VOID fputs(bindex(RCSfilename,'/'),out);
  823. + #    else
  824. +              VOID fputs(bindex(RCSfilename,'/'),out);
  825. + #endif /* MSDOS */
  826.           else     VOID fputs(getfullRCSname(),out);
  827.           VOID fprintf(out," %s ", delta->num);
  828.                   VOID PRINTDATE(out,date);VOID putc(' ',out);VOID PRINTTIME(out,date);
  829. ***************
  830. *** 490,495 ****
  831. --- 494,500 ----
  832.           case Log:
  833.                   VOID fprintf(out, "%c\t%s %c\n%sRevision %s  ",
  834.                           VDELIM, bindex(RCSfilename,'/'), KDELIM, Comment, delta->num);
  835. +              /* VDELIM, bindex(RCSfilename,'\\'), KDELIM, Comment, delta->num); */
  836.                   VOID PRINTDATE(out,date);VOID fputs("  ",out);VOID PRINTTIME(out,date);
  837.                   VOID fprintf(out, "  %s\n%s",delta->author,Comment);
  838.                   /* do not include state here because it may change and is not updated*/
  839. ***************
  840. *** 498,503 ****
  841. --- 503,509 ----
  842.                   /* Comment is the comment leader */
  843.                   break;
  844.           case RCSfile:
  845. +              /* VOID fprintf(out,"%c %s %c",VDELIM,bindex(RCSfilename,'\\'),KDELIM); */
  846.                   VOID fprintf(out,"%c %s %c",VDELIM,bindex(RCSfilename,'/'),KDELIM);
  847.                   break;
  848.           case Revision:
  849. ***************
  850. *** 513,518 ****
  851.                   VOID putc(KDELIM,out);
  852.                   break;
  853.           }
  854. - }
  855. -
  856.  
  857. --- 519,522 ----
  858. diff -cbBwr rcs43/src/rcsfnms.c rcs43-2/src/rcsfnms.c
  859. *** rcs43/src/rcsfnms.c    Wed Sep 19 19:02:54 1990
  860. --- rcs43-2/src/rcsfnms.c    Fri Sep 21 15:19:02 1990
  861. ***************
  862. *** 120,126 ****
  863. --- 120,131 ----
  864.   #include "rcsbase.h"
  865.   #include <sys/types.h>
  866.   #include <sys/stat.h>
  867. + #ifdef MSDOS
  868. + #include <stdlib.h>
  869. + #include <direct.h>
  870. + #else
  871.   #include <sys/dir.h>
  872. + #endif /* MSDOS */
  873.  
  874.   extern char * rindex();
  875.   extern char * mktemp();
  876. ***************
  877. *** 154,174 ****
  878.   /* table is used to guess the proper comment leader from the working file's */
  879.   /* suffix during initial ci (see InitAdmin()). Comment leaders are needed   */
  880.   /* for languages without multiline comments; for others they are optional.  */
  881.           "c",   " * ",   /* C           */
  882.       "csh", "# ",    /* shell       */
  883.           "e",   "# ",    /* efl         */
  884.           "f",   "c ",    /* fortran     */
  885.           "h",   " * ",   /* C-header    */
  886.           "l",   " * ",   /* lex         NOTE: conflict between lex and franzlisp*/
  887.           "mac", "; ",    /* macro       vms or dec-20 or pdp-11 macro */
  888.       "me",  ".\\\" ",/* me-macros   t/nroff*/
  889.       "mm",  ".\\\" ",/* mm-macros   t/nroff*/
  890.       "ms",  ".\\\" ",/* ms-macros   t/nroff*/
  891.           "p",   " * ",   /* pascal      */
  892.       "pl",  "% ",    /* prolog      */
  893.           "r",   "# ",    /* ratfor      */
  894.           "red", "% ",    /* psl/rlisp   */
  895. !
  896.   #ifdef sparc
  897.           "s",   "! ",    /* assembler   */
  898.   #endif
  899. --- 159,207 ----
  900.   /* table is used to guess the proper comment leader from the working file's */
  901.   /* suffix during initial ci (see InitAdmin()). Comment leaders are needed   */
  902.   /* for languages without multiline comments; for others they are optional.  */
  903. + /* According to your MSDOS-environment, you change these settlements. !!    */
  904. + /* If you can work on UN*X, it is worthwile to keep these.                  */
  905. + /* It however, may cause lack of memory on MSDOS                           */
  906. + /* $Author: lfk $                                                      */
  907. +         "",        "# ",        /* default for empty suffix */
  908. +         "awk",    "# ",        /* AWK */
  909.           "c",   " * ",   /* C           */
  910. + #ifdef ALL
  911. +         "c++"    "// "        /* C++ */
  912. +         "cc"    "// "        /* C++ */
  913. +         "CC"    "// "        /* C++ */
  914. +         "C"        "// "        /* C++ */
  915. +         "cl",    ";;; ",        /* common lisp */
  916.       "csh", "# ",    /* shell       */
  917.           "e",   "# ",    /* efl         */
  918. +         "el",    "; ",        /* gnulisp     */
  919. + #endif
  920.           "f",   "c ",    /* fortran     */
  921.           "h",   " * ",   /* C-header    */
  922. +         "ksh",    "# ",        /* korn shell  */
  923.           "l",   " * ",   /* lex         NOTE: conflict between lex and franzlisp*/
  924.           "mac", "; ",    /* macro       vms or dec-20 or pdp-11 macro */
  925.       "me",  ".\\\" ",/* me-macros   t/nroff*/
  926. + #ifdef ALL
  927. +         "ml",    "; ",        /* mocklisp    */
  928. + #endif
  929.       "mm",  ".\\\" ",/* mm-macros   t/nroff*/
  930.       "ms",  ".\\\" ",/* ms-macros   t/nroff*/
  931. + #ifdef ALL
  932.           "p",   " * ",   /* pascal      */
  933. +         "perl",    "# ",        /* L. Wall's Perl */
  934.       "pl",  "% ",    /* prolog      */
  935.           "r",   "# ",    /* ratfor      */
  936.           "red", "% ",    /* psl/rlisp   */
  937. !         "sh",    "# ",        /* shell       */
  938. !         "sl",    "% ",        /* psl         */
  939. ! #endif
  940. !         "tex",    "% ",        /* tex           */
  941. !         "y",    " * ",        /* yacc        */
  942. ! #ifdef ALL
  943. !         "ye",    " * ",        /* yacc-efl    */
  944. !         "yr",    " * ",        /* yacc-ratfor */
  945. ! #endif
  946.   #ifdef sparc
  947.           "s",   "! ",    /* assembler   */
  948.   #endif
  949. ***************
  950. *** 181,198 ****
  951.   #ifdef vax
  952.           "s",   "# ",    /* assembler   */
  953.   #endif
  954. !
  955. !         "sh",  "# ",    /* shell       */
  956. !         "sl",  "% ",    /* psl         */
  957. !         "red", "% ",    /* psl/rlisp   */
  958. !         "cl",  ";;; ",  /* common lisp   */
  959. !         "ml",  "; ",    /* mocklisp    */
  960. !         "el",  "; ",    /* gnulisp     */
  961. !     "tex", "% ",    /* tex           */
  962. !         "y",   " * ",   /* yacc        */
  963. !         "ye",  " * ",   /* yacc-efl    */
  964. !         "yr",  " * ",   /* yacc-ratfor */
  965. !         "",    "# ",    /* default for empty suffix */
  966.           nil,   ""       /* default for unknown suffix; must always be last */
  967.   };
  968.  
  969. --- 214,228 ----
  970.   #ifdef vax
  971.           "s",   "# ",    /* assembler   */
  972.   #endif
  973. ! #ifdef MSDOS
  974. !         "asm",    "; ",    /* assembler   */
  975. !         "bat",    "REM ",    /* MS-DOS command.com */
  976. !         "cxx",    "// ",    /* MS-DOS c++ */
  977. !         "fin",    ".\\\" ",    /* for *.fin files on MSDOS */
  978. !         "fma",    ".\\\" ",    /* for fma-macors fin on MSDOS */
  979. !         "for",    "c ",    /* MS Fortran */
  980. !         "pl",    "# ",    /* L. Wall's Perl for MS-DOS */
  981. ! #endif /* MSDOS */
  982.           nil,   ""       /* default for unknown suffix; must always be last */
  983.   };
  984.  
  985. ***************
  986. *** 216,221 ****
  987. --- 246,252 ----
  988.    * The name of the semaphore file is put into variable semafilename.
  989.    */
  990.   {
  991. + #ifndef MSDOS
  992.           register char * tp, *sp, *lp;
  993.           int fdesc;
  994.  
  995. ***************
  996. *** 249,254 ****
  997. --- 280,289 ----
  998.                        madesema=true;
  999.           }
  1000.           return true;
  1001. + #else /* NOT MSDOS */
  1002. +     makesema = true;
  1003. +     return true;
  1004. + #endif /* NOT MSDOS */
  1005.   }
  1006.  
  1007.  
  1008. ***************
  1009. *** 257,262 ****
  1010. --- 292,300 ----
  1011.    * sets madesema to false.
  1012.    */
  1013.   {
  1014. + #ifdef MSDOS
  1015. +     madesema = false ;
  1016. + #else
  1017.           if (madesema) {
  1018.                   madesema=false;
  1019.                   if (unlink(semafilename) == -1) {
  1020. ***************
  1021. *** 263,272 ****
  1022.                           error("Can't find semaphore file %s",semafilename);
  1023.                   }
  1024.           }
  1025.   }
  1026.  
  1027. -
  1028. -
  1029.   InitCleanup()
  1030.   {       freefilename =  0;  /* initialize pointer */
  1031.   }
  1032. --- 301,309 ----
  1033.                           error("Can't find semaphore file %s",semafilename);
  1034.                   }
  1035.           }
  1036. + #endif /* MSDOS */
  1037.   }
  1038.  
  1039.   InitCleanup()
  1040.   {       freefilename =  0;  /* initialize pointer */
  1041.   }
  1042. ***************
  1043. *** 303,312 ****
  1044. --- 340,358 ----
  1045.           register char * lastslash, *tp;
  1046.           if ((tp=tfnames[freefilename])==nil)
  1047.                 tp=tfnames[freefilename] = talloc(NCPPN);
  1048. + #ifdef MSDOS
  1049. +     if (fullpath!=nil)
  1050. +           if ( (lastslash=rindex(fullpath,'/'))!=0 ||
  1051. +                (lastslash=rindex(fullpath,'\\'))!=0) {
  1052. +                 /* copy path */
  1053. +                 while (fullpath<=lastslash) *tp++ = *fullpath++;
  1054. +           }
  1055. + #else
  1056.           if (fullpath!=nil && (lastslash=rindex(fullpath,'/'))!=0) {
  1057.                   /* copy path */
  1058.                   while (fullpath<=lastslash) *tp++ = *fullpath++;
  1059.           }
  1060. + #endif /* MSDOS */
  1061.           while (*tp++ = *filename++);
  1062.           return (mktemp(tfnames[freefilename++]));
  1063.   }
  1064. ***************
  1065. *** 342,347 ****
  1066. --- 388,396 ----
  1067.  
  1068.           /* guess the comment leader from the suffix*/
  1069.           Suffix=bindex(workfilename, '.');
  1070. + #ifdef MSDOS
  1071. +     Suffix = strlwr( Suffix );
  1072. + #endif /* MSDOS */
  1073.           if (Suffix==workfilename) Suffix= ""; /* empty suffix; will get default*/
  1074.           for (i=0;;i++) {
  1075.                   if (comtable[i].suffix==nil) {
  1076. ***************
  1077. *** 356,361 ****
  1078. --- 405,422 ----
  1079.   }
  1080.  
  1081.  
  1082. + #ifdef MSDOS
  1083. + void _unixpath(char *pathbuf)
  1084. + {
  1085. +   int i;
  1086. +
  1087. +   strlwr(pathbuf);
  1088. +
  1089. +   for ( i = 0; i <= strlen(pathbuf); i++)
  1090. +     if(pathbuf[i] == '\\')
  1091. +       pathbuf[i] = '/';
  1092. + }
  1093. + #endif
  1094.  
  1095.   char * findpairfile(argc, argv, fname)
  1096.   int argc; char * argv[], *fname;
  1097. ***************
  1098. *** 369,375 ****
  1099. --- 430,442 ----
  1100.           register int count;
  1101.  
  1102.           for (next = argv, count = argc; count>0; next++,count--) {
  1103. + #ifdef MSDOS
  1104. +         if ((*next != nil) &&
  1105. +                     (strcmp(bindex(*next,'/'),fname)==0 ||
  1106. +              strcmp(bindex(*next,'\\'),fname)==0)) {
  1107. + #    else
  1108.                   if ((*next != nil) && strcmp(bindex(*next,'/'),fname)==0) {
  1109. + #endif /* MSDOS */
  1110.                           /* bindex finds the beginning of the file name stem */
  1111.                           match= *next;
  1112.                           *next=nil;
  1113. ***************
  1114. *** 419,424 ****
  1115. --- 486,495 ----
  1116.           register char * sp, * tp;
  1117.           char * lastsep, * purefname, * pureRCSname;
  1118.           int opened, returncode;
  1119. + #ifdef MSDOS
  1120. +         char *help;
  1121. +     struct stat dirstat;
  1122. + #endif /* MSDOS */
  1123.           char * RCS1;
  1124.       char prefdir[NCPPN];
  1125.  
  1126. ***************
  1127. *** 431,437 ****
  1128. --- 502,554 ----
  1129.           InitCleanup();
  1130.  
  1131.           /* first check suffix to see whether it is an RCS file or not */
  1132. + #ifdef MSDOS
  1133.           purefname=bindex(*argv, '/'); /* skip path */
  1134. +     if ( (help=bindex(*argv, '\\')) > purefname )
  1135. +           purefname = help;
  1136. + #else
  1137. +         purefname=bindex(*argv, '/'); /* skip path */
  1138. + #endif /* MSDOS */
  1139. + #ifdef MSDOS
  1140. +     if ( (pureRCSname = strstr(*argv, "rcs/")) != NULL ||
  1141. +          (pureRCSname = strstr(*argv, "rcs\\")) != NULL ||
  1142. +          (pureRCSname = strstr(*argv, "RCS\\")) != NULL ) {
  1143. +                 /* RCS file name given*/
  1144. +         RCS1 = (*argv);
  1145. +                 /* derive workfilename*/
  1146. +         sp = purefname; tp=tempfilename;
  1147. +         while( *sp != '\0' ) *tp++=*sp++; *tp= '\0';
  1148. +                 workfilename=findpairfile(argc-1,argv+1,tempfilename);
  1149. +         if( strlen(pureRCSname) > NCPFN + 4 ) {
  1150. +             /* To avoid, ambiguous file name. eg."RCS\RCS\foo.c" */
  1151. +             if( strlen(pureRCSname + 4) != (int) NULL ){
  1152. +                 error("file name %s is ambiguous", RCS1);
  1153. +                 return 0;
  1154. +             }
  1155. +             error("RCS file name %s too long",RCS1);
  1156. +             return 0;
  1157. +         }
  1158. +     } else {
  1159. +                 /* working file given; now try to find RCS file */
  1160. +         workfilename=*argv;
  1161. +         /* derive RCS file name*/
  1162. +         strcpy( tempfilename, "rcs/" );
  1163. +         strcat( tempfilename, purefname );
  1164. +                 RCS1=findpairfile(argc-1,argv+1,tempfilename);
  1165. +         if ( (pureRCSname = strstr(RCS1, "rcs/")) == NULL )
  1166. +           if ( (pureRCSname = strstr(RCS1, "rcs\\")) == NULL )
  1167. +             pureRCSname = strstr( RCS1, "RCS\\" );
  1168. +         if (strlen(pureRCSname)>NCPFN+4) {
  1169. +                         error("working file name %s too long",workfilename);
  1170. +                         return 0;
  1171. +                 }
  1172. +         }
  1173. +     if( strchr( workfilename, '/' ) != NULL ||
  1174. +         strchr( workfilename, '\\' ) != NULL ){
  1175. +         error("Sorry, file name %s confuses RCS", workfilename );
  1176. +         return 0;
  1177. +     }
  1178. + #else /* MSDOS */
  1179.           lastsep=rindex(purefname, RCSSEP);
  1180.           if (lastsep!= 0 && *(lastsep+1)==RCSSUF && *(lastsep+2)=='\0') {
  1181.                   /* RCS file name given*/
  1182. ***************
  1183. *** 460,467 ****
  1184. --- 577,612 ----
  1185.                           return 0;
  1186.                   }
  1187.           }
  1188. + #endif /* MSDOS */
  1189.           /* now we have a (tentative) RCS filename in RCS1 and workfilename  */
  1190.           /* Try to find the right RCS file */
  1191. + #ifdef MSDOS
  1192. +     RCSfilename=pureRCSname;
  1193. +     if (pureRCSname != RCS1){
  1194. +         error("Sorry, file name %s confuse RCS", RCS1);
  1195. +         return 0;
  1196. +     }else{
  1197. +         opened = ( ( finptr=fopen(pureRCSname, "r" ) ) != NULL );
  1198. +         if(opened){
  1199. +             returncode = 1;
  1200. +         }else{
  1201. +                         if (mustread) {
  1202. +                 error("Can't find %s",RCSfilename);
  1203. +                                 return 0;
  1204. +             }else{
  1205. +                 if( stat("RCS", &dirstat) == -1 ){
  1206. +                     error("Can't find RCS subdirectory");
  1207. +                     return 0;
  1208. +                 }else{
  1209. +                     if( !( dirstat.st_mode & S_IFDIR ) ){
  1210. +                         error("RCS is really directory?");
  1211. +                         return 0;
  1212. +                     }else returncode = -1;
  1213. +                 }
  1214. +             }
  1215. +         }
  1216. +     }
  1217. + #else /* MSDOS */
  1218.           if (pureRCSname!=RCS1) {
  1219.                   /* a path for RCSfile is given; single RCS file to look for */
  1220.                   finptr=fopen(RCSfilename=RCS1, "r");
  1221. ***************
  1222. *** 521,527 ****
  1223.                           }
  1224.                   }
  1225.           }
  1226. !
  1227.           if (returncode == 1) { /* RCS file open */
  1228.                   haveRCSstat=fstat(fileno(finptr),&RCSstat);
  1229.                   if ((haveRCSstat== 0) && ((RCSstat.st_mode & S_IFDIR) == S_IFDIR)) {
  1230. --- 666,672 ----
  1231.                           }
  1232.                   }
  1233.           }
  1234. ! #endif /* MSDOS */
  1235.           if (returncode == 1) { /* RCS file open */
  1236.                   haveRCSstat=fstat(fileno(finptr),&RCSstat);
  1237.                   if ((haveRCSstat== 0) && ((RCSstat.st_mode & S_IFDIR) == S_IFDIR)) {
  1238. ***************
  1239. *** 540,545 ****
  1240. --- 685,694 ----
  1241.                   /* file names was given in the argument list        */
  1242.                   warn("Option -p is set; ignoring output file %s",workfilename);
  1243.  
  1244. + #ifdef MSDOS
  1245. +         _unixpath(RCSfilename);
  1246. +         _unixpath(workfilename);
  1247. + #endif
  1248.           return returncode;
  1249.   }
  1250.  
  1251. ***************
  1252. *** 549,555 ****
  1253.    * Calls getwd(), but only once.
  1254.    * removes leading "../" and "./".
  1255.    */
  1256. ! {       static char pathbuf[NCPPN];
  1257.           static char namebuf[NCPPN];
  1258.           static int  pathlength;
  1259.  
  1260. --- 698,712 ----
  1261.    * Calls getwd(), but only once.
  1262.    * removes leading "../" and "./".
  1263.    */
  1264. ! {
  1265. ! #ifdef MSDOS
  1266. !         static char pathbuf[NCPPN];
  1267. !
  1268. !         _fullpath(pathbuf, RCSfilename, sizeof(pathbuf));
  1269. !         _unixpath(pathbuf);
  1270. !         return pathbuf;
  1271. ! #else
  1272. !         static char pathbuf[NCPPN];
  1273.           static char namebuf[NCPPN];
  1274.           static int  pathlength;
  1275.  
  1276. ***************
  1277. *** 604,613 ****
  1278.                       return(namebuf);
  1279.                   }
  1280.           }
  1281.   }
  1282.  
  1283. !
  1284. !
  1285.   int trydiraccess(filename)
  1286.   char * filename;
  1287.   /* checks write permission in directory of filename and returns
  1288. --- 761,771 ----
  1289.                       return(namebuf);
  1290.                   }
  1291.           }
  1292. + #endif
  1293.   }
  1294.  
  1295. ! /* In MSDOS and (perhaps) OS/2, any directries are writable.     */
  1296. ! /* So, the below check is NON-SENSE !! : $Author: lfk $         */
  1297.   int trydiraccess(filename)
  1298.   char * filename;
  1299.   /* checks write permission in directory of filename and returns
  1300. ***************
  1301. *** 616,621 ****
  1302. --- 774,783 ----
  1303.   {
  1304.           char pathname[NCPPN];
  1305.           register char * tp, *sp, *lp;
  1306. +
  1307. + #ifdef MSDOS
  1308. +     return true;
  1309. + #else
  1310.           lp = rindex(filename,'/');
  1311.           if (lp==0) {
  1312.                   /* check current directory */
  1313. ***************
  1314. *** 637,642 ****
  1315. --- 799,805 ----
  1316.                   error("Directory %s not writable", pathname);
  1317.                   return false;
  1318.           }
  1319. + #endif /* MSDOS */
  1320.   }
  1321.  
  1322.  
  1323. ***************
  1324. *** 644,650 ****
  1325.   #ifndef V4_2BSD
  1326.   /* rename() and getwd() will be provided in bsd 4.2 */
  1327.  
  1328. !
  1329.   int rename(from, to)
  1330.   char * from, *to;
  1331.   /* Function: renames a file with the name given by from to the name given by to.
  1332. --- 807,813 ----
  1333.   #ifndef V4_2BSD
  1334.   /* rename() and getwd() will be provided in bsd 4.2 */
  1335.  
  1336. ! #ifndef MSDOS
  1337.   int rename(from, to)
  1338.   char * from, *to;
  1339.   /* Function: renames a file with the name given by from to the name given by to.
  1340. ***************
  1341. *** 733,742 ****
  1342.   fail:   VOID fclose(file);
  1343.           return NULL;
  1344.   }
  1345.  
  1346. !
  1347.   #endif
  1348.  
  1349.  
  1350.   #ifdef PAIRTEST
  1351.   /* test program for pairfilenames() and getfullRCSname() */
  1352. --- 896,930 ----
  1353.   fail:   VOID fclose(file);
  1354.           return NULL;
  1355.   }
  1356. + #else /* MSDOS */
  1357.  
  1358. ! char *getwd(name)
  1359. ! char    *name;
  1360. ! {
  1361. !     int a,i;
  1362. !     (void)getcwd(name, NCPPN);
  1363. !     strlwr(name);
  1364. !     a = strlen(name);
  1365. !     for ( i = 0; i <= a; i++)
  1366. !         if(name[i] == '\\')
  1367. !             name[i] = '/';
  1368. !     return name;
  1369. ! }
  1370. ! #endif /* MSODS */
  1371.   #endif
  1372. + #ifdef MSDOS
  1373. + char *gettmpdir()
  1374. + {
  1375. +     char tp[NCPPN];
  1376. +
  1377. +     strcpy( tp, (char *) getenv("TMP") );
  1378. +     if( *tp == (char) NULL ) strcpy( tp, "." );
  1379. +     if( tp[strlen(tp) - 1] != '\\' )
  1380. +         strcat( tp, "\\" );
  1381. +     return tp;
  1382. + }
  1383.  
  1384. + #endif /* MSDOS */
  1385.  
  1386.   #ifdef PAIRTEST
  1387.   /* test program for pairfilenames() and getfullRCSname() */
  1388. diff -cbBwr rcs43/src/rcsgen.c rcs43-2/src/rcsgen.c
  1389. *** rcs43/src/rcsgen.c    Wed Sep 19 19:02:56 1990
  1390. --- rcs43-2/src/rcsgen.c    Fri Sep 21 15:08:02 1990
  1391. ***************
  1392. *** 107,114 ****
  1393.   extern FILE * fcopy;       /* result file during editing                    */
  1394.   extern char * resultfile;  /* file name for fcopy                           */
  1395.   extern int    rewriteflag; /* indicates whether to rewrite the input file   */
  1396.  
  1397. -
  1398.   char    curlogmsg[logsize]; /* buffer for current log message                */
  1399.  
  1400.   enum stringwork {copy, edit, expand, edit_expand };
  1401. --- 107,116 ----
  1402.   extern FILE * fcopy;       /* result file during editing                    */
  1403.   extern char * resultfile;  /* file name for fcopy                           */
  1404.   extern int    rewriteflag; /* indicates whether to rewrite the input file   */
  1405. + #ifdef MSDOS
  1406. + extern char tmpdir[NCPPN];
  1407. + #endif /* MSDOS */
  1408.  
  1409.   char    curlogmsg[logsize]; /* buffer for current log message                */
  1410.  
  1411.   enum stringwork {copy, edit, expand, edit_expand };
  1412. ***************
  1413. *** 151,157 ****
  1414. --- 153,163 ----
  1415.                   }
  1416.           } else {
  1417.                   /* several revisions to generate */
  1418. + #ifdef MSDOS
  1419. +                 initeditfiles(dir?dir: tmpdir);
  1420. + #else
  1421.                   initeditfiles(dir?dir:"/tmp/");
  1422. + #endif /* MSDOS */
  1423.                   /* write initial revision into fcopy, no keyword expansion */
  1424.                   scandeltatext(deltas[0],copy);
  1425.                   i = 1;
  1426. ***************
  1427. *** 285,291 ****
  1428. --- 291,301 ----
  1429.                   }
  1430.                   /* read text from stdin */
  1431.                   if (ttystdin()) {
  1432. + #ifdef MSDOS
  1433. +                     VOID fputs("enter description, terminated with ^Z or '.':\n",stderr);
  1434. + #else
  1435.                       VOID fputs("enter description, terminated with ^D or '.':\n",stderr);
  1436. + #endif /* MSDOS */
  1437.                       VOID fputs("NOTE: This is NOT the log message!\n>> ",stderr);
  1438.               if (feof(stdin))
  1439.                       clearerr(stdin);
  1440. diff -cbBwr rcs43/src/rcslex.c rcs43-2/src/rcslex.c
  1441. *** rcs43/src/rcslex.c    Wed Sep 19 19:02:54 1990
  1442. --- rcs43-2/src/rcslex.c    Fri Sep 21 15:08:04 1990
  1443. ***************
  1444. *** 137,143 ****
  1445. --- 137,147 ----
  1446.                               /*into the symbol table. Handle with care.      */
  1447.   int             nextc;      /*next input character, initialized by Lexinit  */
  1448.  
  1449. + #ifdef MSDOS
  1450. + int             eoftok;        /*end-of-file indicator, set to >0 on end of file*/
  1451. + #else
  1452.   int             eof;        /*end-of-file indicator, set to >0 on end of file*/
  1453. + #endif /* MSDOS */
  1454.   int             line;       /*current line-number of input                  */
  1455.   int             nerror;     /*counter for errors                            */
  1456.   int             nwarn;      /*counter for warnings                          */
  1457. ***************
  1458. *** 241,247 ****
  1459. --- 245,255 ----
  1460.                   hshtab[c].num = nil;
  1461.           }
  1462.  
  1463. + #ifdef MSDOS
  1464. +         hshenter=true; eoftok=0; line=1; nerror=0; nwarn=0;
  1465. + #else
  1466.           hshenter=true; eof=0; line=1; nerror=0; nwarn=0;
  1467. + #endif /* MSDOS */
  1468.           NextString=nil; Topchar = &StringTab[0];
  1469.           if (finptr) {
  1470.                   nextc = GETC(finptr,frewrite,rewriteflag); /*initial character*/
  1471. ***************
  1472. *** 272,278 ****
  1473. --- 280,290 ----
  1474.           register char * sp;
  1475.           register enum tokens d;
  1476.  
  1477. + #ifdef MSDOS
  1478. +         if (eoftok) {
  1479. + #else
  1480.           if (eof) {
  1481. + #endif /* MSDOS */
  1482.                   nexttok=EOFILE;
  1483.                   return;
  1484.           }
  1485. ***************
  1486. *** 299,305 ****
  1487. --- 311,321 ----
  1488.                   goto loop;
  1489.  
  1490.           case EOFILE:
  1491. + #ifdef MSDOS
  1492. +                 eoftok++;
  1493. + #else
  1494.                   eof++;
  1495. + #endif /* MSDOS */
  1496.                   nexttok=EOFILE;
  1497.                   return;
  1498.  
  1499. ***************
  1500. *** 692,702 ****
  1501. --- 708,722 ----
  1502.       va_list ap;
  1503.  
  1504.       va_start(ap);
  1505. + #ifdef MSDOS
  1506. +     VOID vfprintf(iop, fmt, ap);
  1507. + #else
  1508.   #ifdef VFPRINTF
  1509.       VOID vfprintf(iop, fmt, ap);
  1510.   #else
  1511.       _doprnt(fmt, ap, iop);
  1512.   #endif
  1513. + #endif /* MSDOS */
  1514.           if (ferror(iop)) {
  1515.           writeerror();
  1516.                   value = EOF;
  1517. diff -cbBwr rcs43/src/rcsmerge.c rcs43-2/src/rcsmerge.c
  1518. *** orig/src/rcsmerge.c    Mon Oct 01 19:03:34 1990
  1519. --- rcs/src/rcsmerge.c    Mon Oct 01 18:47:56 1990
  1520. ***************
  1521. *** 88,93 ****
  1522. --- 88,98 ----
  1523.   extern struct hshentry * genrevs(); /*generate delta numbers                */
  1524.   extern int  nerror;                 /*counter for errors                    */
  1525.  
  1526. + #ifdef MSDOS
  1527. + extern char *getmpdir();
  1528. + char    tmpdir[NCPPN];
  1529. + #endif /* MSODS */
  1530. +
  1531.   char *RCSfilename;
  1532.   char *workfilename;
  1533.   char * temp1file, * temp2file;
  1534. ***************
  1535. *** 135,140 ****
  1536. --- 140,149 ----
  1537.           if (argc<1) faterror("No input file\n%s",cmdusage);
  1538.           if (revnums<1) faterror("no base revision number given");
  1539.  
  1540. + #ifdef MSDOS
  1541. +     strcpy( tmpdir, (char *) gettmpdir() );
  1542. + #endif /* MSDOS */
  1543. +
  1544.           /* now handle all filenames */
  1545.  
  1546.           if (pairfilenames(argc,argv,true,false)==1) {
  1547. ***************
  1548. *** 175,182 ****
  1549. --- 184,196 ----
  1550.               goto end;
  1551.           }
  1552.  
  1553. + #ifdef MSDOS
  1554. +                 temp1file=mktempfile(tmpdir,TMPFILE1);
  1555. +                 temp2file=mktempfile(tmpdir,TMPFILE2);
  1556. + #else
  1557.                   temp1file=mktempfile("/tmp/",TMPFILE1);
  1558.                   temp2file=mktempfile("/tmp/",TMPFILE2);
  1559. + #endif /* MSDOS */
  1560.  
  1561.                   diagnose("retrieving revision %s",rev1);
  1562.                   VOID sprintf(commarg,"-p%s",rev1);
  1563. ***************
  1564. *** 194,201 ****
  1565. --- 208,220 ----
  1566.  
  1567.                   if (
  1568.                 tostdout
  1569. + #ifdef MSDOS
  1570. +             ? run((char*)nil,(char*)nil,"sh",merge,"-p",workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)
  1571. +             : run((char*)nil,(char*)nil,"sh",merge,     workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)) {
  1572. + #else
  1573.               ? run((char*)nil,(char*)nil,merge,"-p",workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)
  1574.               : run((char*)nil,(char*)nil,merge,     workfilename,temp1file,temp2file,workfilename,rev2,(char*)nil)) {
  1575. + #endif
  1576.                           faterror("merge failed");
  1577.                   }
  1578.           }
  1579. diff -cbBwr rcs43/src/rcsrev.c rcs43-2/src/rcsrev.c
  1580. *** rcs43/src/rcsrev.c    Wed Sep 19 19:02:56 1990
  1581. --- rcs43-2/src/rcsrev.c    Fri Sep 21 15:08:06 1990
  1582. ***************
  1583. *** 713,716 ****
  1584.   cleanup(){}
  1585.   /*dummy*/
  1586.  
  1587. ! #endif REVTEST
  1588. --- 713,716 ----
  1589.   cleanup(){}
  1590.   /*dummy*/
  1591.  
  1592. ! #endif /* REVTEST */
  1593. diff -cbBwr rcs43/src/rcsutil.c rcs43-2/src/rcsutil.c
  1594. *** rcs43/src/rcsutil.c    Wed Sep 19 19:02:52 1990
  1595. --- rcs43-2/src/rcsutil.c    Fri Sep 21 16:04:12 1990
  1596. ***************
  1597. *** 110,116 ****
  1598. --- 110,118 ----
  1599.   #include <sys/stat.h>
  1600.   #include <signal.h>
  1601.   #include "rcsbase.h"
  1602. + #ifndef MSDOS
  1603.   #include <pwd.h>
  1604. + #endif /* NOT MSDOS */
  1605.   #include <varargs.h>
  1606.  
  1607.   #if defined(USG) || defined(V4_2BSD)
  1608. ***************
  1609. *** 117,133 ****
  1610.   #include <fcntl.h>
  1611.   #endif
  1612.  
  1613.   #ifndef V4_2BSD
  1614.   #define vfork fork
  1615.   #endif
  1616.  
  1617.   extern char * bindex();
  1618.   extern FILE * finptr;
  1619.   extern char * RCSfilename;
  1620.   extern char * getlogin();
  1621.   extern struct passwd *getpwuid();
  1622. - extern char * malloc();
  1623.   extern int errno;
  1624.  
  1625.  
  1626.   char * talloc(size)
  1627. --- 119,139 ----
  1628.   #include <fcntl.h>
  1629.   #endif
  1630.  
  1631. + #ifndef MSDOS
  1632.   #ifndef V4_2BSD
  1633.   #define vfork fork
  1634.   #endif
  1635. + #endif /* NOT MSDOS */
  1636.  
  1637.   extern char * bindex();
  1638.   extern FILE * finptr;
  1639.   extern char * RCSfilename;
  1640. + #ifndef MSDOS
  1641.   extern char * getlogin();
  1642.   extern struct passwd *getpwuid();
  1643.   extern int errno;
  1644. + #endif /* NOT MSDOS */
  1645. + extern char * malloc();
  1646.  
  1647.  
  1648.   char * talloc(size)
  1649. ***************
  1650. *** 140,152 ****
  1651.       return p;
  1652.   }
  1653.  
  1654. !
  1655.  
  1656.   char * getcaller()
  1657.   /* Function: gets the callers login from his uid.
  1658.    * If the uid is root, tries to get the true login with getlogin().
  1659.    */
  1660. ! {       char * name;
  1661.       int uid;
  1662.       uid=getuid();
  1663.       if (uid==0) {
  1664. --- 146,173 ----
  1665.       return p;
  1666.   }
  1667.  
  1668. ! #ifdef MSDOS
  1669. ! char * getenv( char * var );
  1670. ! #endif
  1671.  
  1672.   char * getcaller()
  1673.   /* Function: gets the callers login from his uid.
  1674.    * If the uid is root, tries to get the true login with getlogin().
  1675.    */
  1676. ! {
  1677. !     char *name = "Unknown";
  1678. !     char *tmpname;
  1679. ! #ifdef MSDOS
  1680. ! #    ifndef MKS
  1681. !     if ((tmpname = getenv("USR")) != NULL)
  1682. ! #    else
  1683. !     if ((tmpname = getenv("LOGNAME")) != NULL)
  1684. ! #    endif
  1685. !         name = tmpname;
  1686. !     else if ((tmpname = getenv("USER")) != NULL)
  1687. !         name = tmpname;
  1688. !     return name;
  1689. ! #else
  1690.       int uid;
  1691.       uid=getuid();
  1692.       if (uid==0) {
  1693. ***************
  1694. *** 156,161 ****
  1695. --- 177,183 ----
  1696.               return name;
  1697.       }
  1698.       return(getpwuid(uid)->pw_name);
  1699. + #endif /* MSDOS */
  1700.   }
  1701.  
  1702.  
  1703. ***************
  1704. *** 281,287 ****
  1705. --- 303,313 ----
  1706.           register struct access * next;
  1707.           struct stat statbuf;
  1708.  
  1709. + #ifdef MSDOS
  1710. +         if ((AccessList==nil) || (strcmp(who,"ROOT_DOS")==0))
  1711. + #else
  1712.           if ((AccessList==nil) || (strcmp(who,"root")==0))
  1713. + #endif /* MSDOS */
  1714.                   return true;
  1715.  
  1716.           next=AccessList;
  1717. ***************
  1718. *** 291,305 ****
  1719. --- 317,340 ----
  1720.                   next=next->nextaccess;
  1721.           } while (next!=nil);
  1722.  
  1723. + #ifdef MSDOS
  1724. + #else
  1725.           VOID fstat(fileno(finptr),&statbuf);  /* get owner of file */
  1726.           if (getuid() == statbuf.st_uid) return true;
  1727. + #endif /* MSDOS */
  1728.  
  1729.           error("User %s not on the access list",who);
  1730.           return false;
  1731.   }
  1732.  
  1733. + /* In MSDOS, we have a few signals.     */
  1734. + /* So, we set signal handlar for only SIGINT. $Author: lfk $    */
  1735.  
  1736. + #ifdef MSDOS
  1737. + void catchsig(void)
  1738. + #else
  1739.   static SIGNAL_TYPE catchsig(s)
  1740. + #endif /* MSDOS */
  1741.   {
  1742.       ignoreints();
  1743.           diagnose("\nRCS: cleaning up\n");
  1744. ***************
  1745. *** 310,341 ****
  1746.   #endif
  1747.   }
  1748.  
  1749.   static sig[] = {SIGINT,SIGHUP,SIGQUIT,SIGPIPE,SIGTERM};
  1750.   #define SIGS (sizeof(sig)/sizeof(*sig))
  1751.   static SIGNAL_TYPE (*catcher[SIGS])();
  1752. !
  1753.     void catchints()
  1754.     {
  1755.       register i;
  1756.       for (i=SIGS; 0<=--i; )
  1757.           catcher[i]  =
  1758.           signal(sig[i],SIG_IGN) == SIG_IGN  ?  SIG_IGN  :  catchsig;
  1759.       restoreints();
  1760.     }
  1761.  
  1762.     void ignoreints()
  1763.     {
  1764.       register i;
  1765.       for (i=SIGS; 0<=--i; )
  1766.           VOID signal(sig[i], SIG_IGN);
  1767.     }
  1768.  
  1769.   void restoreints()
  1770.   {
  1771.       register i;
  1772.       for (i=SIGS; 0<=--i; )
  1773.           if (catcher[i] != SIG_IGN)
  1774.               VOID signal(sig[i], catcher[i]);
  1775.   }
  1776.  
  1777.   fastcopy(inf,outf)
  1778. --- 345,390 ----
  1779.   #endif
  1780.   }
  1781.  
  1782. + #ifndef MSDOS
  1783.   static sig[] = {SIGINT,SIGHUP,SIGQUIT,SIGPIPE,SIGTERM};
  1784.   #define SIGS (sizeof(sig)/sizeof(*sig))
  1785.   static SIGNAL_TYPE (*catcher[SIGS])();
  1786. ! #endif /* NOT MSDOS */
  1787.     void catchints()
  1788.     {
  1789. + #ifdef MSDOS
  1790. +     signal(SIGINT, catchsig); /* $Author: lfk $ fixed this so Ctrl-C halts processing */
  1791. +     restoreints();
  1792. + #else
  1793.       register i;
  1794.       for (i=SIGS; 0<=--i; )
  1795.           catcher[i]  =
  1796.           signal(sig[i],SIG_IGN) == SIG_IGN  ?  SIG_IGN  :  catchsig;
  1797.       restoreints();
  1798. + #endif /* MSDOS */
  1799.     }
  1800.  
  1801.     void ignoreints()
  1802.     {
  1803. + #ifdef MSDOS
  1804. +     VOID signal(SIGINT, SIG_IGN);
  1805. + #else
  1806.       register i;
  1807.       for (i=SIGS; 0<=--i; )
  1808.           VOID signal(sig[i], SIG_IGN);
  1809. + #endif /* MSDOS */
  1810.     }
  1811.  
  1812.   void restoreints()
  1813.   {
  1814. + #ifdef MSDOS
  1815. +     VOID signal(SIGINT, catchsig);
  1816. + #else
  1817.       register i;
  1818.       for (i=SIGS; 0<=--i; )
  1819.           if (catcher[i] != SIG_IGN)
  1820.               VOID signal(sig[i], catcher[i]);
  1821. + #endif /* MSDOS */
  1822.   }
  1823.  
  1824.   fastcopy(inf,outf)
  1825. ***************
  1826. *** 455,460 ****
  1827. --- 504,525 ----
  1828.   static int run_back(inoutargs)
  1829.       char **inoutargs;
  1830.   {
  1831. + #ifdef MSDOS
  1832. +     int result, si, so;
  1833. +
  1834. +     if (fflush(stdout) == EOF  ||  fflush(stderr) == EOF)
  1835. +         return -1;
  1836. +         si = dup(0);
  1837. +         so = dup(1);
  1838. +     tryopen(fileno(stdin), inoutargs[0], 0);
  1839. +     tryopen(fileno(stdout), inoutargs[1], -1);
  1840. +     result = spawnvp( 0, inoutargs[2], &inoutargs[2] );
  1841. +     dup2(si, 0);
  1842. +     dup2(so, 1);
  1843. +         close(si);
  1844. +         close(so);
  1845. +     return result;
  1846. + #else
  1847.       int pid;
  1848.       register char **p;
  1849.       if (fflush(stdout) == EOF  ||  fflush(stderr) == EOF)
  1850. ***************
  1851. *** 473,478 ****
  1852. --- 538,544 ----
  1853.           _exit(2);
  1854.       }
  1855.       return pid;
  1856. + #endif /* MSDOS */
  1857.   }
  1858.  
  1859.   #define CARGSMAX 20
  1860. ***************
  1861. *** 498,508 ****
  1862. --- 564,593 ----
  1863.       }
  1864.       va_end(ap);
  1865.       pid = run_back(rgargs);
  1866. + #ifndef MSDOS
  1867.       if (pid < 0)
  1868. + #endif /* MSDOS */
  1869.           return pid;
  1870. + #ifndef MSDOS
  1871.       for (;;)
  1872.           if ((w = wait(&wstatus)) < 0)
  1873.               return w;
  1874.           else if (w == pid)
  1875.               return wstatus;
  1876. + #endif /* NOT MSDOS */
  1877. + }
  1878. +
  1879. + #ifdef MSDOS
  1880. + int Rename( from, to )
  1881. + char    *from;
  1882. + char    *to;
  1883. + {
  1884. +     if ( access( to, 0 ) == 0 ) {
  1885. +         if ( chmod( to, S_IWRITE | S_IREAD ) == -1 )
  1886. +             return (-1);
  1887. +         if ( unlink(to) != 0 )
  1888. +             return (-1);
  1889. +     }
  1890. +         return ( rename( from, to ) );
  1891.   }
  1892. + #endif /* MSDOS */
  1893.