rewritehost(3)
NAME
rewritehost - make syntactic changes to host names
SYNTAX
#include <rewritehost.h>
int rewritehost(&out,buf,len,&rules);
int rewritehost_addr(&out,buf,len,&rules);
int rewritehost_list(&out,buf,len,&rules);
stralloc rules;
stralloc out;
char *buf;
unsigned int len;
DESCRIPTION
- rewritehost reads a host name from buf of length len,
rewrites it according to instructions in rules, and puts
the rewritten host name into out. rules is a series of - -terminated instructions; see rewriting(5) for the
- instruction format.
- rewritehost_addr reads an address in the form user@host
from buf of length len. It rewrites host according to
instructions in rules, unless both user and host are
empty, in which case it rewrites the address as the empty
string. It puts the rewritten address into out. rewrite host_addr accepts user as a synonym for user@ with an empty host name. - rewritehost_list reads an address list from buf of length
len, rewrites each address in the list according to
instructions in rules, and puts the rewritten address list
into out. The address list consists of -terminated
chunks; a chunk is either an address preceded by a plus
sign, or a comment preceded by a left parenthesis.
rewritehost_list copies comments without change. - Each function returns 1 if it succeeds, 0 if it runs out
of memory.