provide more detailed messages with -l. From Anon Ymous

This commit is contained in:
christos 2007-08-21 14:09:53 +00:00
parent faafe7834a
commit dc2a5030fc
3 changed files with 20 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.6 2006/06/03 18:55:02 christos Exp $ */
/* $NetBSD: extern.h,v 1.7 2007/08/21 14:09:53 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -39,5 +39,6 @@ void c_regular(int, char *, off_t, off_t, int, char *, off_t, off_t);
void c_special(int, char *, off_t, int, char *, off_t);
void diffmsg(char *, char *, off_t, off_t);
void eofmsg(char *, off_t, off_t);
void errmsg(char *, off_t, off_t);
extern int lflag, sflag;

View File

@ -1,4 +1,4 @@
/* $NetBSD: misc.c,v 1.9 2006/06/03 18:55:02 christos Exp $ */
/* $NetBSD: misc.c,v 1.10 2007/08/21 14:09:54 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)misc.c 8.3 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: misc.c,v 1.9 2006/06/03 18:55:02 christos Exp $");
__RCSID("$NetBSD: misc.c,v 1.10 2007/08/21 14:09:54 christos Exp $");
#endif
#endif /* not lint */
@ -46,6 +46,16 @@ __RCSID("$NetBSD: misc.c,v 1.9 2006/06/03 18:55:02 christos Exp $");
#include "extern.h"
void
errmsg(char *file, off_t byte, off_t line)
{
if (lflag)
err(ERR_EXIT, "%s: char %llu, line %llu", file,
(unsigned long long)byte, (unsigned long long)line);
else
err(ERR_EXIT, "%s", file);
}
void
eofmsg(char *file, off_t byte, off_t line)
{

View File

@ -1,4 +1,4 @@
/* $NetBSD: special.c,v 1.11 2006/06/03 18:55:02 christos Exp $ */
/* $NetBSD: special.c,v 1.12 2007/08/21 14:09:54 christos Exp $ */
/*-
* Copyright (c) 1991, 1993, 1994
@ -34,7 +34,7 @@
#if 0
static char sccsid[] = "@(#)special.c 8.3 (Berkeley) 4/2/94";
#else
__RCSID("$NetBSD: special.c,v 1.11 2006/06/03 18:55:02 christos Exp $");
__RCSID("$NetBSD: special.c,v 1.12 2007/08/21 14:09:54 christos Exp $");
#endif
#endif /* not lint */
@ -94,10 +94,11 @@ c_special(int fd1, char *file1, off_t skip1, int fd2, char *file2, off_t skip2)
++line;
}
eof: if (ferror(fp1))
err(ERR_EXIT, "%s", file1);
eof:
if (ferror(fp1))
errmsg(file1, byte, line);
if (ferror(fp2))
err(ERR_EXIT, "%s", file2);
errmsg(file2, byte, line);
if (feof(fp1)) {
if (!feof(fp2))
eofmsg(file1, byte, line);