File: util.awk

package info (click to toggle)
samba-doc-ja 2.2.8a%2Bja1.0-0.1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 34,192 kB
  • ctags: 22,693
  • sloc: ansic: 197,587; sh: 8,073; perl: 5,377; makefile: 1,489; awk: 1,146; exp: 1,143; csh: 216
file content (39 lines) | stat: -rw-r--r-- 575 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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;
}

# return 1 if the string is a constant
function is_constant(s) 
{
    return match(s,"^[0-9]+$");
}