[Asterisk-cvs] asterisk/apps app_read.c,1.1,1.2
markster at lists.digium.com
markster at lists.digium.com
Sun Nov 9 22:27:49 CST 2003
Update of /usr/cvsroot/asterisk/apps
In directory mongoose.digium.com:/tmp/cvs-serv25032/apps
Modified Files:
app_read.c
Log Message:
Store read data in a variable
Index: app_read.c
===================================================================
RCS file: /usr/cvsroot/asterisk/apps/app_read.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- app_read.c 10 Nov 2003 04:47:43 -0000 1.1
+++ app_read.c 10 Nov 2003 04:54:02 -0000 1.2
@@ -19,6 +19,7 @@
#include <asterisk/app.h>
#include <asterisk/module.h>
#include <asterisk/translate.h>
+#include <asterisk/options.h>
#include <string.h>
#include <stdlib.h>
#include <pthread.h>
@@ -54,6 +55,10 @@
stringp=tmp;
strsep(&stringp, "|");
filename = strsep(&stringp, "|");
+ if (!strlen(tmp)) {
+ ast_log(LOG_WARNING, "Read requires an variable name\n");
+ return -1;
+ }
LOCAL_USER_ADD(u);
if (chan->_state != AST_STATE_UP) {
/* Answer if the line isn't up. */
@@ -62,7 +67,9 @@
if (!res) {
ast_stopstream(chan);
res = ast_app_getdata(chan, filename, tmp2, sizeof(tmp2) - 1, 0);
- ast_verbose("You entered '%s'\n", tmp2);
+ if (!res)
+ pbx_builtin_setvar_helper(chan, tmp, tmp2);
+ ast_verbose(VERBOSE_PREFIX_3 "User entered '%s'\n", tmp2);
}
LOCAL_USER_REMOVE(u);
return res;
More information about the svn-commits
mailing list