shithub: orca

Download patch

ref: b1fc24bed0a7a676d7f5927cd860724425189dbe
parent: f56fe8eac7cdbff993a82e4f352587bec492c11c
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Tue Feb 25 09:52:10 EST 2020

plan9: allow absolute path as udp destination, in which case it's treated as a normal file

--- a/orca.man
+++ b/orca.man
@@ -232,8 +232,9 @@
 .B ip ADDR
 Set UDP/OSC destination IP address.
 .TP
-.B udp NUMBER
-Set UDP destination port.
+.B udp NUMBER|PATH
+Set UDP destination port.  Parameter is treated as a filename if it's
+an absolute path.
 .TP
 .B midi PATH
 Set MIDI output path.
--- a/plan9.c
+++ b/plan9.c
@@ -382,9 +382,15 @@
 		free(udpport);
 		udpport = strdup(newudpport);
 	}
-	if (udp < 0 && ip[0] && udpport[0] && (udp = dial(netmkaddr(ip, "udp", udpport), nil, nil, nil)) < 0) {
-		fprint(2, "udp failed: %r\n");
-		/* FIXME display error */
+
+	if (udp < 0 && ip[0] && udpport[0]) {
+		if (udpport[0] == '/')
+			udp = open(udpport, OWRITE);
+		else
+			udp = dial(netmkaddr(ip, "udp", udpport), nil, nil, nil);
+
+		if (udp < 0) /* FIXME display error */
+			fprint(2, "udp failed: %r\n");
 	}
 }