aboutsummaryrefslogtreecommitdiffstats
path: root/utils/say.c
diff options
context:
space:
mode:
authorWilliam Harrington <kb0iic@berzerkula.org>2025-01-14 16:06:02 -0600
committerWilliam Harrington <kb0iic@berzerkula.org>2025-01-14 16:06:02 -0600
commit0cc9b20c15460213e488bf5e70963b941482f628 (patch)
treebb0143245583ec846630f39bfa2258dba640ccd7 /utils/say.c
parent0e084ade5069756d487b5c948c48b777e37c00c9 (diff)
Add source.
Diffstat (limited to 'utils/say.c')
-rw-r--r--utils/say.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/utils/say.c b/utils/say.c
new file mode 100644
index 0000000..b774eaf
--- /dev/null
+++ b/utils/say.c
@@ -0,0 +1,34 @@
+/*
+ * Send text to speech server. May be used in script files.
+ * $Id: say.c 1.2 Mon, 24 Mar 1997 12:25:37 -0500 dyfet $
+ * Copyright (c) 1997 by Tycho Softworks.
+ * For conditions on distribution and reuse see product license.
+ */
+
+#include <std/string.h>
+#include <std/process.h>
+#include <net/stream.h>
+
+void main(int argc, char **argv)
+{
+ STREAM fp;
+ int port = getservice("speak");
+ char buf[128];
+
+ if(argc != 3)
+ fatal(EX_USAGE, "use: say host \"message\"\n");
+
+ if(!port)
+ fatal(EX_UNAVAILABLE, "say: speak: service not in /etc/services\n");
+
+ fp = opentcp(argv[1], port);
+ if(!fp)
+ fatal(EX_UNAVAILABLE, "say: %s: speak service unavailable\n", argv[1]);
+
+ gettcp(buf, 127, fp);
+ puttcp(argv[2], fp);
+ puttcp("\n", fp);
+ closetcp(fp);
+}
+
+