summaryrefslogtreecommitdiffstats
path: root/kate/data/list-keywords-ldif.awk
blob: fc693c3c35249b2b9e4da6de87fc686e6fb71abd (plain)
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
#!/bin/awk -f

function printName (name)
{
	if ((name != "") && (name != "(") && (name != ")")) print type, name;
}

function printNames (str)
{
	s = substr(str,index(str,"NAME")+4);
	split (s, a, " ");
#	for (i=0; i<length(a); i++) {
#		print type,a[i]
#	}
	# ATTENTION: The loop above does not work for some strange reason.
	# The following statements imitate it for a limited amount of elements.
	# If you happen to have more then the ones given here, you have to extend it!
	printName(a[0]);
	printName(a[1]);
	printName(a[2]);
	printName(a[3]);
}

BEGIN {
	type="";
}

/attributetype/ {
	type="attributetype";
}

/objectclass/ {
	type="objectclass";
}

/ NAME / {
	printNames($0);
}