1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00
samba-mirror/source3/aparser/util.awk
Andrew Tridgell b7022e94d2 vastly improved awk based code generator
now handles recursive function definitions, unions etc
it is sufficient for some basic types like UNISTR2 and BUFFER5
to be defined in the *.struct file and used successfully

this generator uses templates (in *.tpl files) for all code
generation, allowing easy replacement of the backend functions
(This used to be commit 14ded82dc9)
2000-05-14 14:05:10 +00:00

34 lines
474 B
Awk

function isaptr(elem)
{
if (substr(elem, 1, 1) == "*") {
return 1;
}
return 0;
}
function noptr(elem)
{
if (!isaptr(elem)) return elem;
return substr(elem, 2);
}
function xprintf(f, fmt, v1, v2, v3, v4, v5, v6, v7)
{
printf(fmt, v1, v2, v3, v4, v5, v6) > f;
}
function fatal(why)
{
printf("FATAL: %s\n", why);
exit 1;
}
function numlines(fname,
LOCAL, line, count)
{
count=0;
while ((getline line < fname) > 0) count++;
close(fname);
return count;
}