Get rid of strtok(), it is depricated inside libs
This commit is contained in:
parent
c90720154b
commit
ed42ac9324
@ -167,7 +167,7 @@ void attr_clear(WINDOW *win, int height, int width, chtype attr)
|
|||||||
*/
|
*/
|
||||||
void print_autowrap(WINDOW *win, unsigned char *prompt, int height, int width, int maxwidth, int y, int x, int center, int rawmode)
|
void print_autowrap(WINDOW *win, unsigned char *prompt, int height, int width, int maxwidth, int y, int x, int center, int rawmode)
|
||||||
{
|
{
|
||||||
int first = 1, cur_x, cur_y, i;
|
int cur_x, cur_y, i;
|
||||||
unsigned char tempstr[MAX_LEN+1], *word, *tempptr, *tempptr1;
|
unsigned char tempstr[MAX_LEN+1], *word, *tempptr, *tempptr1;
|
||||||
chtype ostuff[132], attrs = 0, init_bottom = 0;
|
chtype ostuff[132], attrs = 0, init_bottom = 0;
|
||||||
|
|
||||||
@ -244,13 +244,15 @@ void print_autowrap(WINDOW *win, unsigned char *prompt, int height, int width, i
|
|||||||
waddstr(win, tempstr);
|
waddstr(win, tempstr);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
char *p = tempstr;
|
||||||
|
|
||||||
/* Print prompt word by word, wrap around if necessary */
|
/* Print prompt word by word, wrap around if necessary */
|
||||||
while ((word = strtok(first ? tempstr : NULL, "\t\n ")) != NULL) {
|
while ((word = strsep(&p, "\t\n ")) != NULL) {
|
||||||
int loop;
|
int loop;
|
||||||
unsigned char sc;
|
unsigned char sc;
|
||||||
|
|
||||||
if (first) /* First iteration */
|
if (*word == '\0')
|
||||||
first = 0;
|
continue;
|
||||||
do {
|
do {
|
||||||
loop = 0;
|
loop = 0;
|
||||||
if (cur_x+strlen(word) >= width+1) { /* wrap around to next line */
|
if (cur_x+strlen(word) >= width+1) { /* wrap around to next line */
|
||||||
|
@ -78,13 +78,13 @@ int dialog_prgbox(unsigned char *title, const unsigned char *line, int height, i
|
|||||||
|
|
||||||
if (!use_shell) {
|
if (!use_shell) {
|
||||||
char cmdline[MAX_LEN];
|
char cmdline[MAX_LEN];
|
||||||
char *av[51], **ap = av, *val;
|
char *av[51], **ap = av, *val, *p;
|
||||||
int first = 1;
|
|
||||||
|
|
||||||
strcpy(cmdline, line);
|
strcpy(cmdline, line);
|
||||||
while ((val = strtok(first ? cmdline : NULL, " \t")) != NULL) {
|
p = cmdline;
|
||||||
first = 0;
|
while ((val = strsep(&p," \t")) != NULL) {
|
||||||
*ap++ = val;
|
if (*val != '\0')
|
||||||
|
*ap++ = val;
|
||||||
}
|
}
|
||||||
*ap = NULL;
|
*ap = NULL;
|
||||||
f = raw_popen(name = av[0], av, "r");
|
f = raw_popen(name = av[0], av, "r");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user