aboutsummaryrefslogtreecommitdiffstats
path: root/utils/say.c
blob: b774eaf5732b423f5b0b8c634ef4e72cce8f4154 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
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);
}