Showing the changes to compat (1 of 1 file). Show all
Unified · Split
| @@ -1,3 +1,5 @@ | ||
| 1 | +#!/bin/sh | |
| 2 | + | |
| 1 | 3 | # Copyright (c) 2017, NVIDIA CORPORATION. All rights reserved. |
| 2 | 4 | # |
| 3 | 5 | # Permission is hereby granted, free of charge, to any person obtaining a |
| @@ -22,15 +24,13 @@ set -e · 18 unmodified lines | ||
| 22 | 24 | |
| 23 | 25 | OUT="$1" |
| 24 | 26 | IN="$2" |
| 25 | −NAME="$(basename "$IN")" | |
| 26 | −NAME="${NAME/.ptx/}" | |
| 27 | +NAME="$(basename "$IN" | sed 's/\..*//')" | |
| 27 | 28 | |
| 28 | −echo -n "const char ${NAME}_ptx[] = \\" > "$OUT" | |
| 29 | +printf "const char %s_ptx[] = \\" "$NAME" > "$OUT" | |
| 29 | 30 | while read LINE |
| 30 | 31 | do |
| 31 | −echo -ne "\n\t\"$LINE\\\n\"" >> "$OUT" | |
| 32 | + printf "\n\t\"%s\\\n\"" "$(printf "%s" "$LINE" | sed 's/["\\]/\\&/g')" >> "$OUT" | |
| 32 | 33 | done < "$IN" |
| 33 | −echo ";" >> "$OUT" | |
| 34 | +printf ";\n" >> "$OUT" | |
| 34 | 35 | |
| 35 | 36 | exit 0 |
| 36 | − | |