cmd-inet/usr.sbin: remove -Wno-implicit-function-declaration
[unleashed.git] / usr / src / cmd / ramdiskadm / utils.c
blob4e00b9158de0e130b2d734f3914dcf53a4b7702b
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License, Version 1.0 only
6 * (the "License"). You may not use this file except in compliance
7 * with the License.
9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10 * or http://www.opensolaris.org/os/licensing.
11 * See the License for the specific language governing permissions
12 * and limitations under the License.
14 * When distributing Covered Code, include this CDDL HEADER in each
15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16 * If applicable, add the following below this CDDL HEADER, with the
17 * fields enclosed by brackets "[]" replaced with your own identifying
18 * information: Portions Copyright [yyyy] [name of copyright owner]
20 * CDDL HEADER END
23 * Copyright 2002-2003 Sun Microsystems, Inc. All rights reserved.
24 * Use is subject to license terms.
27 #pragma ident "%Z%%M% %I% %E% SMI"
29 #include <sys/types.h>
30 #include <sys/param.h>
31 #include <sys/stat.h>
32 #include <sys/statvfs.h>
33 #include <sys/sysmacros.h>
34 #include <libintl.h>
35 #include <libgen.h>
36 #include <string.h>
37 #include <stdlib.h>
38 #include <stdarg.h>
39 #include <stdio.h>
40 #include <errno.h>
42 #include "utils.h"
44 static char *pname = NULL;
46 /*PRINTFLIKE1*/
47 void
48 warn(const char *format, ...)
50 int err = errno;
51 va_list alist;
53 if (pname != NULL)
54 (void) fprintf(stderr, gettext("%s: "), pname);
56 va_start(alist, format);
57 (void) vfprintf(stderr, format, alist);
58 va_end(alist);
60 if (strchr(format, '\n') == NULL)
61 (void) fprintf(stderr, gettext(": %s\n"), strerror(err));
64 /*PRINTFLIKE1*/
65 void
66 die(const char *format, ...)
68 int err = errno;
69 va_list alist;
71 if (pname != NULL)
72 (void) fprintf(stderr, gettext("%s: "), pname);
74 va_start(alist, format);
75 (void) vfprintf(stderr, format, alist);
76 va_end(alist);
78 if (strchr(format, '\n') == NULL)
79 (void) fprintf(stderr, gettext(": %s\n"), strerror(err));
81 exit(E_ERROR);
84 char *
85 getpname(char *arg0)
87 if (pname == NULL)
88 pname = basename(arg0);
89 return (pname);