tools/adflib: build only host variant which is used by Sam440 target
[AROS.git] / workbench / network / stacks / AROSTCP / netlib / perror.c
blob191f8b7cc6a126dd63fdbddc46fbb9aa6d28e7b9
1 /* $Id$
3 * perror.c - print error message
5 * Copyright © 1994 AmiTCP/IP Group,
6 * Network Solutions Development Inc.
7 * All rights reserved.
8 */
10 /****** net.lib/perror *******************************************************
12 NAME
13 perror - socket error messages
15 SYNOPSIS
16 extern int errno;
18 #include <stdio.h>
20 perror(banner)
21 void perror(const char *)
23 FUNCTION
24 The perror() function finds the error message corresponding to the
25 current value of the global variable errno and writes it, followed
26 by a newline, to the stderr. If the argument string is non-NULL it
27 is preappended to the message string and separated from it by a
28 colon and space (`: '). If string is NULL only the error message
29 string is printed.
31 NOTES
32 The perror() function requires the stdio functions to be linked.
34 SEE ALSO
35 strerror(), PrintNetFault(), <netinclude:sys/errno.h>
37 ******************************************************************************
40 #include <stdio.h>
41 #include <errno.h>
42 #include <string.h>
43 #include <clib/netlib_protos.h>
45 void
46 perror(const char *banner)
48 const char *err = strerror(errno);
50 if (banner != NULL) {
51 fputs(banner, stderr);
52 fputs(": ", stderr);
54 fputs(err, stderr);
55 fputc('\n', stderr);
56 fflush(stderr);