summaryrefslogtreecommitdiff
path: root/other/Kermit/util/gen_defines
blob: dc8b869a23493d1fd8cd95d5d9540ff16e53334d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/bin/bash
# it is 1 am and im still heading to finish this tonight :)
# written by palmers / teso

IN_FILE="../tmp/_names"
OUT_FILE="../include/addresses.h"
NUM_FILE="../util/_numbers"

X=1
LINE_COUNT=`wc -l $IN_FILE | awk '{print $1}' -`

cat << __EOF__ >> $OUT_FILE
/*
 * addresses.h:
 * this file was automaticly generated by gen_defines
 */
__EOF__

while [ `expr $X \<\= $LINE_COUNT` == "1" ]; do
# did i already mention how late it is? dont try to understand the next line ...
  echo \#define `sed -n \`echo $X\`p $IN_FILE | awk '{print toupper ($1)}' -`_ADD `sed -n \`echo $X\`p $NUM_FILE` >> $OUT_FILE
  X=`expr $X \+ 1`
done