#!/bin/bash # # doorlock-avr, AVR code of Binary Kitchen's doorlock # # Copyright (c) Binary Kitchen, 2019 # # Authors: # Ralf Ramsauer # # This work is licensed under the terms of the GNU GPL, version 2. See # the COPYING file in the top-level directory. PROTOCOL_H=$1 function find_defines() { header=$1 prefix=$2 search="#define\s\+${prefix}\(\S*\)\s\+\(\S*\).*" replace=" \1\t= b\2" grep $prefix $header | sed -e "s/$search/$replace/" } AVR_COMM=$(find_defines $PROTOCOL_H AVR_) cat <