diff options
Diffstat (limited to 'utils/say.c')
-rw-r--r-- | utils/say.c | 34 |
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); +} + + |