github.com/nvi-inc/fsgo@v0.2.1/versions/utils/types.sh (about) 1 #!/bin/bash 2 3 FSPATH=${FSPATH:-"/usr2/fs"} 4 5 read -r -d '' header <<EOF 6 // +build ignore 7 // generated with types.sh --- do not edit 8 9 package fs 10 11 /* 12 #include "$FSPATH/include/params.h" 13 #include "$FSPATH/include/fs_types.h" 14 #include "$FSPATH/include/fscom.h" 15 */ 16 import "C" 17 18 EOF 19 20 f() { 21 echo "$header" 22 23 echo "type (" 24 echo "$header"\ 25 | grep include \ 26 | cpp \ 27 | grep -o 'struct[[:space:]]\+\w\+' \ 28 | cut -d" " -f2 \ 29 | sort -u \ 30 | sed -r 's/^(.+)$/\t\u\1\tC.struct_\1/' - 31 echo ")" 32 }; 33 f | gofmt