Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!usc!ucla-cs!twinsun!eggert From: eggert@twinsun.twinsun.com (Paul Eggert) Newsgroups: comp.unix.wizards Subject: Re: rcs exit status Keywords: rcs Message-ID: <22@looney.twinsun.com> Date: 3 Aug 89 02:14:51 GMT References: <3693@cayman.COM> Sender: news@twinsun.com Reply-To: eggert@twinsun.com (Paul Eggert) Organization: Twin Sun Inc. Lines: 47 beth@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);