home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Fresh Fish 4
/
FreshFish_May-June1994.bin
/
gnu
/
man
/
cat2
/
gethostname.0
< prev
next >
Wrap
Text File
|
1993-12-07
|
2KB
|
67 lines
GETHOSTNAME(2) UNIX Programmer's Manual GETHOSTNAME(2)
NNAAMMEE
ggeetthhoossttnnaammee, sseetthhoossttnnaammee - get/set name of current host
SSYYNNOOPPSSIISS
##iinncclluuddee <<uunniissttdd..hh>>
_i_n_t
ggeetthhoossttnnaammee(_c_h_a_r _*_n_a_m_e, _i_n_t _n_a_m_e_l_e_n)
_i_n_t
sseetthhoossttnnaammee(_c_o_n_s_t _c_h_a_r _*_n_a_m_e, _i_n_t _n_a_m_e_l_e_n)
DDEESSCCRRIIPPTTIIOONN
GGeetthhoossttnnaammee() returns the standard host name for the current processor,
as previously set by sseetthhoossttnnaammee(). The parameter _n_a_m_e_l_e_n specifies the
size of the _n_a_m_e array. The returned name is nullterminated unless in
sufficient space is provided.
SSeetthhoossttnnaammee() sets the name of the host machine to be _n_a_m_e, which has
length _n_a_m_e_l_e_n. This call is restricted to the superuser and is normally
used only when the system is bootstrapped.
RREETTUURRNN VVAALLUUEESS
If the call succeeds a value of 0 is returned. If the call fails, a val
ue of 1 is returned and an error code is placed in the global location
_e_r_r_n_o.
EERRRROORRSS
The following errors may be returned by these calls:
[EFAULT] The _n_a_m_e or _n_a_m_e_l_e_n parameter gave an invalid address.
[EPERM] The caller tried to set the hostname and was not the super
user.
SSEEEE AALLSSOO
gethostid(2)
BBUUGGSS
Host names are limited to MAXHOSTNAMELEN (from <_s_y_s_/_p_a_r_a_m_._h>) characters,
currently 64.
HHIISSTTOORRYY
The ggeetthhoossttnnaammee function call appeared in 4.2BSD.
4.2 Berkeley Distribution March 10, 1991 1