handle more DOS line endings (please continue not to ask)

This commit is contained in:
4am 2022-07-29 20:04:56 -04:00
parent f51db58911
commit 9576a45951
5 changed files with 6 additions and 6 deletions

View File

@ -45,7 +45,7 @@ fi
# make temp file with list of lines that contain keys
records=$(mktemp)
awk '!/^$|^#|^\[/' > "$records"
tr -d "\r" | awk '!/^$|^#|^\[/' > "$records"
# make temp assembly source file that represents the binary OKVS data structure
source=$(mktemp)

View File

@ -2,7 +2,7 @@
# make temp file with just the key/value pairs (strip blank lines, comments, eof marker)
records=$(mktemp)
awk '!/^$|^#|^\[/' > "$records"
tr -d "\r" | awk '!/^$|^#|^\[/' > "$records"
# make temp assembly source file that represents the binary OKVS data structure
source=$(mktemp)

View File

@ -9,7 +9,7 @@
# make temp file with just the key/value pairs (strip blank lines, comments, eof marker)
records=$(mktemp)
awk '!/^$|^#|^\[/' > "$records"
tr -d "\r" | awk '!/^$|^#|^\[/' > "$records"
# read logs of offsets & sizes for HGR and DHGR titles
# that were generated by an earlier script

View File

@ -21,7 +21,7 @@ games=$(cat "$1")
# make temp file with just the key/value pairs (strip blank lines, comments, eof marker)
records=$(mktemp)
awk '!/^$|^#|^\[/' > "$records"
tr -d "\r" | awk '!/^$|^#|^\[/' > "$records"
# make temp assembly source file that represents the binary OKVS data structure
source=$(mktemp)
@ -35,7 +35,7 @@ source=$(mktemp)
if [ "$include_displayname" = false ]; then
displayname=""
else
displayname=$(echo "$line" | awk -F= '{ print $2 }')
displayname=$(echo "$line" | tr -d "\r" | awk -F= '{ print $2 }')
fi
echo "!byte ${#key}+${#value}+${#displayname}+5" # OKVS record length
echo "!byte ${#key}" # OKVS key length

View File

@ -1,4 +1,4 @@
#!/bin/sh
tr "\*\~\<\>\$\%" "\020\021\010\025\016\017" < "$1" | \
awk '!/^\[/ { printf "%c%s", length, $0 } END { printf "\xFF" }' > "$2"
tr -d "\r" | awk '!/^\[/ { printf "%c%s", length, $0 } END { printf "\xFF" }' > "$2"