home *** CD-ROM | disk | FTP | other *** search
/ Source Code 1992 March / Source_Code_CD-ROM_Walnut_Creek_March_1992.iso / usenet / altsrcs / 3 / 3297 / printfamily.c < prev    next >
Encoding:
C/C++ Source or Header  |  1991-05-07  |  1.5 KB  |  85 lines

  1. /* History:
  2. 5/1/91 DJB baseline public domain
  3. */
  4.  
  5. /*
  6.  
  7. char *printfamily(family) int family; returns a string representation of
  8. the given address family, or 0 if the family is unrecognized. The string
  9. returned might not be malloced but will not be overwritten on separate
  10. calls.
  11.  
  12. */
  13.  
  14. #include "structsocket.h"
  15. #include "printfamily.h"
  16.  
  17. char *printfamily(family)
  18. int family;
  19. {
  20.  switch(family)
  21.   {
  22. #ifdef AF_UNSPEC
  23.    case AF_UNSPEC: return "unspec";
  24. #endif
  25. #ifdef AF_UNIX
  26.    case AF_UNIX: return "unix";
  27. #endif
  28. #ifdef AF_INET
  29.    case AF_INET: return "internet";
  30. #endif
  31. #ifdef AF_IMPLINK
  32.    case AF_IMPLINK: return "implink";
  33. #endif
  34. #ifdef AF_PUP
  35.    case AF_PUP: return "pup";
  36. #endif
  37. #ifdef AF_CHAOS
  38.    case AF_CHAOS: return "chaos";
  39. #endif
  40. #ifdef AF_NS
  41.    case AF_NS: return "ns";
  42. #endif
  43. #ifdef AF_NBS
  44.    case AF_NBS: return "nbs";
  45. #endif
  46. #ifdef AF_ECMA
  47.    case AF_ECMA: return "ecma";
  48. #endif
  49. #ifdef AF_DATAKIT
  50.    case AF_DATAKIT: return "datakit";
  51. #endif
  52. #ifdef AF_CCITT
  53.    case AF_CCITT: return "ccitt";
  54. #endif
  55. #ifdef AF_SNA
  56.    case AF_SNA: return "sna";
  57. #endif
  58. #ifdef AF_DECnet
  59.    case AF_DECnet: return "decnet";
  60. #endif
  61. #ifdef AF_DLI
  62.    case AF_DLI: return "dli";
  63. #endif
  64. #ifdef AF_LAT
  65.    case AF_LAT: return "lat";
  66. #endif
  67. #ifdef AF_HYLINK
  68.    case AF_HYLINK: return "hylink";
  69. #endif
  70. #ifdef AF_APPLETALK
  71.    case AF_APPLETALK: return "appletalk";
  72. #endif
  73. #ifdef AF_BSC
  74.    case AF_BSC: return "bsc";
  75. #endif
  76. #ifdef AF_DSS
  77.    case AF_DSS: return "dss";
  78. #endif
  79. #ifdef AF_OSI
  80.    case AF_OSI: return "osi";
  81. #endif
  82.    default: return 0;
  83.   }
  84. }
  85.