beth@cayman.COM (Beth Miaoulis) (07/29/89)
Hello, I am writing some csh scripts which use the rcs system to control our software development and I ran into something which reflects either a misunderstanding on my part or a bug in rcs.c (rev 4). 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. 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? If so, any suggestions for how I can detect if rcs fails without reading stdout? Thank you, Beth Miaoulis P.S. Where's the best place to send rcs questions? Does Walter Tichy still care? -- ----- Beth Miaoulis (beth@cayman.com) Cayman Systems, Inc. (617)494-1999
eggert@twinsun.twinsun.com (Paul Eggert) (08/03/89)
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);