1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-25 23:21:54 +03:00
samba-mirror/source3/aparser/template.awk
2000-05-14 14:08:16 +00:00

19 lines
457 B
Awk

# template file handling
function print_template(f, tplname, v,
LOCAL, i, pat, line)
{
tplname="templates/"tplname;
if (numlines(tplname) <= 0) fatal("no template "tplname);
while ((getline line < tplname) > 0) {
while ((i = match(line,"@[a-zA-Z_]*@")) != 0) {
pat=substr(line,i+1,RLENGTH-2);
if (v[pat] == "") fatal("no value for "pat" in "tplname);
gsub("@"pat"@", v[pat], line);
}
xprintf(f, "%s\n", line);
}
close(tplname);
}