rewritehost(3) rewritehost(3) NNAAMMEE rewritehost - make syntactic changes to host names SSYYNNTTAAXX ##iinncclluuddee <> int rreewwrriitteehhoosstt(&_o_u_t,_b_u_f,_l_e_n,&_r_u_l_e_s); int rreewwrriitteehhoosstt__aaddddrr(&_o_u_t,_b_u_f,_l_e_n,&_r_u_l_e_s); int rreewwrriitteehhoosstt__lliisstt(&_o_u_t,_b_u_f,_l_e_n,&_r_u_l_e_s); stralloc _r_u_l_e_s; stralloc _o_u_t; char *_b_u_f; unsigned int _l_e_n; DDEESSCCRRIIPPTTIIOONN rreewwrriitteehhoosstt reads a host name from _b_u_f of length _l_e_n, rewrites it according to instructions in _r_u_l_e_s, and puts the rewritten host name into _o_u_t. _r_u_l_e_s is a series of \0-terminated instructions; see rreewwrriitt-- iinngg(5) for the instruction format. rreewwrriitteehhoosstt__aaddddrr reads an address in the form _u_s_e_r@@_h_o_s_t from _b_u_f of length _l_e_n. It rewrites _h_o_s_t according to instructions in _r_u_l_e_s, unless both _u_s_e_r and _h_o_s_t are empty, in which case it rewrites the address as the empty string. It puts the rewritten address into _o_u_t. rreewwrriitteehhoosstt__aaddddrr accepts _u_s_e_r as a synonym for _u_s_e_r@@ with an empty host name. rreewwrriitteehhoosstt__lliisstt reads an address list from _b_u_f of length _l_e_n, rewrites each address in the list according to instructions in _r_u_l_e_s, and puts the rewritten address list into _o_u_t. The address list consists of \0-terminated chunks; a chunk is either an address preceded by a plus sign, or a comment preceded by a left parenthesis. rreewwrriitteehhoosstt__lliisstt copies comments without change. Each function returns 1 if it succeeds, 0 if it runs out of memory. SSEEEE AALLSSOO stralloc(3), rewriting(5) rewritehost(3)