Back to index

glibc  2.9
Classes | Defines | Functions | Variables
gai_strerror.c File Reference
#include <libintl.h>
#include <netdb.h>
#include <stdint.h>
#include <stdio.h>
#include "gai_strerror-strs.h"

Go to the source code of this file.


union  msgstr_t
struct  msgstr_t.__unnamed__


#define MSGSTRFIELD(line)   MSGSTRFIELD1 (line)
#define MSGSTRFIELD1(line)   str##line
#define _S(n, s)   char MSGSTRFIELD(__LINE__)[sizeof (s)];
#define _S(n, s)   s,
#define _S(n, s)   { n, offsetof (union msgstr_t, MSGSTRFIELD (__LINE__)) },


const char * gai_strerror (int code)


static union msgstr_t msgstr
struct {
int16_t code
uint16_t idx
msgidx []

Class Documentation

union msgstr_t

Definition at line 29 of file nis_error.c.

Class Members
struct msgstr_t __unnamed__
struct msgstr_t __unnamed__
char str
struct msgstr_t.__unnamed__

Definition at line 30 of file gai_strerror.c.

Define Documentation

#define _S (   n,
)    char MSGSTRFIELD(__LINE__)[sizeof (s)];

Definition at line 32 of file gai_strerror.c.

#define _S (   n,
)    s,

Definition at line 32 of file gai_strerror.c.

#define _S (   n,
)    { n, offsetof (union msgstr_t, MSGSTRFIELD (__LINE__)) },

Definition at line 32 of file gai_strerror.c.

#define MSGSTRFIELD (   line)    MSGSTRFIELD1 (line)

Definition at line 26 of file gai_strerror.c.

#define MSGSTRFIELD1 (   line)    str##line

Definition at line 27 of file gai_strerror.c.

Function Documentation

const char* gai_strerror ( int  code)

Definition at line 58 of file gai_strerror.c.

  const char *result = "Unknown error";
  for (size_t i = 0; i < sizeof (msgidx) / sizeof (msgidx[0]); ++i)
    if (msgidx[i].code == code)
       result = msgstr.str + msgidx[i].idx;

  return _(result);

Variable Documentation

struct { ... } msgidx[] [static]
union msgstr_t msgstr [static]