Version 0.3.0 from FTP

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@546 65c4cc65-6c06-0410-ace0-fbb531ad65f3
1.0
Mark Spencer 23 years ago
parent c6df9fae0e
commit 4fc8108a2b

@ -58,8 +58,10 @@ struct ast_ha *ast_append_ha(char *sense, char *stuff, struct ast_ha *path)
path = path->next; path = path->next;
} }
if (ha) { if (ha) {
strtok(stuff, "/"); char *stringp=NULL;
nm = strtok(NULL, "/"); stringp=stuff;
strsep(&stringp, "/");
nm = strsep(&stringp, "/");
if (!nm) if (!nm)
nm = "255.255.255.255"; nm = "255.255.255.255";
if (!inet_aton(stuff, &ha->netaddr)) { if (!inet_aton(stuff, &ha->netaddr)) {

@ -51,13 +51,15 @@ static int playback_exec(struct ast_channel *chan, void *data)
char *options; char *options;
int option_skip=0; int option_skip=0;
int option_noanswer = 0; int option_noanswer = 0;
char *stringp;
if (!data || !strlen((char *)data)) { if (!data || !strlen((char *)data)) {
ast_log(LOG_WARNING, "Playback requires an argument (filename)\n"); ast_log(LOG_WARNING, "Playback requires an argument (filename)\n");
return -1; return -1;
} }
strncpy(tmp, (char *)data, sizeof(tmp)-1); strncpy(tmp, (char *)data, sizeof(tmp)-1);
strtok(tmp, "|"); stringp=tmp;
options = strtok(NULL, "|"); strsep(&stringp, "|");
options = strsep(&stringp, "|");
if (options && !strcasecmp(options, "skip")) if (options && !strcasecmp(options, "skip"))
option_skip = 1; option_skip = 1;
if (options && !strcasecmp(options, "noanswer")) if (options && !strcasecmp(options, "noanswer"))

@ -201,7 +201,6 @@ static int del_identifier(int identifier,int identifier_type) {
static int aPGSQL_connect(struct ast_channel *chan, void *data) { static int aPGSQL_connect(struct ast_channel *chan, void *data) {
char *ptrptr;
char *s1,*s4; char *s1,*s4;
char s[100]; char s[100];
char *optionstring; char *optionstring;
@ -210,15 +209,17 @@ static int aPGSQL_connect(struct ast_channel *chan, void *data) {
int res; int res;
PGconn *karoto; PGconn *karoto;
int id; int id;
char *stringp=NULL;
res=0; res=0;
l=strlen(data)+2; l=strlen(data)+2;
s1=malloc(l); s1=malloc(l);
strncpy(s1,data,l); strncpy(s1,data,l);
strtok_r(s1," ",&ptrptr); // eat the first token, we already know it :P stringp=s1;
var=strtok_r(NULL," ",&ptrptr); strsep(&stringp," "); // eat the first token, we already know it :P
optionstring=strtok_r(NULL,"\n",&ptrptr); var=strsep(&stringp," ");
optionstring=strsep(&stringp,"\n");
karoto = PQconnectdb(optionstring); karoto = PQconnectdb(optionstring);
if (PQstatus(karoto) == CONNECTION_BAD) { if (PQstatus(karoto) == CONNECTION_BAD) {
@ -239,7 +240,6 @@ static int aPGSQL_connect(struct ast_channel *chan, void *data) {
static int aPGSQL_query(struct ast_channel *chan, void *data) { static int aPGSQL_query(struct ast_channel *chan, void *data) {
char *ptrptr;
char *s1,*s2,*s3,*s4,*s5; char *s1,*s2,*s3,*s4,*s5;
char s[100]; char s[100];
char *querystring; char *querystring;
@ -249,6 +249,7 @@ static int aPGSQL_query(struct ast_channel *chan, void *data) {
PGconn *karoto; PGconn *karoto;
PGresult *PGSQLres; PGresult *PGSQLres;
int id,id1; int id,id1;
char *stringp=NULL;
res=0; res=0;
@ -256,13 +257,14 @@ static int aPGSQL_query(struct ast_channel *chan, void *data) {
s1=malloc(l); s1=malloc(l);
s2=malloc(l); s2=malloc(l);
strcpy(s1,data); strcpy(s1,data);
strtok_r(s1," ",&ptrptr); // eat the first token, we already know it :P stringp=s1;
s3=strtok_r(NULL," ",&ptrptr); strsep(&stringp," "); // eat the first token, we already know it :P
s3=strsep(&stringp," ");
while (1) { // ugly trick to make branches with break; while (1) { // ugly trick to make branches with break;
var=s3; var=s3;
s4=strtok_r(NULL," ",&ptrptr); s4=strsep(&stringp," ");
id=atoi(s4); id=atoi(s4);
querystring=strtok_r(NULL,"\n",&ptrptr); querystring=strsep(&stringp,"\n");
if ((karoto=find_identifier(id,AST_PGSQL_ID_CONNID))==NULL) { if ((karoto=find_identifier(id,AST_PGSQL_ID_CONNID))==NULL) {
ast_log(LOG_WARNING,"Invalid connection identifier %d passed in aPGSQL_query\n",id); ast_log(LOG_WARNING,"Invalid connection identifier %d passed in aPGSQL_query\n",id);
res=-1; res=-1;
@ -297,7 +299,6 @@ static int aPGSQL_query(struct ast_channel *chan, void *data) {
static int aPGSQL_fetch(struct ast_channel *chan, void *data) { static int aPGSQL_fetch(struct ast_channel *chan, void *data) {
char *ptrptr;
char *s1,*s2,*s3,*s4,*s5,*s6,*s7; char *s1,*s2,*s3,*s4,*s5,*s6,*s7;
char s[100]; char s[100];
char *var; char *var;
@ -309,6 +310,7 @@ static int aPGSQL_fetch(struct ast_channel *chan, void *data) {
int nres; int nres;
struct ast_var_t *variables; struct ast_var_t *variables;
struct varshead *headp; struct varshead *headp;
char *stringp=NULL;
headp=&chan->varshead; headp=&chan->varshead;
@ -318,8 +320,9 @@ static int aPGSQL_fetch(struct ast_channel *chan, void *data) {
s1=malloc(l); s1=malloc(l);
s2=malloc(l); s2=malloc(l);
strcpy(s1,data); strcpy(s1,data);
strtok_r(s1," ",&ptrptr); // eat the first token, we already know it :P stringp=s1;
s3=strtok_r(NULL," ",&ptrptr); strsep(&stringp," "); // eat the first token, we already know it :P
s3=strsep(&stringp," ");
while (1) { // ugly trick to make branches with break; while (1) { // ugly trick to make branches with break;
var=s3; // fetchid var=s3; // fetchid
fnd=0; fnd=0;
@ -337,7 +340,7 @@ static int aPGSQL_fetch(struct ast_channel *chan, void *data) {
pbx_builtin_setvar_helper(chan,s3,s7); pbx_builtin_setvar_helper(chan,s3,s7);
} }
s4=strtok_r(NULL," ",&ptrptr); s4=strsep(&stringp," ");
id=atoi(s4); // resultid id=atoi(s4); // resultid
if ((PGSQLres=find_identifier(id,AST_PGSQL_ID_RESID))==NULL) { if ((PGSQLres=find_identifier(id,AST_PGSQL_ID_RESID))==NULL) {
ast_log(LOG_WARNING,"Invalid result identifier %d passed in aPGSQL_fetch\n",id); ast_log(LOG_WARNING,"Invalid result identifier %d passed in aPGSQL_fetch\n",id);
@ -355,7 +358,7 @@ static int aPGSQL_fetch(struct ast_channel *chan, void *data) {
nres=PQnfields(PGSQLres); nres=PQnfields(PGSQLres);
ast_log(LOG_WARNING,"ast_PGSQL_fetch : nres = %d i = %d ;\n",nres,i); ast_log(LOG_WARNING,"ast_PGSQL_fetch : nres = %d i = %d ;\n",nres,i);
for (j=0;j<nres;j++) { for (j=0;j<nres;j++) {
s5=strtok_r(NULL," ",&ptrptr); s5=strsep(&stringp," ");
if (s5==NULL) { if (s5==NULL) {
ast_log(LOG_WARNING,"ast_PGSQL_fetch : More tuples (%d) than variables (%d)\n",nres,j); ast_log(LOG_WARNING,"ast_PGSQL_fetch : More tuples (%d) than variables (%d)\n",nres,j);
break; break;
@ -391,18 +394,19 @@ static int aPGSQL_fetch(struct ast_channel *chan, void *data) {
static int aPGSQL_reset(struct ast_channel *chan, void *data) { static int aPGSQL_reset(struct ast_channel *chan, void *data) {
char *ptrptr;
char *s1,*s3; char *s1,*s3;
int l; int l;
PGconn *karoto; PGconn *karoto;
int id; int id;
char *stringp=NULL;
l=strlen(data)+2; l=strlen(data)+2;
s1=malloc(l); s1=malloc(l);
strcpy(s1,data); strcpy(s1,data);
strtok_r(s1," ",&ptrptr); // eat the first token, we already know it :P stringp=s1;
s3=strtok_r(NULL," ",&ptrptr); strsep(&stringp," "); // eat the first token, we already know it :P
s3=strsep(&stringp," ");
id=atoi(s3); id=atoi(s3);
if ((karoto=find_identifier(id,AST_PGSQL_ID_CONNID))==NULL) { if ((karoto=find_identifier(id,AST_PGSQL_ID_CONNID))==NULL) {
ast_log(LOG_WARNING,"Invalid connection identifier %d passed in aPGSQL_reset\n",id); ast_log(LOG_WARNING,"Invalid connection identifier %d passed in aPGSQL_reset\n",id);
@ -416,18 +420,19 @@ static int aPGSQL_reset(struct ast_channel *chan, void *data) {
static int aPGSQL_clear(struct ast_channel *chan, void *data) { static int aPGSQL_clear(struct ast_channel *chan, void *data) {
char *ptrptr;
char *s1,*s3; char *s1,*s3;
int l; int l;
PGresult *karoto; PGresult *karoto;
int id; int id;
char *stringp=NULL;
l=strlen(data)+2; l=strlen(data)+2;
s1=malloc(l); s1=malloc(l);
strcpy(s1,data); strcpy(s1,data);
strtok_r(s1," ",&ptrptr); // eat the first token, we already know it :P stringp=s1;
s3=strtok_r(NULL," ",&ptrptr); strsep(&stringp," "); // eat the first token, we already know it :P
s3=strsep(&stringp," ");
id=atoi(s3); id=atoi(s3);
if ((karoto=find_identifier(id,AST_PGSQL_ID_RESID))==NULL) { if ((karoto=find_identifier(id,AST_PGSQL_ID_RESID))==NULL) {
ast_log(LOG_WARNING,"Invalid result identifier %d passed in aPGSQL_clear\n",id); ast_log(LOG_WARNING,"Invalid result identifier %d passed in aPGSQL_clear\n",id);
@ -445,18 +450,19 @@ static int aPGSQL_clear(struct ast_channel *chan, void *data) {
static int aPGSQL_disconnect(struct ast_channel *chan, void *data) { static int aPGSQL_disconnect(struct ast_channel *chan, void *data) {
char *ptrptr;
char *s1,*s3; char *s1,*s3;
int l; int l;
PGconn *karoto; PGconn *karoto;
int id; int id;
char *stringp=NULL;
l=strlen(data)+2; l=strlen(data)+2;
s1=malloc(l); s1=malloc(l);
strcpy(s1,data); strcpy(s1,data);
strtok_r(s1," ",&ptrptr); // eat the first token, we already know it :P stringp=s1;
s3=strtok_r(NULL," ",&ptrptr); strsep(&stringp," "); // eat the first token, we already know it :P
s3=strsep(&stringp," ");
id=atoi(s3); id=atoi(s3);
if ((karoto=find_identifier(id,AST_PGSQL_ID_CONNID))==NULL) { if ((karoto=find_identifier(id,AST_PGSQL_ID_CONNID))==NULL) {
ast_log(LOG_WARNING,"Invalid connection identifier %d passed in aPGSQL_disconnect\n",id); ast_log(LOG_WARNING,"Invalid connection identifier %d passed in aPGSQL_disconnect\n",id);

@ -52,13 +52,15 @@ static int sendurl_exec(struct ast_channel *chan, void *data)
char *options; char *options;
int option_wait=0; int option_wait=0;
struct ast_frame *f; struct ast_frame *f;
char *stringp=NULL;
if (!data || !strlen((char *)data)) { if (!data || !strlen((char *)data)) {
ast_log(LOG_WARNING, "SendURL requires an argument (URL)\n"); ast_log(LOG_WARNING, "SendURL requires an argument (URL)\n");
return -1; return -1;
} }
strncpy(tmp, (char *)data, sizeof(tmp)-1); strncpy(tmp, (char *)data, sizeof(tmp)-1);
strtok(tmp, "|"); stringp=tmp;
options = strtok(NULL, "|"); strsep(&stringp, "|");
options = strsep(&stringp, "|");
if (options && !strcasecmp(options, "wait")) if (options && !strcasecmp(options, "wait"))
option_wait = 1; option_wait = 1;
LOCAL_USER_ADD(u); LOCAL_USER_ADD(u);

Loading…
Cancel
Save