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