The .Fn function

This commit is contained in:
Philippe Charnier 2003-03-24 16:02:05 +00:00
parent 592bb5e477
commit 0552350ecc
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112541
17 changed files with 84 additions and 48 deletions

View file

@ -69,10 +69,11 @@ Use
.Xr strftime 3 .Xr strftime 3
instead. instead.
.Pp .Pp
.Fn Ascftime The
is almost identical with .Fn ascftime
function is almost identical to
.Xr strftime 3 , .Xr strftime 3 ,
with the only exception there's no parameter to tell about the with the only exception that there's no parameter to tell about the
maximal buffer length, and the maximal buffer length, and the
.Fa format .Fa format
parameter defaults to parameter defaults to
@ -81,8 +82,9 @@ if a
.Em NULL .Em NULL
pointer is given. pointer is given.
.Pp .Pp
.Fn Cftime The
does the same job, but it first invokes .Fn cftime
function does the same job, but it first invokes
.Xr localtime 3 .Xr localtime 3
in order to convert the given in order to convert the given
.Fa clock , .Fa clock ,

View file

@ -68,8 +68,9 @@ If
.Fa s .Fa s
is NULL, an internal array is used and its address will be returned. is NULL, an internal array is used and its address will be returned.
.Sh RETURN VALUES .Sh RETURN VALUES
The
.Fn cuserid .Fn cuserid
returns the address of an array in which the name has been stored. function returns the address of an array in which the name has been stored.
.Pp .Pp
If the name associated with the effective UID of the current process If the name associated with the effective UID of the current process
could not be found, either a null pointer will be returned, or could not be found, either a null pointer will be returned, or

View file

@ -262,12 +262,14 @@ The
.Fn ipsec_set_policy .Fn ipsec_set_policy
function returns a pointer to the allocated buffer of policy specification if function returns a pointer to the allocated buffer of policy specification if
successful; otherwise a NULL pointer is returned. successful; otherwise a NULL pointer is returned.
The
.Fn ipsec_get_policylen .Fn ipsec_get_policylen
returns with positive value function returns with positive value
(meaning the buffer size) (meaning the buffer size)
on success, and negative value on errors. on success, and negative value on errors.
The
.Fn ipsec_dump_policy .Fn ipsec_dump_policy
returns a pointer to dynamically allocated region on success, function returns a pointer to dynamically allocated region on success,
and and
.Dv NULL .Dv NULL
on errors. on errors.

View file

@ -72,27 +72,31 @@ run over the data with
and finally extract the result using and finally extract the result using
.Fn MDXFinal . .Fn MDXFinal .
.Pp .Pp
The
.Fn MDXPad .Fn MDXPad
can be used to pad message data in same way function can be used to pad message data in same way
as done by as done by
.Fn MDXFinal .Fn MDXFinal
without terminating calculation. without terminating calculation.
.Pp .Pp
The
.Fn MDXEnd .Fn MDXEnd
is a wrapper for function is a wrapper for
.Fn MDXFinal .Fn MDXFinal
which converts the return value to a 33-character which converts the return value to a 33-character
(including the terminating '\e0') (including the terminating '\e0')
.Tn ASCII .Tn ASCII
string which represents the 128 bits in hexadecimal. string which represents the 128 bits in hexadecimal.
.Pp .Pp
The
.Fn MDXFile .Fn MDXFile
calculates the digest of a file, and uses function calculates the digest of a file, and uses
.Fn MDXEnd .Fn MDXEnd
to return the result. to return the result.
If the file cannot be opened, a null pointer is returned. If the file cannot be opened, a null pointer is returned.
The
.Fn MDXFileChunk .Fn MDXFileChunk
is similar to function is similar to
.Fn MDXFile , .Fn MDXFile ,
but it only calculates the digest over a byte-range of the file specified, but it only calculates the digest over a byte-range of the file specified,
starting at starting at
@ -108,8 +112,9 @@ of the file,
calculates the digest from calculates the digest from
.Fa offset .Fa offset
to the end of file. to the end of file.
The
.Fn MDXData .Fn MDXData
calculates the digest of a chunk of data in memory, and uses function calculates the digest of a chunk of data in memory, and uses
.Fn MDXEnd .Fn MDXEnd
to return the result. to return the result.
.Pp .Pp

View file

