~kevin8t8/mutt

ref: 2fbc29ec127aa3d699def01e574f14996db8cacc mutt/gen_defs -rwxr-xr-x 833 bytes
2fbc29ecKevin McCarthy Allow my_var assignments to reference the $my_var in the value. 3 months ago
                                                                                
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
#!/bin/sh

# $Id$

echo '/* Automatically generated by gen_defs.  Do not edit! */'
echo ''

for mode in help defs; do
	case $mode in
		help)
			echo "#ifdef HELP_C"
			echo "const char *HelpStrings[] = {"
			;;
		*)
			echo "enum {"
			;;
	esac
	for i in $*; do
		if test $mode = help; then
			cat $i | {
				number=1
				while IFS="" read -r oneline; do
					printf "%d %s\n" $number "$oneline"
					number=$(($number + 1))
				done
			} | \
			sed -e 's;^[0-9]* \(\/\*.*\*\/\);\1;' \
			-e 's;^\([0-9]*\) \(OP_[^ ]*\) *\(.*\);	/* L10N: Help screen description for \2\
#: '"$i"':\1 */\
	N_(\3),;'
		else
			sed -e '/^\/\*/d' -e 's;^\([^ ]*\).*;	\1,;' < $i
		fi
	done
	if test $mode = help; then
		echo '	NULL'
	else
		echo '	OP_MAX'
	fi
	echo "};"
	if test $mode = help; then
		echo "#endif /* MAIN_C */"
		echo ''
	fi
done

exit 0