ipq806x: Initial TP-Link and ASUS OnHub support
[openwrt/openwrt.git] / target / linux / ipq806x / base-files / usr / bin / base64decode.uc
diff --git a/target/linux/ipq806x/base-files/usr/bin/base64decode.uc b/target/linux/ipq806x/base-files/usr/bin/base64decode.uc
new file mode 100755 (executable)
index 0000000..7dcf309
--- /dev/null
@@ -0,0 +1,23 @@
+#!/usr/bin/ucode
+
+import { stdin, open, error } from 'fs';
+
+if (length(ARGV) == 0 && stdin.isatty()) {
+       warn("usage: b64decode [stdin|path]\n");
+       exit(1);
+}
+
+let fp = stdin;
+let source = ARGV[0];
+
+if (source) {
+       fp = open(source);
+       if (!fp) {
+               warn('b64decode: unable to open ${source}: ${error()}\n');
+               exit(1);
+       }
+}
+
+print(b64dec(fp.read("all")));
+fp.close();
+exit(0);