xref: /minix3/external/bsd/nvi/dist/common/options.awk (revision 84d9c625bfea59e274550651111ae9edfdc40fbd)
1*84d9c625SLionel Sambuc#	Id: options.awk,v 10.1 1995/06/08 19:00:01 bostic Exp  (Berkeley) Date: 1995/06/08 19:00:01
2*84d9c625SLionel Sambuc
3*84d9c625SLionel Sambuc/^\/\* O_[0-9A-Z_]*/ {
4*84d9c625SLionel Sambuc	opt = $2
5*84d9c625SLionel Sambuc	printf("#define %s %d\n", opt, cnt++)
6*84d9c625SLionel Sambuc	ofs = FS
7*84d9c625SLionel Sambuc	FS="\""
8*84d9c625SLionel Sambuc	do getline
9*84d9c625SLionel Sambuc	while ($1 != "	{L(")
10*84d9c625SLionel Sambuc	FS=ofs
11*84d9c625SLionel Sambuc	opt_name = $2
12*84d9c625SLionel Sambuc	if (opt_name < prev_name) {
13*84d9c625SLionel Sambuc		printf "missorted %s: \"%s\" < \"%s\"\n", opt, opt_name, prev_name >"/dev/stderr"
14*84d9c625SLionel Sambuc		exit 1
15*84d9c625SLionel Sambuc	}
16*84d9c625SLionel Sambuc	prev_name = opt_name
17*84d9c625SLionel Sambuc	next
18*84d9c625SLionel Sambuc}
19*84d9c625SLionel SambucEND {
20*84d9c625SLionel Sambuc	printf("#define O_OPTIONCOUNT %d\n", cnt);
21*84d9c625SLionel Sambuc}
22