Skip to content

Commit

Permalink
Tweak opt_set, opt_enable
Browse files Browse the repository at this point in the history
  • Loading branch information
thinkyhead committed Mar 12, 2021
1 parent 7f1fa0d commit 3107d8a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions buildroot/bin/opt_enable
Original file line number Diff line number Diff line change
Expand Up @@ -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:]]*\(\/\/\)*[[: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" ||
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
4 changes: 2 additions & 2 deletions buildroot/bin/opt_set
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ SED=$(which gsed || which sed)
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 "${SED} -i '/^\([[:blank:]]*\)\(\/\/\)*\([[:blank:]]*\)\(#define\s\+\b${1}\b\).*$/{s//\1\3\4 ${2}/;h};\${x;/./{x;q0};x;q9}' Marlin/Configuration.h" ||
eval "${SED} -i '/^\([[:blank:]]*\)\(\/\/\)*\([[:blank:]]*\)\(#define\s\+\b${1}\b\).*$/{s//\1\3\4 ${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
Expand Down

0 comments on commit 3107d8a

Please sign in to comment.