Revised patch attached.One change that I made while working on the self-test logic was to split the output parsing logic into parse_output.cpp/h. I suspect you'll have a better name for the file. That was bundled into this patch as I didn't take the time to back those changes out.
--Andrew Black Martin Sebor wrote:
Andrew Black wrote:Greetings all Attached is a slightly modified version of the patch from yesterday. Changes from the previous version: - Compatibility layer support (via --compat/--nocompat switches) - Handle failure to fork()I suspect that some changes may be required before submission, but I also consider this to be in a mostly usable state.[...] Very good! We do need to make a few changes. One is making sure it's (also) valid C++ (since it's now being compiled with C++ compilers). I suspect gcc might let it slide but sigaction() is a C interface that takes a C (i.e., extern "C") function, so handle_alrm() needs to be decorated with extern "C" in C++ (i.e., when __cplusplus is #defined). The other change I'd like to make is to the names of some of the files :) Here's what I'm thinking: watchdog.{cpp,h} --> exec.{cpp,h} parse_opts.{cpp,h} --> cmdopt.{cpp,h} util.{cpp,h} --> ??? I'm not too fond of files named util etc. because they end up being collections of all kinds of odds and ends that don't seem to fit anywhere else, and make a convenient excuse not thinking about the logical organization of a program. We have two functions in util.cpp: terminate() (which should be renamed to something that better expresses the purpose of the function -- i.e., to issue a diagnostic *and* then [maybe] exit), and rw_basename(), the replacement for the UNIX basename(). rw_basename() is only called from runall.c, so it might as well be defined (static) there. terminate() could go in its own file, say diag.{cpp,h}, after being renamed to something like issue_diag(). The whole program should use issue_diag() for all types of diagnostic messages, i.e, for both errors and warnings (with the distinction being that the latter don't cause the program to exit with a non-zero status but allow it to continue). There are other tweaks that I'd like to make to the code but those can be made after the commit. The file name changes should be made prior to it. Could you make the naming changes and resubmit the patch? Also, in your ChangeLog, please avoid using wildcards instead of file names and instead spell out the name of each file in full. Thanks! Martin
runall.diff.gz
Description: GNU Zip compressed data
