Improve opt_set (etc.) used for tests
This commit is contained in:
@@ -7,7 +7,7 @@ SED=$(which gsed || which sed)
|
||||
|
||||
for opt in "$@" ; do
|
||||
# Logic for returning nonzero based on answer here: https://stackoverflow.com/a/15966279/104648
|
||||
eval "${SED} -i '/\(\/\/\)*[[:blank:]]*\(#define \b${opt}\b\)/{s//\2/;h};\${x;/./{x;q0};x;q9}' Marlin/Configuration.h" ||
|
||||
eval "${SED} -i '/\(\/\/\)*[[:blank:]]*\(#define \b${opt}\b\)/{s//\2/;h};\${x;/./{x;q0};x;q9}' Marlin/Configuration_adv.h" ||
|
||||
eval "${SED} -i '/^[[:blank:]]*\(\/\/\)*[[:blank:]]*\(#define \b${opt}\b\)/{s//\2/;h};\${x;/./{x;q0};x;q9}' Marlin/Configuration.h" ||
|
||||
eval "${SED} -i '/^[[:blank:]]*\(\/\/\)*[[:blank:]]*\(#define \b${opt}\b\)/{s//\2/;h};\${x;/./{x;q0};x;q9}' Marlin/Configuration_adv.h" ||
|
||||
(echo "ERROR: opt_enable Can't find ${opt}" >&2 && exit 9)
|
||||
done
|
||||
|
@@ -5,8 +5,12 @@ set -e
|
||||
|
||||
SED=$(which gsed || which sed)
|
||||
|
||||
# Logic for returning nonzero based on answer here: https://stackoverflow.com/a/15966279/104648
|
||||
eval "${SED} -i '/\(\/\/\)*\([[:blank:]]*\)\(#define\s\+\b${1}\b\).*$/{s//\2\3 ${2}/;h};\${x;/./{x;q0};x;q9}' Marlin/Configuration.h" ||
|
||||
eval "${SED} -i '/\(\/\/\)*\([[:blank:]]*\)\(#define\s\+\b${1}\b\).*$/{s//\2\3 ${2}/;h};\${x;/./{x;q0};x;q9}' Marlin/Configuration_adv.h" ||
|
||||
eval "echo '#define ${@}' >>Marlin/Configuration_adv.h" ||
|
||||
(echo "ERROR: opt_set Can't set or add ${1}" >&2 && exit 9)
|
||||
ARGC=$#
|
||||
while [[ $# > 1 ]]; do
|
||||
# Logic for returning nonzero based on answer here: https://stackoverflow.com/a/15966279/104648
|
||||
eval "${SED} -i '/^[[:blank:]]*\(\/\/\)*\([[:blank:]]*\)\(#define\s\+\b${1}\b\).*$/{s//\2\3 ${2}/;h};\${x;/./{x;q0};x;q9}' Marlin/Configuration.h" ||
|
||||
eval "${SED} -i '/^[[:blank:]]*\(\/\/\)*\([[:blank:]]*\)\(#define\s\+\b${1}\b\).*$/{s//\2\3 ${2}/;h};\${x;/./{x;q0};x;q9}' Marlin/Configuration_adv.h" ||
|
||||
eval "echo '#define ${1} ${2}' >>Marlin/Configuration.h" ||
|
||||
(echo "ERROR: opt_set Can't set or add ${1}" >&2 && exit 9)
|
||||
shift 2
|
||||
done
|
||||
|
@@ -7,5 +7,5 @@ PIN=$2
|
||||
VAL=$3
|
||||
|
||||
SED=$(which gsed || which sed)
|
||||
eval "${SED} -i '/\(\/\/\)*\(#define \+${PIN}\b\).*$/{s//\2 ${VAL}/;h};\${x;/./{x;q0};x;q9}' Marlin/src/pins/$DIR/pins_${NAM}.h" ||
|
||||
eval "${SED} -i '/^[[:blank:]]*\(\/\/\)*[[:blank:]]*\(#define \+${PIN}\b\).*$/{s//\2 ${VAL}/;h};\${x;/./{x;q0};x;q9}' Marlin/src/pins/$DIR/pins_${NAM}.h" ||
|
||||
(echo "ERROR: pins_set Can't find ${PIN}" >&2 && exit 9)
|
||||
|
Reference in New Issue
Block a user