summaryrefslogtreecommitdiff
path: root/distrib/miniroot/makeconf.awk
blob: a0af0e56d446e56a5253d7ae25721ba405ac1898 (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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#	$NetBSD: makeconf.awk,v 1.2 1995/12/19 00:54:08 pk Exp $

BEGIN {
	# a list of `aliases'
	links["[",0] = "test";
	links["awk",0] = "gawk";
	links["chgrp",0] = "chown";
	links["egrep",0] = "grep";
	links["fgrep",0] = "grep";
	links["gzcat",0] = "gzip";
	links["gunzip",0] = "gzip";
	links["halt",0] = "reboot";
	links["reset",0] = "tset";
	links["rrestore",0] = "restore";
	links["sum",0] = "cksum";
	links["uncompress",0] = "compress";
	links["vi",0] = "common";	# XXX catch vi
	links["zcat",0] = "compress";

	argvlinks["mount_ffs"] = "ffs";	# mount invokes mount_* this way
	argvlinks["mount_nfs"] = "nfs";
	argvlinks["mount_cd9660"] = "cd9660";
	argvlinks["sh"] = "-sh";	# init invokes the shell this way
}

($1 == "LINK" || $1 == "SYMLINK") && index($2,CBIN) {
	n = split($3, x, "/");
	p = x[n];
	if ((p,0) in links) {
		links[p,1] = links[p,0];
		p = links[p,0];
	}
	progs[p] = 1;
	if (argvlinks[p])
		links[argvlinks[p],1] = p;
}

END {
	# write crunchgen configuration

	printf("#\n# This file is automatically generated by `makeconf'\n#\n");
	printf("srcdirs bin sbin usr.bin usr.sbin gnu/usr.bin usr.bin/vi\n");

	i = 0;
	for (p in progs) {
		if ((i++ % 8) == 0)
			printf("\nprogs");
		printf(" %s", p);
	}
	printf("\n\n");

	for (I in links) {
		split(I, l, SUBSEP);
		if (l[2])
			printf("ln %s %s\n", links[l[1],1], l[1]);
	}

	printf("\nlibs -ledit -lutil -lcurses -ltermcap -lcrypt -ll -lm -lkvm\n");
}