diff options
author | David Troy <dave@popvox.com> | 2006-04-01 16:16:31 +0000 |
---|---|---|
committer | David Troy <dave@popvox.com> | 2006-04-01 16:16:31 +0000 |
commit | a22601fbc7f006902469741467f185baeb220c97 (patch) | |
tree | d2f4c4a9442af0ddf8b592edf8293acbc7143584 | |
parent | 5a56fc37befb707c7f3c66dfd4e30649df9a90a7 (diff) | |
download | astmanproxy-a22601fbc7f006902469741467f185baeb220c97.tar.gz astmanproxy-a22601fbc7f006902469741467f185baeb220c97.tar.xz astmanproxy-a22601fbc7f006902469741467f185baeb220c97.zip |
Populating trunk
git-svn-id: http://svncommunity.digium.com/svn/astmanproxy/trunk@17 f02b47b9-160a-0410-81a6-dc3441afb0ec
-rw-r--r-- | csv.c | 33 |
1 files changed, 33 insertions, 0 deletions
@@ -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; +} |