home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 8
/
FreshFishVol8-CD1.bin
/
useful
/
comm
/
tcp
/
amitcp
/
src
/
netlib
/
herror.c
< prev
next >
Wrap
C/C++ Source or Header
|
1994-04-02
|
2KB
|
69 lines
RCS_ID_C = "$Id: herror.c,v 3.2 1994/02/26 17:57:21 jraja Exp $";
/*
* herror.c -- print host error message
*
* Author: jraja <Jarno.Rajahalme@hut.fi>
*
* Copyright © 1994 AmiTCP/IP Group, <AmiTCP-Group@hut.fi>
* Helsinki University of Technology, Finland.
*
* Created : Wed Feb 16 09:38:17 1994 jraja
* Last modified: Sun Feb 27 03:45:29 1994 ppessi
*
*/
/****** net.lib/herror *******************************************************
NAME
herror - print name resolver error message to stderr.
SYNOPSIS
#include <stdio.h>
herror(banner)
void herror(const char *)
FUNCTION
The herror() function finds the error message corresponding to the
current value of host error using the SocketBaseTags() and writes
it, followed by a newline, to the stderr. If the argument string
is non-NULL it is used as a prefix to the message string and
separated from it by a colon and space (`: '). If the argument is
NULL only the error message string is printed.
NOTES
The herror() function requires the stdio functions to be linked.
SEE ALSO
<netinclude:netdb.h>, SocketBaseTagList(), perror()
******************************************************************************
*/
#include <stdio.h>
#include <string.h>
#include <bsdsocket.h>
#include <amitcp/socketbasetags.h>
void
herror(const char *banner)
{
const char *err;
/*
* First fetch the h_errno value to (ULONG)err, and then convert it to
* error string pointer.
*/
SocketBaseTags(SBTM_GETREF(SBTC_HERRNO), &err,
SBTM_GETREF(SBTC_HERRNOSTRPTR), &err,
TAG_END);
if (banner != NULL) {
fputs(banner, stderr);
fputs(": ", stderr);
}
fputs(err, stderr);
fputc('\n', stderr);
fflush(stderr);
}