s3-waf: create a smbldap.so library.
[Samba/id10ts.git] / source3 / script / gaptab.awk
bloba309089cd5bded3a8b24579623faa55eaf07a18e
1 BEGIN { hv["0"] = 0; hv["1"] = 1; hv["2"] = 2; hv["3"] = 3;
2 hv["4"] = 4; hv["5"] = 5; hv["6"] = 6; hv["7"] = 7;
3 hv["8"] = 8; hv["9"] = 9; hv["A"] = 10; hv["B"] = 11;
4 hv["C"] = 12; hv["D"] = 13; hv["E"] = 14; hv["F"] = 15;
5 hv["a"] = 10; hv["b"] = 11; hv["c"] = 12; hv["d"] = 13;
6 hv["e"] = 14; hv["f"] = 15;
8 first = 0; last = 0; idx = 0; f = 0;
11 function tonum(str)
13 num=0;
14 cnt=1;
15 while (cnt <= length(str)) {
16 num *= 16;
17 num += hv[substr(str,cnt,1)];
18 ++cnt;
20 return num;
23 function fmt(val)
25 if (f++ % 8 == 0)
26 { printf ("\n 0x%02x,", val); }
27 else
28 { printf (" 0x%02x,", val); }
32 u = tonum($1); c = tonum($2);
34 if (u - last > 6)
36 if (last) { idx += last - first + 1; }
37 first = u;
39 else
41 for (m = last+1; m < u; m++) { fmt(0); }
44 fmt(c);
45 last = u;
48 END { print "" }