diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-05-31 20:11:19 +0300 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-05-31 20:11:45 +0300 |
commit | fa0978a70e893bbc73d4c4816699cf241eefd3c5 (patch) | |
tree | d4c6b100c75d50f21cfdbfcb5e21da02874fcb4f /doc/mailfromd.texi | |
parent | b7fb81d841a26476da18349200dccce86c2de337 (diff) | |
download | mailfromd-fa0978a70e893bbc73d4c4816699cf241eefd3c5.tar.gz mailfromd-fa0978a70e893bbc73d4c4816699cf241eefd3c5.tar.bz2 |
Implement `localdomain' function + several improvements.
* NEWS: Update.
* etc/mailfromd.rc: Use localdomain to determine the domain
name.
Remove the `#error' statement. Hopefully, this file can be
used as is.
* mfd/bi_gethostname.m4 (gethostname): Add an optional argument.
* mfd/gram.y: Handle function declarations with only optional
arguments, e.g.: func foo(; string bar)
(mailfromd_test): Add missing env_init calls.
* mfd/lex.l: Remove trailing newline before displaying the
`#error' diagnostics.
* mflib/localdomain.mf: New file.
* mflib/Makefile.am (inc_DATA): Add localdomain.mf.
* mflib/safedb.mf4 (safedb_verbose): New variable.
(safedbmap, safedbdel): New function.
(safedbget, safedbput): Verbosely print exceptions caught if
safedb_verbose is set.
Diffstat (limited to 'doc/mailfromd.texi')
-rw-r--r-- | doc/mailfromd.texi | 119 |
1 files changed, 79 insertions, 40 deletions
diff --git a/doc/mailfromd.texi b/doc/mailfromd.texi index 4bbbea9b..62b41a06 100644 --- a/doc/mailfromd.texi +++ b/doc/mailfromd.texi @@ -5249,6 +5249,11 @@ Spam threshold, set by @code{sa} function (@pxref{sa}). Spam keywords for the message, set by @code{sa} function (@pxref{sa}). @end deftypevr +@deftypevr {Predefined Variable} number safedb_verbose +This variable controls the verbosity of the exception-safe database +functions. @xref{safedb_verbose}. +@end deftypevr + @node Back references @section Back references @@ -7556,24 +7561,6 @@ specified, or empty string otherwise. See above for the meaning of @var{null}. @end deftypefn -@deftypefn {Library Function} string safedbget (string @var{db}, @ - string @var{key} [, string @var{default}, number @var{null}]) - - This is an exception-safe interface to @code{dbget}. If some -database error occurs while attempting to retrieve the record, -@code{safedbget} returns empty string. - -@flindex safedb.mf - To use this function, request the @file{safedb.mf} module: - -@smallexample -#require safedb -@end smallexample - -@noindent -@xref{Modules}, for a description of @acronym{MFL} module system. -@end deftypefn - @deftypefn {Built-in Function} void dbput (string @var{db}, @ string @var{key}, string @var{value} [, @ number @var{null}, number @var{mode} ]) @@ -7586,25 +7573,6 @@ to explicitly specify the file mode for this database. See also @code{#pragma dbprop}, described above. @end deftypefn -@deftypefn {Library Function} void safedbput (string @var{db}, @ - string @var{key}, string @var{value} [, number @var{null}]) - This is an exception-safe interface to @code{dbput}. If a -database error occurs while attempting to retrieve the record, -the function returns without reporting an error. - -@flindex safedb.mf - To use this function, request the @file{safedb.mf} module: - -@smallexample -#require safedb -@end smallexample - -@noindent -@xref{Modules}, for a description of @acronym{MFL} module system. -@FIXME{safedbput should probably take an optional mode argument, as -dbput does.} -@end deftypefn - @deftypefn {Built-in Function} void dbdel (string @var{db}, @ string @var{key} [, number @var{null}, number @var{mode}]) Delete from the database the record with the given @var{key}. If @@ -7617,6 +7585,60 @@ terminating null character will be included in @var{key} length. this database. See also @code{#pragma dbprop}, described above. @end deftypefn +@flindex safedb.mf +The functions above have also the corresponding exception-safe +interfaces, which return cleanly if the @samp{e_dbfailure} exception +occurs. To use these interfaces, request the @file{safedb.mf} module: + +@smallexample +#require safedb +@end smallexample + +The exception-safe interfaces are: + +@deftypefn {Library Function} string safedbmap (string @var{db}, @ + string @var{key} [, string @var{default}, number @var{null}]) + + This is an exception-safe interface to @code{dbmap}. If a +database error occurs while attempting to retrieve the record, +@code{safedbmap} returns @var{default} or @samp{0}, if it is +not defined. +@end deftypefn + +@deftypefn {Library Function} string safedbget (string @var{db}, @ + string @var{key} [, string @var{default}, number @var{null}]) + + This is an exception-safe interface to @code{dbget}. If a +database error occurs while attempting to retrieve the record, +@code{safedbget} returns @var{default} or empty string, if it is +not defined. +@end deftypefn + +@deftypefn {Library Function} void safedbput (string @var{db}, @ + string @var{key}, string @var{value} [, number @var{null}]) + + This is an exception-safe interface to @code{dbput}. If a +database error occurs while attempting to retrieve the record, +the function returns without raising exception. +@end deftypefn + +@deftypefn {Library Function} void safedbdel (string @var{db}, @ + string @var{key} [, number @var{null}]) + + This is an exception-safe interface to @code{dbdel}. If a +database error occurs while attempting to delete the record, +the function returns without raising exception. +@end deftypefn + +@anchor{safedb_verbose} +@vrindex safedb_verbose +The verbosity of @samp{safedb} interfaces in case of database error is +controlled by the value of @code{safedb_verbose} variable. If it is +@samp{0}, these functions return silently. This is the default +behavior. Otherwise, if @code{safedb_verbose} is not @samp{0}, these +functions log the detailed diagnostics about the database error and +return. + @anchor{dbm-seq} The following functions provide a sequential access to the contents of a @acronym{DBM} database: @@ -7820,8 +7842,12 @@ The function @code{revip} is defined in @ref{revip}. @node System functions @subsubsection System functions -@deftypefn {Built-in Function} string gethostname () +@deftypefn {Built-in Function} string gethostname ([bool @var{fqn}]) Return the host name of this machine. + +If the optional @var{fqn} is given and is @samp{true}, the function +will attempt to return fully-qualified host name, by attempting to +resolve it using @acronym{DNS}. @end deftypefn @deftypefn {Built-in Function} string getdomainname () @@ -7830,8 +7856,21 @@ necessarily coincide with the actual machine name in @acronym{DNS}. Depending on the underlying @samp{libc} implementation, this call may return empty string or the string @samp{(none)}. Do not rely on it to -get the real hostname of the box @command{mailfromd} runs on, use -@acronym{DNS} functions instead. +get the real domain name of the box @command{mailfromd} runs on, use +@code{localdomain} (see below) instead. +@end deftypefn + +@flindex localdomain.mf +@deftypefn {Library Function} string localdomain () +Return the local domain name of this machine. + +This function first uses @code{getdomainname} to make a first guess. +If it does not return a meaningful value, @code{localdomain} calls +@code{gethostname(1)} to determine the fully qualified host name of +the machine, and returns its domain part. + +To use this function, require @file{localdomain.mf} module +(@pxref{Modules}), e.g.: @code{#require localdomain}. @end deftypefn @deftypefn {Built-in Function} number time () |