home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The World of Computer Software
/
World_Of_Computer_Software-02-387-Vol-3of3.iso
/
e
/
ebut10.zip
/
ebuttons-1.0
/
make_ebuttons
< prev
next >
Wrap
Text File
|
1992-11-28
|
763b
|
39 lines
#!/bin/sh
buttons=ebuttons.h
case $# in
1) ;;
*) echo usage: `basename $0` num_buttons; exit 1;;
esac
if [ -f $buttons ]
then
existing_buttons="`grep COMMAND $buttons | wc -l`"
if [ $1 -eq `expr $existing_buttons - 2` ]
then
exit 0
fi
fi
cat >$buttons <<EOT
#define LABEL(x) "Label", XtRString, sizeof(String), XtOffsetOf(AppResources, labels[(x)]), XtRString, NULL
#define COMMAND(x) "Command", XtRString, sizeof(String), XtOffsetOf(AppResources, commands[(x)]), XtRString, NULL
static XtResource resources[] = {
EOT
awk <&- >> $buttons 'BEGIN { \
for (; i < '$1'; i++) \
printf " { \"label%d\", LABEL(%d) },\n { \"command%d\", COMMAND(%d) },\n", i, i, i, i}'
cat >>$buttons <<EOT
};
#undef LABEL
#undef COMMAND
EOT
exit 0