diff options
author | Sergey Poznyakoff <gray@gnu.org> | 2019-01-03 12:40:52 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org> | 2019-01-03 12:40:52 +0200 |
commit | c70f5d055d37bba1b26beafec8bfee902dc1b758 (patch) | |
tree | 7f7c140369fbab7c9d37765eec814e2fb81cf7fc /doc/functions.texi | |
parent | 33f88906896d016ebd4e387ddc7a29c9f6c0dbc7 (diff) | |
download | mailfromd-c70f5d055d37bba1b26beafec8bfee902dc1b758.tar.gz mailfromd-c70f5d055d37bba1b26beafec8bfee902dc1b758.tar.bz2 |
Version 8.7release_8_7
* NEWS: Update.
* configure.ac: Raise minor version.
* doc/functions.texi: Document new functions
Include the implementation of the NS resolving MFL functions, as
proposed by Jan Rafaj
* lib/dns.c (ns_lookup): New function.
* lib/dns.h (ns_lookup): New proto.
* mflib/dns.mf4 (hasns): New function.
* src/builtin/dns.bi (primitive_hasns, getns): New functions.
Diffstat (limited to 'doc/functions.texi')
-rw-r--r-- | doc/functions.texi | 100 |
1 files changed, 64 insertions, 36 deletions
diff --git a/doc/functions.texi b/doc/functions.texi index 75eed904..d25911aa 100644 --- a/doc/functions.texi +++ b/doc/functions.texi @@ -5,7 +5,10 @@ @c Invariant Sections, with the Front and Back-Cover texts at your option. This chapter describes library functions available in Mailfromd -version @value{VERSION}. +version @value{VERSION}. For the simplicity of explanation, we use +the word @samp{boolean} to indicate variables of numeric type that are +used as boolean values. For such variables, the term @samp{False} +stands for the numeric 0, and @samp{True} for any non-zero value. @menu * Macro access:: @@ -65,7 +68,7 @@ macro names programmatically, e.g.: @end smallexample @end deftypefn -@deftypefn {Built-in Function} number macro_defined (string @var{name}) +@deftypefn {Built-in Function} boolean macro_defined (string @var{name}) Return true if Sendmail macro @var{name} is defined. @end deftypefn @@ -602,7 +605,7 @@ is returned otherwise. In the latter case, the global variable @code{ctype_mismatch} is set to the index of the first character that is outside of the character class (characters are indexed from 0). -@deftypefn {Built-in Function} number isalnum (string @var{str}) +@deftypefn {Built-in Function} boolean isalnum (string @var{str}) Checks for alphanumeric characters: @smallexample @@ -611,7 +614,7 @@ Checks for alphanumeric characters: @end smallexample @end deftypefn -@deftypefn {Built-in Function} number isalpha (string @var{str}) +@deftypefn {Built-in Function} boolean isalpha (string @var{str}) Checks for an alphabetic character: @smallexample @@ -620,7 +623,7 @@ Checks for an alphabetic character: @end smallexample @end deftypefn -@deftypefn {Built-in Function} number isascii (string @var{str}) +@deftypefn {Built-in Function} boolean isascii (string @var{str}) Checks whether all characters in @var{str} are 7-bit ones, that fit into the @acronym{ASCII} character set. @@ -630,47 +633,47 @@ the @acronym{ASCII} character set. @end smallexample @end deftypefn -@deftypefn {Built-in Function} number isblank (string @var{str}) +@deftypefn {Built-in Function} boolean isblank (string @var{str}) Checks if @var{str} contains only blank characters; that is, spaces or tabs. @end deftypefn -@deftypefn {Built-in Function} number iscntrl (string @var{str}) +@deftypefn {Built-in Function} boolean iscntrl (string @var{str}) Checks for control characters. @end deftypefn -@deftypefn {Built-in Function} number isdigit (string @var{str}) +@deftypefn {Built-in Function} boolean isdigit (string @var{str}) Checks for digits (0 through 9). @end deftypefn -@deftypefn {Built-in Function} number isgraph (string @var{str}) +@deftypefn {Built-in Function} boolean isgraph (string @var{str}) Checks for any printable characters except spaces. @end deftypefn -@deftypefn {Built-in Function} number islower (string @var{str}) +@deftypefn {Built-in Function} boolean islower (string @var{str}) Checks for lower-case characters. @end deftypefn -@deftypefn {Built-in Function} number isprint (string @var{str}) +@deftypefn {Built-in Function} boolean isprint (string @var{str}) Checks for printable characters including space. @end deftypefn -@deftypefn {Built-in Function} number ispunct (string @var{str}) +@deftypefn {Built-in Function} boolean ispunct (string @var{str}) Checks for any printable characters which are not a spaces or alphanumeric characters. @end deftypefn -@deftypefn {Built-in Function} number isspace (string @var{str}) +@deftypefn {Built-in Function} boolean isspace (string @var{str}) Checks for white-space characters, i.e.: space, form-feed (@samp{\f}), newline (@samp{\n}), carriage return (@samp{\r}), horizontal tab (@samp{\t}), and vertical tab (@samp{\v}). @end deftypefn -@deftypefn {Built-in Function} number isupper (string @var{str}) +@deftypefn {Built-in Function} boolean isupper (string @var{str}) Checks for uppercase letters. @end deftypefn -@deftypefn {Built-in Function} number isxdigit (string @var{str}) +@deftypefn {Built-in Function} boolean isxdigit (string @var{str}) Checks for hexadecimal digits, i.e. one of @samp{0}, @samp{1}, @samp{2}, @samp{3}, @samp{4}, @samp{5}, @samp{6}, @samp{7}, @samp{8}, @samp{9}, @samp{a}, @samp{b}, @samp{c}, @samp{d}, @samp{e}, @samp{f}, @@ -717,7 +720,7 @@ email address. @end deftypefn @deftypefn {Library Function} boolean email_valid (string @var{email}) - Returns @var{True} if @var{email} is a valid email address, + Returns @samp{True} (1) if @var{email} is a valid email address, consisting of local and domain parts only. E.g.: @smallexample @@ -1704,7 +1707,7 @@ compativbility. These functions are defined in the module @file{poll.mf}, which you must require prior to using any of them. -@deftypefn {Library Function} number _pollhost @ +@deftypefn {Library Function} boolean _pollhost @ (string @var{ip}, string @var{email}, string @var{domain}, @ string @var{mailfrom}) Poll @acronym{SMTP} host @var{ip} for email address @var{email}, @@ -1716,7 +1719,7 @@ main poll tempfails. The function can throw one of the following exceptions: @code{e_failure}, @code{e_temp_failure}. @end deftypefn -@deftypefn {Library Function} number _pollmx @ +@deftypefn {Library Function} boolean _pollmx @ (string @var{ip}, string @var{email}, string @var{domain}, @ string @var{mailfrom}) Poll @acronym{MX}s of the @var{domain} for email address @var{email}, using @@ -1728,7 +1731,7 @@ if the poll fails. The function can throw one of the following exceptions: @code{e_failure}, @code{e_temp_failure}. @end deftypefn -@deftypefn {Library Function} number stdpoll @ +@deftypefn {Library Function} boolean stdpoll @ (string @var{email}, string @var{domain}, string @var{mailfrom}) Performs standard poll for @var{email}, using @var{domain} as @@ -1740,7 +1743,7 @@ the following exceptions: @code{e_failure}, @code{e_temp_failure}. without explicit @var{host}. @FIXME{more details and references.} @end deftypefn -@deftypefn {Library Function} number strictpoll @ +@deftypefn {Library Function} boolean strictpoll @ (string @var{host}, string @var{email}, @ string @var{domain}, string @var{mailfrom}) @@ -1925,7 +1928,7 @@ records) for the @acronym{IP}v4 address @var{ipstr}. @end deftypefn @deftypefn {Built-in Function} string getmx (string @var{domain} @ - [, number @var{ip}]) + [, boolean @var{ip}]) Returns a whitespace-separated list of @samp{MX} names (if @var{ip} is not given or if it is @code{0}) or @samp{MX} @acronym{IP} addresses (if @code{@var{ip}!=0})) for @var{domain}. Within the returned @@ -2114,6 +2117,30 @@ record are compared against @var{ip}. The function returns true if a matching A record is found. @end deftypefn +@deftypefn {Built-in Function} boolean primitive_hasns (string @var{domain}) +Returns @samp{True} if the domain @var{domain} has at least one +@samp{NS} record. Throws exception if DNS lookup fails. +@end deftypefn + +@deftypefn {Library Function} boolean hasns (string @var{domain}) +Returns @samp{True} if the domain @var{domain} has at least one +@samp{NS} record. Returns @samp{False} if there are no @samp{NS} +records or if the DNS lookup fails. +@end deftypefn + +@deftypefn {Built-in Function} string getns (string @var{domain} ; @ + boolean @var{resolve}, boolean @var{sort}) + Returns a whitespace-separated list of all the @samp{NS} records for +the domain @var{domain}. Optional parameters @var{resolve} and +@var{sort} control the formatting. If @var{resolve} is 0 (the default), the +resulting string will contain IP addresses of the NS servers. If +@var{resolve} is not 0, hostnames will be returned instead. If +@var{sort} is 1, the returned items will be sorted. + +If the @acronym{DNS} query fails, @code{getns} raises an appropriate +exception. +@end deftypefn + @node Geolocation functions @section Geolocation functions @cindex geolocation @@ -2249,7 +2276,7 @@ argument to the database functions (in description below, marked as @anchor{dbmap} @deftypefn {Built-in Function} boolean dbmap (string @var{db}, @ - string @var{key}, [number @var{null}]) + string @var{key}, [boolean @var{null}]) Looks up @var{key} in the @acronym{DBM} file @var{db} and returns @code{true} if it is found. @@ -2259,7 +2286,7 @@ argument to the database functions (in description below, marked as @end deftypefn @deftypefn {Built-in Function} string dbget (string @var{db}, @ - string @var{key} [, string @var{default}, number @var{null}]) + string @var{key} [, string @var{default}, boolean @var{null}]) Looks up @var{key} in the database @var{db} and returns the value associated with it. If the key is not found returns @var{default}, if specified, or empty string otherwise. @@ -2269,7 +2296,7 @@ specified, or empty string otherwise. @deftypefn {Built-in Function} void dbput (string @var{db}, @ string @var{key}, string @var{value} [, @ - number @var{null}, number @var{mode} ]) + boolean @var{null}, number @var{mode} ]) Inserts in the database a record with the given @var{key} and @var{value}. If a record with the given @var{key} already exists, its value is replaced with the supplied one. @@ -2281,7 +2308,7 @@ to explicitly specify the file mode for this database. See also @deftypefn {Built-in Function} void dbinsert (string @var{db}, @ string @var{key}, string @var{value} [, @ - number @var{replace}, number @var{null}, number @var{mode} ]) + boolean @var{replace}, boolean @var{null}, number @var{mode} ]) This is an improved variant of @code{dbput}, which provides a better control on the actions to take if the @var{key} already exists in the database. Namely, if @var{replace} is @samp{True}, the old value is @@ -2290,7 +2317,7 @@ is thrown. @end deftypefn @deftypefn {Built-in Function} void dbdel (string @var{db}, @ - string @var{key} [, number @var{null}, number @var{mode}]) + string @var{key} [, boolean @var{null}, number @var{mode}]) Delete from the database the record with the given @var{key}. If there are no such record, return without signalling error. @@ -2313,7 +2340,7 @@ require safedb The exception-safe interfaces are: @deftypefn {Library Function} string safedbmap (string @var{db}, @ - string @var{key} [, string @var{default}, number @var{null}]) + string @var{key} [, string @var{default}, boolean @var{null}]) This is an exception-safe interface to @code{dbmap}. If a database error occurs while attempting to retrieve the record, @@ -2322,7 +2349,7 @@ not defined. @end deftypefn @deftypefn {Library Function} string safedbget (string @var{db}, @ - string @var{key} [, string @var{default}, number @var{null}]) + string @var{key} [, string @var{default}, boolean @var{null}]) This is an exception-safe interface to @code{dbget}. If a database error occurs while attempting to retrieve the record, @@ -2331,7 +2358,7 @@ not defined. @end deftypefn @deftypefn {Library Function} void safedbput (string @var{db}, @ - string @var{key}, string @var{value} [, number @var{null}]) + string @var{key}, string @var{value} [, boolean @var{null}]) This is an exception-safe interface to @code{dbput}. If a database error occurs while attempting to retrieve the record, @@ -2339,7 +2366,7 @@ the function returns without raising exception. @end deftypefn @deftypefn {Library Function} void safedbdel (string @var{db}, @ - string @var{key} [, number @var{null}]) + string @var{key} [, boolean @var{null}]) This is an exception-safe interface to @code{dbdel}. If a database error occurs while attempting to delete the record, @@ -2422,8 +2449,9 @@ is currently enabled. If @var{fmtid} does not match any known format, @cindex disabling cache @cindex cache, disabling -@deftypefn {Built-in Function} void db_set_active (string @var{fmtid}, number @var{enable}) - Enables the cache database @var{fmtid} if @var{enable} is not null, +@deftypefn {Built-in Function} void db_set_active (string @var{fmtid}, @ + boolean @var{enable}) + Enables the cache database @var{fmtid} if @var{enable} is @samp{True}, or disables it otherwise. For example, to disable @acronym{DNS} caching, do: @@ -2784,12 +2812,12 @@ The function @code{revip} is defined in @ref{revip}. @node System functions @section System functions -@deftypefn {Built-in Function} number access (string @var{pathname}, @ +@deftypefn {Built-in Function} boolean access (string @var{pathname}, @ number @var{mode}) Checks whether the calling process can access the file @var{pathname}. If @var{pathname} is a symbolic link, it is dereferenced. The -function returns 1 (@samp{true}) if the file can be accessed and 0 -(@samp{false}) otherwise@footnote{@emph{Note}, that the return code is +function returns @samp{True} if the file can be accessed and +@samp{False} otherwise@footnote{@emph{Note}, that the return code is inverted in respect to the system function @samp{access(2)}.}. Symbolic values for @var{mode} are provided in module @@ -4833,7 +4861,7 @@ debug_level("db") @result{} 0 @end smallexample @end deftypefn -@deftypefn {Built-in Function} number callout_transcript ([number @var{value}]) +@deftypefn {Built-in Function} boolean callout_transcript ([boolean @var{value}]) Returns the current state of the callout SMTP transcript. The result is 1 if the transcript is enabled and 0 otherwise. The transcript is normally enabled either by the use of the @option{--transcript} |