getnetent man page on HP-UX

Man page or keyword search:  
man Server   10987 pages
apropos Keyword Search (all sections)
Output format
HP-UX logo
[printable version]

getnetent(3N)							 getnetent(3N)

       getnetent(), getnetbyaddr(), getnetbyname(), setnetent(), endnetent() -
       get, set, or end network entry

       and each return a pointer to a structure of type netent containing  the
       broken-out fields of a line in the network data base,

       The members of this structure are:

	      The official name of the network.

	      A null-terminated list of alternate names for the network.

	      The type of the network number returned; always

	      The network number.

       Functions behave as follows:

	      Reads the next line of the file, opening the file if necessary.

	      Opens and rewinds the file.
				    If the stayopen flag is non-zero, the net‐
				    work data base is not  closed  after  each
				    call  to  (either  directly	 or indirectly
				    through one of the other calls).

	      Closes the file.

	      Sequentially searches from the beginning of  the	file  until  a
	      network name
				    (among  either  the	 official names or the
				    aliases) matching its  parameter  name  is
				    found, or until EOF is encountered.

	      Sequentially searches from the beginning of the file
				    until a network number matching its param‐
				    eter net is found, or until EOF is encoun‐
				    tered.   The parameter net must be in net‐
				    work order.	 The parameter	type  must  be
				    the	 constant Network numbers are supplied
				    in host order (see byteorder(3N)).

       If the system is running Network Information Service (NFS), and	obtain
       their  network  information  from  the  NIS  server (see ypserv(1M) and

       In a multithreaded application, and use thread-specific storage that is
       re-used	in  each  call.	  The  return value, should be unique for each
       thread and should be saved, if desired, before  the  thread  makes  the
       next call.

       For  enumeration in multithreaded applications, the position within the
       enumeration is a process-wide property shared by all threads.   may  be
       used  in	 a multithreaded application, but resets the enumeration posi‐
       tion for all threads.  If multiple  threads  interleave	calls  to  the
       threads will enumerate disjoint subsets of the network database.

   Name Service Switch-Based Operation
       The  library  routines  and  internally call the name service switch to
       access the "networks" database lookup policy  configured	 in  the  file
       (see  nsswitch.conf(4)).	  The  lookup policy defines the order and the
       criteria of the supported name services used to resolve	network	 names
       and addresses.

       and  return  a  null pointer (0) on EOF or when they are unable to open
       also returns a null pointer if its type parameter is invalid.

       The following code excerpt counts the number of network entries:

	      int count = 0;
	      (void) setnetent(0);
	      while (netbuf=getnetent() != NULL)
	      (void) endnetent();

       The above reentrant  interfaces	have  been  moved  from	 to  They  are
       included	 to  support  existing	applications and may be removed in the
       future release.	New multithreaded applications should  not  use	 these

       The  reentrant  interfaces  function the same as the regular interfaces
       (those without the suffix.)  However,  and  expect  to  be  passed  the
       address of a struct netent and will store the address of the result  at
       the supplied parameter.	An additional parameter, the address of struct
       netent_data, which is defined in the file cannot be a NULL pointer.

       and  return a −1 if the operation is unsuccessful. A 0 is returned oth‐

       Programs that use the interfaces described in this  manpage  cannot  be
       linked statically because the implementations of these functions employ
       dynamic loading and linking of shared objects at run time.

       was developed by Sun Microsystems Inc.

       ypserv(1M),	networks(4),	   ypfiles(4),	     nsswitch.conf(4),


List of man pages available for HP-UX

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
Vote for polarhome
Free Shell Accounts :: the biggest list on the net