rick@ariel.UUCP (08/10/84)
EASY PROBLEM (and FIX): USG 5.0 "uucico" has a minor, but annoying, bug in one of its' "DEBUG" statements - It displays the wrong value. In "us_sst.c", the offending code is reflected in the following "diff(1)" example. "<" represents the existing code and ">" shows the bug fix. 41c41 < DEBUG(3, "fopen of %s failed\n", LCKLSTAT); --- > DEBUG(3, "fopen of %s failed\n", L_stat); HARDER PROBLEM (and suggested FIX): Most of the DEBUG() and ASSERT() statements could use an embellishment that would give useful error information when a system call error occurs. For example, "fopen of ... failed", by itself does not indicate the root of the problem, however "fopen of ... failed: permission denied" or "fopen of ... failed: no such file or directory", yields more useful information. The implementation of this feature would require the following: uucp.h: 66c66,71 < #define DEBUG(l, f, s) if (Debug >= l) fprintf(stderr, f, s) --- > extern int errno; > #define DEBUG(l, f, s) if (Debug >= l) { \ > fprintf(stderr, f, s); \ > if (errno) perror(""); \ > else fprintf(stderr, "\n"); \ > } ASSERT() changes would be handled in a similar fashion. Furthermore, all ASSERT() and DEBUG() calls must have the trailing newlines removed, e.g.: < DEBUG(3, "fopen of %s failed\n", L_stat); --- > DEBUG(3, "fopen of %s failed", L_stat); ONE MORE SUGGESTION: For the sake of identifying imbedded spaces and tabs, a generally common and annoying problem, it would be helpful if diagnostics were further refined to delimit strings as such. For example, ``fopen of ... failed'' would become ``fopen of "..." failed''. This would be realized through: < DEBUG(3, "fopen of %s failed", L_stat); --- > DEBUG(3, "fopen of \"%s\" failed", L_stat); Richard L. Maus, Jr. (Rick) AT&T-IS(@BTL) HO 1K313 201-834-4532 ...!ho???!ariel!rick