阅读busybox telnetd line[8] =

最近在看busybox中telnetd源码,发下在make_new_sessi++on-->xgetpty-->存在如下部分代码


    ...
strcpy(li++ne, "/dev/ptyXX");

for (i = 0; i < 16; i++) {
line[8] = "pqrstuvwxyzabcde"[i];
line[9] = '0';
if (stat(line, &stb) < 0) {
continue;
}
for (j = 0; j < 16; j++) {
line[9] = j < 10 ? j + '0' : j - 10 + 'a';
if (DEBUG)
fprintf(stderr, "Trying to open device: %s\n", line);
p = open(line, O_RDWR | O_NOCTTY);
if (p >= 0) {
line[5] = 't';
return p;
}
}
}
...

初看之下 “line[8] = "pqrstuvwxyzabcde"[i];”的用法真的是没看懂...其实很简单

    line[8] = "pqrstuvwxyzabcde"[i];
line[9] = '0';