From owner-freebsd-bugs Thu Jun 10 15:34: 6 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from smtp11.bellglobal.com (smtp11.bellglobal.com [204.101.251.53]) by hub.freebsd.org (Postfix) with ESMTP id E797714BE5 for ; Thu, 10 Jun 1999 15:34:03 -0700 (PDT) (envelope-from vanderh@ecf.toronto.edu) Received: from localhost.nowhere (ppp18395.on.bellglobal.com [206.172.130.75]) by smtp11.bellglobal.com (8.8.5/8.8.5) with ESMTP id SAA02707; Thu, 10 Jun 1999 18:36:52 -0400 (EDT) Received: (from tim@localhost) by localhost.nowhere (8.9.3/8.9.1) id SAA02038; Thu, 10 Jun 1999 18:34:19 -0400 (EDT) (envelope-from tim) Date: Thu, 10 Jun 1999 18:34:19 -0400 From: Tim Vanderhoek To: Sheldon Hearn Cc: "Ronald F. Guilmette" , freebsd-bugs@FreeBSD.ORG Subject: Re: bin/11987: vacation(1) documentation and error logging both suck Message-ID: <19990610183419.B1476@mad> References: <19990610163201.A1147@mad> <81562.929050812@axl.noc.iafrica.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.95i In-Reply-To: <81562.929050812@axl.noc.iafrica.com>; from Sheldon Hearn on Thu, Jun 10, 1999 at 11:40:12PM +0200 Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org 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