Use err(3). Add DIAGNOSTIC section name in man page.

This commit is contained in:
Philippe Charnier 1997-06-30 06:40:16 +00:00
parent 3b5ec5aa63
commit 0e25805f2f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=27094
2 changed files with 8 additions and 9 deletions

View File

@ -80,7 +80,7 @@ printed in column number three will have one.
.Nm Comm
assumes that the files are lexically sorted; all characters
participate in line comparisons.
.Pp
.Sh DIAGNOSTICS
.Nm Comm
exits 0 on success, >0 if an error occurred.
.Sh SEE ALSO
@ -91,4 +91,5 @@ exits 0 on success, >0 if an error occurred.
.Sh STANDARDS
The
.Nm comm
command is expected to be POSIX 1003.2 compatible.
utility conforms to
.St -p1003.2-92 .

View File

@ -44,9 +44,9 @@ static char copyright[] =
static char sccsid[] = "@(#)comm.c 8.4 (Berkeley) 5/4/95";
#endif /* not lint */
#include <fcntl.h>
#include <limits.h>
#include <err.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -58,7 +58,7 @@ char *tabs[] = { "", "\t", "\t\t" };
FILE *file __P((char *));
void show __P((FILE *, char *, char *));
void usage __P((void));
static void usage __P((void));
int
main(argc, argv)
@ -172,16 +172,14 @@ file(name)
if (!strcmp(name, "-"))
return (stdin);
if ((fp = fopen(name, "r")) == NULL) {
(void)fprintf(stderr, "comm: %s: %s\n", name, strerror(errno));
exit(1);
err(1, "%s", name);
}
return (fp);
}
void
static void
usage()
{
(void)fprintf(stderr, "usage: comm [-123] file1 file2\n");
exit(1);
}