Make all bucket and overflow addresses unsigned
[unix-history] / usr / src / lib / libc / stdio / perror.c
CommitLineData
bb0cfa24 1/*
74e67efa
KB
2 * Copyright (c) 1988 Regents of the University of California.
3 * All rights reserved.
4 *
269a7923 5 * %sccs.include.redist.c%
bb0cfa24
DF
6 */
7
2ce81398 8#if defined(LIBC_SCCS) && !defined(lint)
cb631443 9static char sccsid[] = "@(#)perror.c 5.11 (Berkeley) %G%";
74e67efa 10#endif /* LIBC_SCCS and not lint */
bb0cfa24 11
df5b5637
SL
12#include <sys/types.h>
13#include <sys/uio.h>
90793b84 14#include <unistd.h>
cb631443
KB
15#include <errno.h>
16#include <stdio.h>
90793b84 17#include <string.h>
716337de 18
cb631443 19void
716337de 20perror(s)
cb631443 21 const char *s;
716337de 22{
8156daf7 23 register struct iovec *v;
df5b5637 24 struct iovec iov[4];
716337de 25
8156daf7 26 v = iov;
df5b5637 27 if (s && *s) {
cb631443 28 v->iov_base = (char *)s;
df5b5637
SL
29 v->iov_len = strlen(s);
30 v++;
31 v->iov_base = ": ";
32 v->iov_len = 2;
33 v++;
716337de 34 }
8156daf7 35 v->iov_base = strerror(errno);
df5b5637
SL
36 v->iov_len = strlen(v->iov_base);
37 v++;
38 v->iov_base = "\n";
39 v->iov_len = 1;
90793b84 40 (void)writev(STDERR_FILENO, iov, (v - iov) + 1);
716337de 41}