summaryrefslogtreecommitdiffstats
path: root/usr.bin/rpcgen/rpc_util.c
diff options
context:
space:
mode:
authorcharnier <charnier@FreeBSD.org>1997-08-06 06:47:41 +0000
committercharnier <charnier@FreeBSD.org>1997-08-06 06:47:41 +0000
commit4dfc83bbfada9199ece96a93eddf345a747b6271 (patch)
treee4b3fd234e4535104deb383b08ed503b38652568 /usr.bin/rpcgen/rpc_util.c
parent5f9cb6429dd14c9977c8dfee9f1243a5e02920e4 (diff)
downloadFreeBSD-src-4dfc83bbfada9199ece96a93eddf345a747b6271.zip
FreeBSD-src-4dfc83bbfada9199ece96a93eddf345a747b6271.tar.gz
Use err(3), cosmetic in usage(), remove `cmdname'.
Diffstat (limited to 'usr.bin/rpcgen/rpc_util.c')
-rw-r--r--usr.bin/rpcgen/rpc_util.c25
1 files changed, 12 insertions, 13 deletions
diff --git a/usr.bin/rpcgen/rpc_util.c b/usr.bin/rpcgen/rpc_util.c
index 1ade911..175cf29 100644
--- a/usr.bin/rpcgen/rpc_util.c
+++ b/usr.bin/rpcgen/rpc_util.c
@@ -30,16 +30,21 @@
#ident "@(#)rpc_util.c 1.14 93/07/05 SMI"
#ifndef lint
+#if 0
static char sccsid[] = "@(#)rpc_util.c 1.11 89/02/22 (C) 1987 SMI";
#endif
+static const char rcsid[] =
+ "$Id$";
+#endif
/*
* rpc_util.c, Utility routines for the RPC protocol compiler
* Copyright (C) 1989, Sun Microsystems, Inc.
*/
+#include <err.h>
+#include <ctype.h>
#include <stdio.h>
#include <string.h>
-#include <ctype.h>
#include <unistd.h>
#include "rpc_scan.h"
#include "rpc_parse.h"
@@ -275,8 +280,7 @@ error(msg)
char *msg;
{
printwhere();
- f_print(stderr, "%s, line %d: ", infilename, linenum);
- f_print(stderr, "%s\n", msg);
+ warnx("%s, line %d: %s", infilename, linenum, msg);
crash();
}
@@ -302,7 +306,7 @@ record_open(file)
if (nfiles < NFILES) {
outfiles[nfiles++] = file;
} else {
- f_print(stderr, "too many files!\n");
+ warnx("too many files");
crash();
}
}
@@ -459,10 +463,8 @@ make_argname(pname, vname)
char *name;
name = malloc(strlen(pname) + strlen(vname) + strlen(ARGEXT) + 3);
- if (!name) {
- fprintf(stderr, "failed in malloc");
- exit(1);
- }
+ if (!name)
+ errx(1, "failed in malloc");
sprintf(name, "%s_%s_%s", locase(pname), vname, ARGEXT);
return (name);
}
@@ -477,11 +479,8 @@ char *type;
{
bas_type *ptr;
- if ((ptr = (bas_type *) malloc(sizeof (bas_type))) ==
- (bas_type *)NULL) {
- fprintf(stderr, "failed in malloc");
- exit(1);
- }
+ if ((ptr = (bas_type *) malloc(sizeof (bas_type))) == (bas_type *)NULL)
+ errx(1, "failed in malloc");
ptr->name = type;
ptr->length = len;
OpenPOWER on IntegriCloud