expand (2) --- convert a template into an EOS-terminated string 03/25/82 _C_a_l_l_i_n_g _I_n_f_o_r_m_a_t_i_o_n integer function expand (template, str, strlen) integer strlen character template (ARB), str (strlen) Library: vswtlb (standard Subsystem library) _F_u_n_c_t_i_o_n 'Expand' is used to convert Subsystem path templates into strings. Templates are used to make the directory structure of the Subsystem user-selectable without the expense of code modification. The first argument of 'expand' should be an EOS-terminated string containing a template to be expanded; the second argument should be a string to receive the result, and the third argument should be the maximum allowable length of the result. The function return is the length of the expanded template, or ERR if an undefined or ill-formed template is present. The template consists of uninterpreted characters, which are passed through to the expanded version unchanged, and identifiers surrounded by equals signs, which are replaced by template text and then rescanned. If the template must contain uninterpreted equal signs, they must be "doubled" (eg. for one =, use ==). See 'lutemp' for a list of templates currently supported. _I_m_p_l_e_m_e_n_t_a_t_i_o_n 'Expand' maintains indices into the template, the receiving string, and a pushback buffer, which is initially empty. As long as the pushback buffer is empty, 'expand' copies characters from the template to the receiving string. When a single equals sign ("=") is encountered, characters are stored in another buffer until a trailing equals sign is seen. This buffer is passed to 'lutemp', which places the resulting template expansion in the pushback buffer. As long as the pushback buffer is nonempty, 'expand' scans it instead of the original template; this allows template expansions to contain additional templates. _A_r_g_u_m_e_n_t_s _M_o_d_i_f_i_e_d str _C_a_l_l_s lutemp expand (2) - 1 - expand (2) expand (2) --- convert a template into an EOS-terminated string 03/25/82 _S_e_e _A_l_s_o lutemp (6), follow (2), getto (2) expand (2) - 2 - expand (2)