summaryrefslogtreecommitdiff
path: root/media/mpv/file2string.awk
diff options
context:
space:
mode:
authorMichael Forney <mforney@mforney.org>2016-07-02 21:28:38 -0700
committerMichael Forney <mforney@mforney.org>2016-07-02 21:45:13 -0700
commit254cb4b343fb256e98fbcc92dccefd95bff65f3e (patch)
treeeb5196991067b659c7b76de8dc49f6b4a64206b5 /media/mpv/file2string.awk
parent52b92b6ff3985b81d8ef513fea3d4d8b3c4bc6e5 (diff)
Add mpv 0.18.0
Diffstat (limited to 'media/mpv/file2string.awk')
-rw-r--r--media/mpv/file2string.awk23
1 files changed, 23 insertions, 0 deletions
diff --git a/media/mpv/file2string.awk b/media/mpv/file2string.awk
new file mode 100644
index 00000000..113d1729
--- /dev/null
+++ b/media/mpv/file2string.awk
@@ -0,0 +1,23 @@
+BEGIN {
+ for (n = 0; n < 256; ++n)
+ ord[sprintf("%c", n)] = n
+}
+
+FNR == 1 {
+ print "/* Generated from " FILENAME " */"
+}
+
+{
+ printf "\""
+ s = $0
+ while (length(s) > 0) {
+ i = match(s, "[^][A-Za-z0-9!#%&'()*+,./:;<=>^_{|}~ -]")
+ if (i == 0) {
+ printf "%s", s
+ break
+ }
+ printf "%s\\%03o", substr(s, 1, i-1), ord[substr(s, i, 1)]
+ s = substr(s, i+1)
+ }
+ printf "\\012\"\n"
+}