Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ getnetent(3) — CLIX 3.1r7.6.22

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

networks(4)



  getnetent(3)                        CLIX                        getnetent(3)



  NAME

    getnetent, getnetbyaddr, getnetbyname, setnetent, endnetent - Gets a
    network entry

  LIBRARY

    Berkeley Software Distribution Library (libbsd.a)

  SYNOPSIS

    #include <netdb.h>

    struct netent *getnetent(
      void );

    struct netent *getnetbyname(
      char *name );

    struct netent *getnetbyaddr(
      long net ,
      int type );

    void setnetent(
      int stayopen );

    void endnetent(
      void );

  DESCRIPTION

    The getnetent(), getnetbyname(), and getnetbyaddr() functions return a
    pointer to an object with the following structure containing the broken-
    down fields of a line in the network database, /etc/networks.

    struct netent {
         char *n_name;  /* official name of net */
         char **n_aliases;   /* alias list */
         int  n_addrtype;    /* net number type */
         u_long    n_net;         /* net number */
    };

    The members of this structure are as follows:

    n_name       The official name of the network.

    n_aliases    A zero-terminated list of alternate names for the network.

    n_addrtype   The type of the network number returned; currently only
                 AF_INET.




  2/94 - Intergraph Corporation                                              1






  getnetent(3)                        CLIX                        getnetent(3)



    n_net        The network number.  Network numbers are returned in
                 machine-byte order.

    The getnetent() function reads the next line of the file, opening the file
    if necessary.

    The setnetent() function opens and rewinds the file.  If the stayopen flag
    is nonzero, the net database will not be closed after each call to
    getnetbyname() or getnetbyaddr().

    The endnetent()() closes the file.

    The getnetbyname() and getnetbyaddr() sequentially search from the
    beginning of the file until a matching network name or address and type is
    found or until EOF is encountered.  Network numbers are supplied in host
    order.

    All information is contained in a static area so it must be copied to be
    saved.  Only Internet network numbers are currently understood.  It is
    expected that network numbers will fit in 32 bits or less.

  FILES

    /etc/networks

  RETURN VALUES

    NULL is returned on EOF or error.

  RELATED INFORMATION

    Files:  networks(4)






















  2                                              Intergraph Corporation - 2/94




Typewritten Software • bear@typewritten.org • Edmonds, WA 98026