{
    "content": [
        {
            "type": "text",
            "text": "# getnetconfig(3t) (man)\n\n**Summary:** getnetconfig, setnetconfig, endnetconfig, getnetconfigent, freenetconfigent, ncperror, ncsperror — get network configuration database entry\n\n## See Also\n\n- getnetpath(3)\n- netconfig(5)\n\n## Section Outline\n\n- **NAME** (3 lines)\n- **SYNOPSIS** (1 lines) — 1 subsections\n  - #include <netconfig.h> (21 lines)\n- **DESCRIPTION** (36 lines)\n- **RETURN VALUES** (18 lines)\n- **FILES** (2 lines)\n- **AVAILABILITY** (2 lines)\n- **SEE ALSO** (3 lines)\n\n## Full Content\n\n### NAME\n\ngetnetconfig, setnetconfig, endnetconfig, getnetconfigent, freenetconfigent, ncperror,\nncsperror — get network configuration database entry\n\n### SYNOPSIS\n\n#### #include <netconfig.h>\n\nstruct netconfig *\ngetnetconfig(void *handlep);\n\nvoid *\nsetnetconfig(void);\n\nint\nendnetconfig(void *handlep);\n\nstruct netconfig *\ngetnetconfigent(const char *netid);\n\nvoid\nfreenetconfigent(struct netconfig *netconfigp);\n\nvoid\nncperror(const char *msg);\n\nchar *\nncsperror(void);\n\n### DESCRIPTION\n\nThe library routines described on this page provide the application access to the system net‐\nwork configuration database, /etc/netconfig.  The getnetconfig() function returns a pointer to\nthe current entry in the netconfig database, formatted as a struct netconfig.  Successive calls\nwill return successive netconfig entries in the netconfig database.  The getnetconfig() func‐\ntion can be used to search the entire netconfig file.  The getnetconfig() function returns NULL\nat the end of the file.  The handlep argument is the handle obtained through setnetconfig().\n\nA call to setnetconfig() has the effect of “binding” to or “rewinding” the netconfig database.\nThe setnetconfig() function must be called before the first call to getnetconfig() and may be\ncalled at any other time.  The setnetconfig() function need not be called before a call to\ngetnetconfigent().  The setnetconfig() function returns a unique handle to be used by\ngetnetconfig().\n\nThe endnetconfig() function should be called when processing is complete to release resources\nfor reuse.  The handlep argument is the handle obtained through setnetconfig().  Programmers\nshould be aware, however, that the last call to endnetconfig() frees all memory allocated by\ngetnetconfig() for the struct netconfig data structure.  The endnetconfig() function may not be\ncalled before setnetconfig().\n\nThe getnetconfigent() function returns a pointer to the netconfig structure corresponding to\nnetid.  It returns NULL if netid is invalid (that is, does not name an entry in the netconfig\ndatabase).\n\nThe freenetconfigent() function frees the netconfig structure pointed to by netconfigp (previ‐\nously returned by getnetconfigent()).\n\nThe ncperror() function prints a message to the standard error indicating why any of the above\nroutines failed.  The message is prepended with the string msg and a colon.  A newline charac‐\nter is appended at the end of the message.\n\nThe ncsperror() function is similar to ncperror() but instead of sending the message to the\nstandard error, will return a pointer to a string that contains the error message.\n\nThe ncperror() and ncsperror() functions can also be used with the NETPATH access routines\ndefined in getnetpath(3).\n\n### RETURN VALUES\n\nThe setnetconfig() function returns a unique handle to be used by getnetconfig().  In the case\nof an error, setnetconfig() returns NULL and ncperror() or ncsperror() can be used to print\nthe reason for failure.\n\nThe getnetconfig() function returns a pointer to the current entry in the netconfig database,\nformatted as a struct netconfig.  The getnetconfig() function returns NULL at the end of the\nfile, or upon failure.\n\nThe endnetconfig() function returns 0 on success and -1 on failure (for example, if\nsetnetconfig() was not called previously).\n\nOn success, getnetconfigent() returns a pointer to the struct netconfig structure corresponding\nto netid; otherwise it returns NULL.\n\nThe ncsperror() function returns a pointer to a buffer which contains the error message\nstring.  This buffer is overwritten on each call.  In multithreaded applications, this buffer\nis implemented as thread-specific data.\n\n### FILES\n\n/etc/netconfig\n\n### AVAILABILITY\n\nThese functions are part of libtirpc.\n\n### SEE ALSO\n\ngetnetpath(3), netconfig(5)\n\nBSD                             April 22, 2000                             BSD\n\n"
        }
    ],
    "structuredContent": {
        "command": "getnetconfig",
        "section": "3t",
        "mode": "man",
        "summary": "getnetconfig, setnetconfig, endnetconfig, getnetconfigent, freenetconfigent, ncperror, ncsperror — get network configuration database entry",
        "synopsis": "",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "getnetpath",
                "section": "3",
                "url": "https://www.chedong.com/phpMan.php/man/getnetpath/3/json"
            },
            {
                "name": "netconfig",
                "section": "5",
                "url": "https://www.chedong.com/phpMan.php/man/netconfig/5/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 3,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "#include <netconfig.h>",
                        "lines": 21
                    }
                ]
            },
            {
                "name": "DESCRIPTION",
                "lines": 36,
                "subsections": []
            },
            {
                "name": "RETURN VALUES",
                "lines": 18,
                "subsections": []
            },
            {
                "name": "FILES",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AVAILABILITY",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 3,
                "subsections": []
            }
        ]
    }
}