@ -62,21 +62,24 @@ run over the data with
and finally extract the result using and finally extract the result using
.Fn RIPEMD160_Final . .Fn RIPEMD160_Final .
.Pp .Pp
The
.Fn RIPEMD160_End .Fn RIPEMD160_End
is a wrapper for function is a wrapper for
.Fn RIPEMD160_Final .Fn RIPEMD160_Final
which converts the return value to a 41-character which converts the return value to a 41-character
(including the terminating '\e0') (including the terminating '\e0')
.Tn ASCII .Tn ASCII
string which represents the 160 bits in hexadecimal. string which represents the 160 bits in hexadecimal.
.Pp .Pp
The
.Fn RIPEMD160_File .Fn RIPEMD160_File
calculates the digest of a file, and uses function calculates the digest of a file, and uses
.Fn RIPEMD160_End .Fn RIPEMD160_End
to return the result. to return the result.
If the file cannot be opened, a null pointer is returned. If the file cannot be opened, a null pointer is returned.
The
.Fn RIPEMD160_FileChunk .Fn RIPEMD160_FileChunk
is similar to function is similar to
.Fn RIPEMD160_File , .Fn RIPEMD160_File ,
but it only calculates the digest over a byte-range of the file specified, but it only calculates the digest over a byte-range of the file specified,
starting at starting at
@ -92,8 +95,9 @@ of the file,
calculates the digest from calculates the digest from
.Fa offset .Fa offset
to the end of file. to the end of file.
The
.Fn RIPEMD160_Data .Fn RIPEMD160_Data
calculates the digest of a chunk of data in memory, and uses function calculates the digest of a chunk of data in memory, and uses
.Fn RIPEMD160_End .Fn RIPEMD160_End
to return the result. to return the result.
.Pp .Pp

View file

@ -58,8 +58,9 @@ gid, if gid is not -1.
This function returns zero if the file exists and may be This function returns zero if the file exists and may be
considered secure, -2 if the file does not exist, and considered secure, -2 if the file does not exist, and
-1 otherwise to indicate a security failure. -1 otherwise to indicate a security failure.
The
.Xr syslog 3 .Xr syslog 3
is used to log any failure of this function, including the function is used to log any failure of this function, including the
reason, at LOG_ERR priority. reason, at LOG_ERR priority.
.Sh BUGS .Sh BUGS
The checks carried out are rudimentary and no attempt is made The checks carried out are rudimentary and no attempt is made

View file

@ -178,8 +178,9 @@ As noted above, the
.Fn get*class .Fn get*class
functions return a login_cap_t object which is used to access functions return a login_cap_t object which is used to access
the matching or default record in the capabilities database. the matching or default record in the capabilities database.
The
.Fn getclassbyname .Fn getclassbyname
accepts two arguments: the first one is the record identifier of the function accepts two arguments: the first one is the record identifier of the
record to be retrieved, the second is an optional directory name. record to be retrieved, the second is an optional directory name.
If the first If the first
.Ar name .Ar name
@ -253,8 +254,9 @@ has no login class, then the system "default" entry is retrieved.
Once a program no longer wishes to use a login_cap_t object, Once a program no longer wishes to use a login_cap_t object,
.Fn login_close .Fn login_close
may be called to free all resources used by the login class. may be called to free all resources used by the login class.
The
.Fn login_close .Fn login_close
may be passed a NULL pointer with no harmful side-effects. function may be passed a NULL pointer with no harmful side-effects.
.Pp .Pp
The remaining functions may be used to retrieve individual The remaining functions may be used to retrieve individual
capability records. capability records.

View file

@ -57,13 +57,14 @@ and due care must be taken as detailed in the manpage for that
function and this affects all processes running in the same session function and this affects all processes running in the same session
and not just the current process. and not just the current process.
.Pp .Pp
The
.Fn setclasscontext .Fn setclasscontext
sets various class context values (resource limits, umask and function sets various class context values (resource limits, umask and
process priorities) based on values for a specific named class. process priorities) based on values for a specific named class.
.Pp .Pp
The function The
.Fn setusercontext .Fn setusercontext
sets class context values based on a given login_cap_t function sets class context values based on a given login_cap_t
object, a specific passwd record (if login_cap_t is NULL), object, a specific passwd record (if login_cap_t is NULL),
sets the current session's login and the current process sets the current session's login and the current process
user and group ownership. user and group ownership.
@ -74,7 +75,7 @@ parameter, which is comprised of one or more of the following:
.Bl -tag -width LOGIN_SETRESOURCES .Bl -tag -width LOGIN_SETRESOURCES
.It LOGIN_SETLOGIN .It LOGIN_SETLOGIN
Set the login associated with the current session to the user Set the login associated with the current session to the user
specified in the passwd structure. specified in the passwd structure using
.Xr setlogin 2 . .Xr setlogin 2 .
The The
.Ar pwd .Ar pwd
@ -170,10 +171,11 @@ and
functions are subsets of the setcontext functions above, but may functions are subsets of the setcontext functions above, but may
be useful in isolation. be useful in isolation.
.Sh RETURN VALUES .Sh RETURN VALUES
The
.Fn setclasscontext .Fn setclasscontext
and and
.Fn setusercontext .Fn setusercontext
return -1 if an error occurred, or 0 on success. functions return -1 if an error occurred, or 0 on success.
If an error occurs when attempting to set the user, login, group If an error occurs when attempting to set the user, login, group
or resources, a message is reported to or resources, a message is reported to
.Xr syslog 3 , .Xr syslog 3 ,

