NetBSD/distrib/miniroot/makeconf.awk
1995-12-19 00:54:07 +00:00

60 lines
1.4 KiB
Awk

# $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");
}