… | |
… | |
425 | while (1) |
425 | while (1) |
426 | { |
426 | { |
427 | /* 1. Extract an info */ |
427 | /* 1. Extract an info */ |
428 | info = nextinfo; |
428 | info = nextinfo; |
429 | |
429 | |
430 | while ((info < len) && (buf[info] == ' ')) |
430 | while ((info < len) && (buf [info] == ' ')) |
431 | info++; |
431 | info++; |
432 | |
432 | |
433 | if (info >= len) |
433 | if (info >= len) |
434 | break; |
434 | break; |
435 | |
435 | |
436 | nextinfo = info + 1; |
436 | nextinfo = info + 1; |
437 | |
437 | |
438 | while ((nextinfo < len) && (buf[nextinfo] != ' ')) |
438 | while ((nextinfo < len) && (buf [nextinfo] != ' ')) |
439 | nextinfo++; |
439 | nextinfo++; |
440 | |
440 | |
441 | if (nextinfo - info >= 49) /*Erroneous info asked */ |
441 | if (nextinfo - info >= 49) /*Erroneous info asked */ |
442 | continue; |
442 | continue; |
443 | |
443 | |
444 | strncpy (command, &(buf[info]), nextinfo - info); |
444 | memcpy (command, buf + info, nextinfo - info); |
445 | command[nextinfo - info] = '\0'; |
445 | command [nextinfo - info] = 0; |
|
|
446 | |
446 | /* 2. Interpret info */ |
447 | /* 2. Interpret info */ |
447 | i = sscanf (command, "%d", &flag); |
448 | i = sscanf (command, "%d", &flag); |
448 | |
449 | |
449 | if ((i == 1) && (flag > 0) && (flag <= MSG_TYPE_LAST)) |
450 | if ((i == 1) && (flag > 0) && (flag <= MSG_TYPE_LAST)) |
450 | ns->supported_readables |= (1 << flag); |
451 | ns->supported_readables |= (1 << flag); |