mirror of
https://github.com/samba-team/samba.git
synced 2024-12-25 23:21:54 +03:00
13371c4859
(This used to be commit 6aa51dc1a5
)
19 lines
457 B
Awk
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);
|
|
}
|