Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 6/24/83; site ariel.UUCP
Path: utzoo!watmath!clyde!burl!ulysses!mhuxl!houxm!hogpc!houti!ariel!rick
From: rick@ariel.UUCP
Newsgroups: net.bugs.uucp
Subject: "uucico" debug information fix and suggested enhancements
Message-ID: <715@ariel.UUCP>
Date: Fri, 10-Aug-84 10:36:11 EDT
Article-I.D.: ariel.715
Posted: Fri Aug 10 10:36:11 1984
Date-Received: Sat, 11-Aug-84 00:29:50 EDT
Organization: AT&T-ISL, Holmdel, NJ
Lines: 53

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