rcs exit status

Paul Eggert eggert at twinsun.twinsun.com
Thu Aug 3 12:14:51 AEST 1989


beth at cayman.COM (Beth Miaoulis) writes:

|I was expecting the rcs command to have a non-zero exit status if it
|failed because the last RCS file specified does not exist.

The RCS documentation is out of date here.  In RCS version 4, a command
has a nonzero status if it failed because a requested operation failed on
_some_ file, not necessarily the last one.

|In rcs.c it seems that a 0 return from pairfilenames, will allow the
|for-each-file do loop to continue, yet will mask any error returned.
|Is this how things are supposed to work?

No.  Here is a fix.  Your line numbers may differ.

***************
*** 584,589 ****
--- 587,593 ----
                  newRCSfilename[0] = '\0';  /*  avoid deletion by cleanup  */
                  restoreints();
                  VOID cleanup();
+ 		status = 1;
                  break;
              }
              newRCSfilename[0]='\0'; /* avoid re-unlinking by cleanup()*/
***************
*** 599,608 ****
              diagnose("done");
          } else {
  	    diagnose("%s aborted; %s unchanged.",cmdid,RCSfilename);
- 	    status = 1;
- 	    nerror = 0;
          }
!         } while (cleanup(),
                   ++argv, --argc >=1);
  
          exit(status);
--- 603,611 ----
              diagnose("done");
          } else {
  	    diagnose("%s aborted; %s unchanged.",cmdid,RCSfilename);
          }
!         } while ((nerror  ?  (status=1, nerror=0)  :  0),
! 		 cleanup(),
                   ++argv, --argc >=1);
  
          exit(status);



More information about the Comp.unix.wizards mailing list