Re-use AWK components
[khatus.git] / src / awk / lib / msg_out.awk
diff --git a/src/awk/lib/msg_out.awk b/src/awk/lib/msg_out.awk
new file mode 100755 (executable)
index 0000000..9207fd0
--- /dev/null
@@ -0,0 +1,20 @@
+BEGIN {
+    OFS = Msg_fs ? Msg_fs : "|"
+    Kfs = Key_fs ? Key_fs : ":"
+}
+
+function msg_out_ok(key, val) {
+    msg_out("OK", key, val, "/dev/stdout")
+}
+
+function msg_out_info(location, msg) {
+    msg_out("INFO", location, msg, "/dev/stderr")
+}
+
+function msg_out_error(location, msg) {
+    msg_out("ERROR", location, msg, "/dev/stderr")
+}
+
+function msg_out(status, key, val, channel) {
+    print(status, key, val) > channel
+}
This page took 0.033474 seconds and 4 git commands to generate.