summaryrefslogtreecommitdiff
path: root/speech.c
diff options
context:
space:
mode:
authormartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2005-12-02 12:32:47 +0000
committermartin-s <martin-s@ffa7fe5e-494d-0410-b361-a75ebd5db220>2005-12-02 12:32:47 +0000
commit100e703848d7d4491970333238345ca83619b02a (patch)
tree9c3c60e23963c888a904320b0a4d35fb4ebe4682 /speech.c
parentba8c7a19f05f6491eb7f191d44a5af8506f619cf (diff)
downloadnavit-svn-100e703848d7d4491970333238345ca83619b02a.tar.gz
Converting to autoconf/automake
git-svn-id: http://svn.code.sf.net/p/navit/code/trunk/navit/src@9 ffa7fe5e-494d-0410-b361-a75ebd5db220
Diffstat (limited to 'speech.c')
-rw-r--r--speech.c18
1 files changed, 16 insertions, 2 deletions
diff --git a/speech.c b/speech.c
index c913629c..8823e155 100644
--- a/speech.c
+++ b/speech.c
@@ -1,5 +1,5 @@
/* speechd simple client program
- * CVS revision: $Id: speech.c,v 1.1 2005-12-02 10:41:56 martin-s Exp $
+ * CVS revision: $Id: speech.c,v 1.2 2005-12-02 12:32:47 martin-s Exp $
* Author: Tomas Cerha <cerha@brailcom.cz> */
#include <sys/types.h>
@@ -11,8 +11,10 @@
#include <stdlib.h>
#include <glib.h>
#include <stdarg.h>
-
+#include "config.h"
+#ifdef HAVE_LIBSPEECHD
#include <libspeechd.h>
+#endif
#include "speech.h"
struct speech {
@@ -21,6 +23,7 @@ struct speech {
struct speech *
speech_new(void) {
+#ifdef HAVE_LIBSPEECHD
struct speech *this;
int sockfd;
@@ -32,30 +35,41 @@ speech_new(void) {
this->sockfd=sockfd;
}
return this;
+#else
+ return NULL;
+#endif
}
int
speech_say(struct speech *this, char *text) {
+#ifdef HAVE_LIBSPEECHD
int err;
err = spd_sayf(this->sockfd, 2, text);
if (err != 1)
return 1;
+#endif
return 0;
}
int
speech_sayf(struct speech *this, char *format, ...) {
+#ifdef HAVE_LIBSPEECHD
char buffer[8192];
va_list ap;
va_start(ap,format);
vsnprintf(buffer, 8192, format, ap);
return speech_say(this, buffer);
+#else
+ return 0;
+#endif
}
int
speech_destroy(struct speech *this) {
+#ifdef HAVE_LIBSPEECHD
spd_close(this->sockfd);
g_free(this);
+#endif
return 0;
}