|
Last change
on this file since 18 was 18, checked in by bird, 23 years ago |
|
Initial revision
|
-
Property cvs2svn:cvs-rev
set to
1.1
-
Property svn:eol-style
set to
native
-
Property svn:executable
set to
*
|
|
File size:
820 bytes
|
| Line | |
|---|
| 1 | /* herror.c (emx+gcc) -- Copyright (c) 1994 by Eberhard Mattes */
|
|---|
| 2 |
|
|---|
| 3 | #include <stdio.h>
|
|---|
| 4 | #include <sys/types.h>
|
|---|
| 5 | #include <netdb.h>
|
|---|
| 6 |
|
|---|
| 7 | extern int h_errno;
|
|---|
| 8 |
|
|---|
| 9 | void herror (const char *string)
|
|---|
| 10 | {
|
|---|
| 11 | int e = h_errno;
|
|---|
| 12 | const char *msg;
|
|---|
| 13 |
|
|---|
| 14 | if (string != NULL && *string != 0)
|
|---|
| 15 | {
|
|---|
| 16 | fputs (string, stderr);
|
|---|
| 17 | fputs (": ", stderr);
|
|---|
| 18 | }
|
|---|
| 19 | switch (e)
|
|---|
| 20 | {
|
|---|
| 21 | case 0:
|
|---|
| 22 | msg = "Error 0";
|
|---|
| 23 | break;
|
|---|
| 24 | case HOST_NOT_FOUND:
|
|---|
| 25 | msg = "Host not found";
|
|---|
| 26 | break;
|
|---|
| 27 | case TRY_AGAIN:
|
|---|
| 28 | msg = "Host name lookup failure";
|
|---|
| 29 | break;
|
|---|
| 30 | case NO_RECOVERY:
|
|---|
| 31 | msg = "Unknown server error";
|
|---|
| 32 | break;
|
|---|
| 33 | case NO_DATA:
|
|---|
| 34 | msg = "No address associated with name";
|
|---|
| 35 | break;
|
|---|
| 36 | default:
|
|---|
| 37 | fprintf (stderr, "Unknown error %d\n", e);
|
|---|
| 38 | return;
|
|---|
| 39 | }
|
|---|
| 40 | fputs (msg, stderr);
|
|---|
| 41 | fputc ('\n', stderr);
|
|---|
| 42 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.