View file

@ -44,8 +44,9 @@ This set of functions checks to see if login is allowed based on login
class capability entries in the login database, class capability entries in the login database,
.Xr login.conf 5 . .Xr login.conf 5 .
.Pp .Pp
The
.Fn auth_ttyok .Fn auth_ttyok
checks to see if the named tty is available to users of a specific function checks to see if the named tty is available to users of a specific
class, and is either in the class, and is either in the
.Em ttys.allow .Em ttys.allow
access list, and not in access list, and not in
@ -73,8 +74,9 @@ or empty string as the
.Ar tty .Ar tty
parameter causes the function to return a non-zero value. parameter causes the function to return a non-zero value.
.Pp .Pp
The
.Fn auth_hostok .Fn auth_hostok
checks for any host restrictions for remote logins. function checks for any host restrictions for remote logins.
The function checks on both a host name and IP address (given in its The function checks on both a host name and IP address (given in its
text form, typically n.n.n.n) against the text form, typically n.n.n.n) against the
.Em host.allow .Em host.allow

View file

@ -114,8 +114,9 @@ then a parsing error was encountered.
The remaining functions provide the ability to test a given time_t or The remaining functions provide the ability to test a given time_t or
struct tm value against a specific time period or array of time struct tm value against a specific time period or array of time
periods. periods.
The
.Fn in_ltm .Fn in_ltm
determines whether the given time described by the struct tm function determines whether the given time described by the struct tm
passed as the second parameter falls within the period described passed as the second parameter falls within the period described
by the first parameter. by the first parameter.
A boolean value is returned, indicating whether or not the time A boolean value is returned, indicating whether or not the time
@ -135,19 +136,22 @@ elements in length, and terminated by an element with its
field set to field set to
.Em LTM_NONE . .Em LTM_NONE .
.Sh RETURN VALUES .Sh RETURN VALUES
The
.Fn parse_lt .Fn parse_lt
returns a filled in structure of type login_time_t containing the function returns a filled in structure of type login_time_t containing the
parsed time period. parsed time period.
If a parsing error occurs, the lt_dow field is set to If a parsing error occurs, the lt_dow field is set to
.Em LTM_NONE .Em LTM_NONE
(i.e. 0). (i.e. 0).
.Pp .Pp
The
.Fn in_ltm .Fn in_ltm
returns non-zero if the given time falls within the period described function returns non-zero if the given time falls within the period described
by the login_time_t passed as the first parameter. by the login_time_t passed as the first parameter.
.Pp .Pp
The
.Fn in_ltms .Fn in_ltms
returns the index of the first time period found in which the given function returns the index of the first time period found in which the given
time falls, or -1 if none of them apply. time falls, or -1 if none of them apply.
.Sh SEE ALSO .Sh SEE ALSO
.Xr getcap 3 , .Xr getcap 3 ,

View file

@ -51,8 +51,9 @@ a new session with
This terminal device will also be made the standard input, standard output, This terminal device will also be made the standard input, standard output,
and standard error output of the calling process. and standard error output of the calling process.
.Sh RETURN VALUES .Sh RETURN VALUES
.Fn Login_tty The
returns -1 if it could not make the device referenced by .Fn login_tty
function returns -1 if it could not make the device referenced by
.Ar fd .Ar fd
the controlling terminal of the calling process, and 0 otherwise. the controlling terminal of the calling process, and 0 otherwise.
.Sh SEE ALSO .Sh SEE ALSO

View file

