missing NULL terminator in set_config_x
[geda-gaf.git] / gnetlist-legacy / scripts / bompp.sh.in
blobe8024fe9e51770f3a5b1ce80f9e5d6645e76ef6c
1 #!/bin/sh
2 # ha ha
4 if [ -z "$1" ] ; then
5 echo "usage $0 geda-bom # output on stdout"
6 exit 255
7 fi
8 cat $1 | @AWK@ '{print toupper($2)" "toupper($3)" "toupper($4)" "toupper($1)}'\
9 | sort +0 | @AWK@ '\
10 BEGIN {\
11 f1="";f2="";f3="";\
12 format1="%3d %-19s %-10s %-10s ";\
13 format4="%-46s";\
14 format2="%s, ";\
15 format3="%s\n";\
16 format5="%s,\n";\
17 urefsperline=5;\
18 printf(format1 format3, 0, "Device", "Value", "Footprint", "Urefs");\
20 /^DEVICE/{}\
21 !/^DEVICE/{\
22 if($1==f1 && $2==f2 && $3==f3) {\
23 array[ct++]=$4;\
24 } else {\
25 if(f1!="" && f2!="" && f3!="") { \
26 printf(format1, ct, f1, f2, f3);\
27 for(i=0; i<ct-1; i++) {\
28 if((i+1)%urefsperline) {\
29 printf(format2, array[i]);\
30 } else {\
31 printf(format5 format4, array[i], "");\
34 printf(format3, array[i]);\
36 f1=$1;f2=$2;f3=$3;ct=0;array[ct++]=$4;\
39 END{\
40 if(f1!="" && f2!="" && f3!="") { \
41 printf(format1, ct, f1, f2, f3);\
42 for(i=0; i<ct-1; i++) {\
43 if((i+1)%urefsperline) {\
44 printf(format2, array[i]);\
45 } else {\
46 printf(format5 format4, array[i], "");\
49 printf(format3, array[i]);\