mirror of
https://github.com/asterisk/asterisk.git
synced 2025-09-30 18:40:46 +00:00
more strncpy/ast_copy_string replacement
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@22044 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -1042,9 +1042,9 @@ static void init_state(void)
|
|||||||
|
|
||||||
for (x=0;x<ADSI_MAX_INTRO;x++)
|
for (x=0;x<ADSI_MAX_INTRO;x++)
|
||||||
aligns[x] = ADSI_JUST_CENT;
|
aligns[x] = ADSI_JUST_CENT;
|
||||||
strncpy(intro[0], "Welcome to the", sizeof(intro[0]) - 1);
|
ast_copy_string(intro[0], "Welcome to the", sizeof(intro[0]));
|
||||||
strncpy(intro[1], "Asterisk", sizeof(intro[1]) - 1);
|
ast_copy_string(intro[1], "Asterisk", sizeof(intro[1]));
|
||||||
strncpy(intro[2], "Open Source PBX", sizeof(intro[2]) - 1);
|
ast_copy_string(intro[2], "Open Source PBX", sizeof(intro[2]));
|
||||||
total = 3;
|
total = 3;
|
||||||
speeds = 0;
|
speeds = 0;
|
||||||
for (x=3;x<ADSI_MAX_INTRO;x++)
|
for (x=3;x<ADSI_MAX_INTRO;x++)
|
||||||
@@ -1063,43 +1063,36 @@ static void adsi_load(void)
|
|||||||
conf = ast_config_load("adsi.conf");
|
conf = ast_config_load("adsi.conf");
|
||||||
if (conf) {
|
if (conf) {
|
||||||
x=0;
|
x=0;
|
||||||
v = ast_variable_browse(conf, "intro");
|
for (v = ast_variable_browse(conf, "intro"); v; v = v->next) {
|
||||||
while(v) {
|
|
||||||
if (!strcasecmp(v->name, "alignment"))
|
if (!strcasecmp(v->name, "alignment"))
|
||||||
alignment = str2align(v->value);
|
alignment = str2align(v->value);
|
||||||
else if (!strcasecmp(v->name, "greeting")) {
|
else if (!strcasecmp(v->name, "greeting")) {
|
||||||
if (x < ADSI_MAX_INTRO) {
|
if (x < ADSI_MAX_INTRO) {
|
||||||
aligns[x] = alignment;
|
aligns[x] = alignment;
|
||||||
strncpy(intro[x], v->value, sizeof(intro[x]) - 1);
|
ast_copy_string(intro[x], v->value, sizeof(intro[x]));
|
||||||
intro[x][sizeof(intro[x]) - 1] = '\0';
|
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
} else if (!strcasecmp(v->name, "maxretries")) {
|
} else if (!strcasecmp(v->name, "maxretries")) {
|
||||||
if (atoi(v->value) > 0)
|
if (atoi(v->value) > 0)
|
||||||
maxretries = atoi(v->value);
|
maxretries = atoi(v->value);
|
||||||
}
|
}
|
||||||
v = v->next;
|
|
||||||
}
|
}
|
||||||
v = ast_variable_browse(conf, "speeddial");
|
|
||||||
if (x)
|
if (x)
|
||||||
total = x;
|
total = x;
|
||||||
x = 0;
|
x = 0;
|
||||||
while(v) {
|
for (v = ast_variable_browse(conf, "speeddial"); v; v = v->next) {
|
||||||
char *stringp=NULL;
|
char *stringp = v->value;
|
||||||
stringp=v->value;
|
|
||||||
name = strsep(&stringp, ",");
|
name = strsep(&stringp, ",");
|
||||||
sname = strsep(&stringp, ",");
|
sname = strsep(&stringp, ",");
|
||||||
if (!sname)
|
if (!sname)
|
||||||
sname = name;
|
sname = name;
|
||||||
if (x < ADSI_MAX_SPEED_DIAL) {
|
if (x < ADSI_MAX_SPEED_DIAL) {
|
||||||
/* Up to 20 digits */
|
/* Up to 20 digits */
|
||||||
strncpy(speeddial[x][0], v->name, sizeof(speeddial[x][0]) - 1);
|
ast_copy_string(speeddial[x][0], v->name, sizeof(speeddial[x][0]));
|
||||||
strncpy(speeddial[x][1], name, 18);
|
strncpy(speeddial[x][1], name, 18);
|
||||||
strncpy(speeddial[x][2], sname, 7);
|
strncpy(speeddial[x][2], sname, 7);
|
||||||
x++;
|
x++;
|
||||||
}
|
}
|
||||||
v = v->next;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
if (x)
|
if (x)
|
||||||
speeds = x;
|
speeds = x;
|
||||||
|
Reference in New Issue
Block a user