Skip to content

Commit

Permalink
Stop a warning about NUL bytes in stl files in autodescribe
Browse files Browse the repository at this point in the history
  • Loading branch information
dfandrich committed Dec 15, 2023
1 parent 6e6e5bc commit 7757381
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion autodescribe
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,7 @@ comment_spdx () {
# File type: stl (STL model file)
comment_stl () {
# Detect ASCII or binary format
if [ "$(dd if="$1" bs=1 count=80 2>/dev/null | wc -l)" -gt 0 -a "$(dd if="$1" bs=1 count=6 2>/dev/null)" = "solid " -a "$(dd if="$1" bs=1 count=1 skip=80 2>/dev/null | od -An -b)" != "000" ]; then
if [ "$(dd if="$1" bs=1 count=80 2>/dev/null | wc -l)" -gt 0 -a "$(dd if="$1" bs=1 count=6 2>/dev/null | tr -d '\0')" = "solid " -a "$(dd if="$1" bs=1 count=1 skip=80 2>/dev/null | od -An -b)" != "000" ]; then
# ASCII stl format
COMMENT=$(sed -n -E -e 's/[[:space:]]*$//' -e '1s/^solid +//p' < "$1")
else
Expand Down

0 comments on commit 7757381

Please sign in to comment.