/*

Example of template use:

main()
{
...
	cgi_find_root(mygetenv("SCRIPT_NAME"),rootname);
	cgi_decode();
	tpl_set_templates(ini_get(I_TEMPLATES));
	tpl_var_add("action",cgi_path());
	tpl_var_add("user",strlwr(cgi_get("user")));
	tpl_callback("products",cmd_cb_products);
	tpl_showfile("user_get.htm");
	return TRUE;
}
int cmd_cb_products(char *tpl)
{
	for (i=0; i<10; i++) {
		t = FALSE;
		tpl_var_true("checked",t); 	
		tpl_var_add("name",name[i]);
		tpl_var_add("value",val[i]);
		tpl_show_line(tpl);
	}
	return TRUE;
}
Using a template like this: (in brief)
	<p>Enter email address for product notices 
	<input type="text" name="user" size="30" value="||user||">
	<input type="hidden" name="user_old" size="30" value="||user||">
	<input type="submit" value="Fetch Current Settings" name="cmd_user_find">
	</p>
	<p>
	||begin_products||
	<input type="checkbox" name="||name||" value="ON" ||checked||>||value||<br>
	||end_products||

*/

int tpl_var_add_safe(char *var, char *val);
int tpl_var_true( char *name, int t);
int tpl_var_add(char *var, char *val);
char *tpl_var_find(char *var);
int tpl_var_free(void);
int tpl_var_replace(char *line, char *out, int outlen);
int tpl_show_line(char *bf);
int tpl_showfile(char *fname);
char *tpl_file(char *bf, char *fname);
int tpl_callback(char *name,  int fn(char *s));
int tpl_cb_fn(char *rest, char *tpl);

int tpl_set_templates(char *s);
int /*@printflike@*/  tpl_error(char * arg_list, ...);

/* Samuel added this */
int tpl_reset_outstream();
/* Samuel added this */
int tpl_set_outstream(FILE *newout);
