summaryrefslogtreecommitdiffstats
path: root/src/csv.c
diff options
context:
space:
mode:
authorDavid Troy <dave@popvox.com>2006-04-01 16:56:25 +0000
committerDavid Troy <dave@popvox.com>2006-04-01 16:56:25 +0000
commitad2c8750819f7e236c0baaf7edf2affd50c9d0a0 (patch)
treedf3dc712677fb503d17b94591d8ab374d9167686 /src/csv.c
parent93b557bf0a56e24cd4fb3f1452c90e3e6c253e97 (diff)
downloadastmanproxy-ad2c8750819f7e236c0baaf7edf2affd50c9d0a0.tar.gz
astmanproxy-ad2c8750819f7e236c0baaf7edf2affd50c9d0a0.tar.xz
astmanproxy-ad2c8750819f7e236c0baaf7edf2affd50c9d0a0.zip
git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/branches/1.20pre@34 f02b47b9-160a-0410-81a6-dc3441afb0ec
Diffstat (limited to 'src/csv.c')
-rw-r--r--src/csv.c33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/csv.c b/src/csv.c
new file mode 100644
index 0000000..bf8e800
--- /dev/null
+++ b/src/csv.c
@@ -0,0 +1,33 @@
+/* Asterisk Manager Proxy
+ Copyright (c) 2005 David C. Troy <dave@popvox.com>
+
+ This program is free software, distributed under the terms of
+ the GNU General Public License.
+
+ CSV I/O Handler
+*/
+
+#include "astmanproxy.h"
+
+/* TODO: catch and expand/handle commas in output */
+
+int _write(struct mansession *s, struct message *m) {
+ int i;
+ char outstring[MAX_LEN];
+
+ pthread_mutex_lock(&s->lock);
+ for (i=0; i<m->hdrcount; i++) {
+ sprintf(outstring, "\"%s\"", m->headers[i]);
+ if (i<m->hdrcount-1)
+ strcat(outstring, ", ");
+ write(s->fd, outstring, strlen(outstring));
+ }
+ write(s->fd, "\r\n\r\n", 4);
+ pthread_mutex_unlock(&s->lock);
+
+ return 0;
+}
+
+int _autodisconnect() {
+ return 0;
+}