Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 10 Jun 1999 18:34:19 -0400
From:      Tim Vanderhoek <vanderh@ecf.utoronto.ca>
To:        Sheldon Hearn <sheldonh@uunet.co.za>
Cc:        "Ronald F. Guilmette" <rfg@monkeys.com>, freebsd-bugs@FreeBSD.ORG
Subject:   Re: bin/11987: vacation(1) documentation and error logging both suck
Message-ID:  <19990610183419.B1476@mad>
In-Reply-To: <81562.929050812@axl.noc.iafrica.com>; from Sheldon Hearn on Thu, Jun 10, 1999 at 11:40:12PM %2B0200
References:  <19990610163201.A1147@mad> <81562.929050812@axl.noc.iafrica.com>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, Jun 10, 1999 at 11:40:12PM +0200, Sheldon Hearn wrote:
> 
> +		case 'd':			/* debug mode */
> +			msglog = &flog;
> +			break;

if (istty(STDERR_FILENO))
	msglog = &slog;

[+ appropriate manpage change]


>  
> +	if (msglog == &flog && !(logfp = fopen(LOGFILE, "a+")))
> +		printf("vacation: %s: %s\n", LOGFILE, strerror(errno));
> +

Any reason for not sending this to stderr with fprintf()?  [I don't
know what sendmail does with output to stderr].


> +/*
> + * Append a message to a logfile in the user's home directory for ease
> + * of debugging.
> + */
> +static void
> +flog(int i, const char *fmt, ...)
> +{
> +	va_list ap;
> +
> +	i = 0;			/* Printing syslog priority not implemented */
> +	va_start(ap, fmt);
> +	if (logfp)
> +		fprintf(logfp, fmt, ap);
> +	else
> +		vfprintf(stderr, fmt, ap);
> +	va_end(ap);
>  }

/* ... */
slog(int i, const char*fmt, ...)
{
	va_list ap;
	va_start (ap, fmt);
	vfprintf(stderr, ap);
	va_end (ap);
}

[Makes life easier for people quickly checking that all is good...]

Looks good.  Assuming no objections from Ronald, do you want to commit
this, Sheldon, or shall I?

One other thing....  OpenBSD checks for a Return-Path header in
addition to a From header.  Is this a good thing or a bad thing?  I
don't know my RFC well enough.

Ah, there's a malloc() in there, too, that just exits without an error
message.  Easy to fix that, too (not that malloc() should often fail
when running vacation(1)... :-).


-- 
This is my .signature which gets appended to the end of my messages.


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-bugs" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19990610183419.B1476>