@ -52,8 +52,9 @@ and
.Em host .Em host
fields are empty, and the time stamp field is updated to the current time. fields are empty, and the time stamp field is updated to the current time.
.Sh RETURN VALUES .Sh RETURN VALUES
.Fn Logout The
returns 1 if the slot described by .Fn logout
function returns 1 if the slot described by
.Ar line .Ar line
has been found and updated, 0 otherwise. has been found and updated, 0 otherwise.
.Sh SEE ALSO .Sh SEE ALSO

View file

@ -63,15 +63,17 @@ and returns the head of a new property list, assuming that the
file's contents have been parsed properly, or NULL in case file's contents have been parsed properly, or NULL in case
of error. of error.
.Pp .Pp
The
.Fn property_find .Fn property_find
Returns the associated value string for the property named function returns the associated value string for the property named
.Fa name .Fa name
if found, otherwise NULL. The value returned may be up to if found, otherwise NULL. The value returned may be up to
.Dv PROPERTY_MAX_VALUE .Dv PROPERTY_MAX_VALUE
bytes in length. bytes in length.
.Pp .Pp
The
.Fn properties_free .Fn properties_free
is used to free the structure returned by function is used to free the structure returned by
.Fn properties_read .Fn properties_read
when it is no longer needed. when it is no longer needed.
.Sh FILE FORMAT .Sh FILE FORMAT

View file

@ -82,8 +82,9 @@ and
.Fa aslave , .Fa aslave ,
respectively. respectively.
.Pp .Pp
.Fn Forkpty The
first calls .Fn forkpty
function first calls
.Fn openpty .Fn openpty
to obtain the next available pseudo-terminal from the system. Upon success, to obtain the next available pseudo-terminal from the system. Upon success,
it forks off a new process. In the child process, it closes the descriptor it forks off a new process. In the child process, it closes the descriptor
@ -99,12 +100,14 @@ and
have the same meaning as described for have the same meaning as described for
.Fn openpty . .Fn openpty .
.Sh RETURN VALUES .Sh RETURN VALUES
.Fn Openpty The
returns 0 on success, or -1 on failure. .Fn openpty
function returns 0 on success, or -1 on failure.
.Pp .Pp
.Fn Forkpty The
returns -1 on failure, 0 in the slave process, and the process ID of the .Fn forkpty
slave process in the parent process. function returns -1 on failure, 0 in the slave process, and the process ID of
the slave process in the parent process.
.Sh ERRORS .Sh ERRORS
On failure, On failure,
.Fn openpty .Fn openpty

View file

@ -71,8 +71,9 @@ bytes long,
.Ar host .Ar host
will not be NUL terminated. will not be NUL terminated.
.Sh RETURN VALUES .Sh RETURN VALUES
The
.Fn realhostname .Fn realhostname
will return one of the following constants which are defined in function will return one of the following constants which are defined in
.Pa libutil.h : .Pa libutil.h :
.Pp .Pp
.Bl -tag -width XXX -offset XXX .Bl -tag -width XXX -offset XXX

View file

@ -100,8 +100,9 @@ bytes long,
.Ar host .Ar host
will not be NUL terminated. will not be NUL terminated.
.Sh RETURN VALUES .Sh RETURN VALUES
The
.Fn realhostname_sa .Fn realhostname_sa
will return one of the following constants which are defined in function will return one of the following constants which are defined in
.Pa libutil.h : .Pa libutil.h :
.Pp .Pp
.Bl -tag -width XXX -offset XXX .Bl -tag -width XXX -offset XXX

View file

@ -50,8 +50,9 @@ name is determined by calling
and removing everything up to the first period. The name is determined and removing everything up to the first period. The name is determined
the first time this function is called and is cached for future use. the first time this function is called and is cached for future use.
.Pp .Pp
The
.Fn trimdomain .Fn trimdomain
will only trim the domain name if the passed function will only trim the domain name if the passed
.Ar fullname .Ar fullname
ends with the current domain name and if the length of the resulting host ends with the current domain name and if the length of the resulting host
name does not exceed name does not exceed
@ -75,7 +76,8 @@ numbers to the end of the base host name and resulting in
.Ar host : nn Op . Ar nn . .Ar host : nn Op . Ar nn .
.Sm on .Sm on
.Sh RETURN VALUES .Sh RETURN VALUES
The
.Fn trimdomain .Fn trimdomain
does not return a value. function does not return a value.
.Sh SEE ALSO .Sh SEE ALSO
.Xr gethostname 3 .Xr gethostname 3