lab5: 指令参数匹配可能缺少空格
This commit is contained in:
parent
9f3a58f966
commit
495c7c195f
@ -148,6 +148,9 @@ static char *match_builtin_command_param(char *complement, int complement_time,
|
|||||||
if (matched) {
|
if (matched) {
|
||||||
// 如果匹配到,就进行拼接
|
// 如果匹配到,就进行拼接
|
||||||
memcpy(buf, complement, start_pos);
|
memcpy(buf, complement, start_pos);
|
||||||
|
if (buf[start_pos - 1] != ' ') {
|
||||||
|
buf[start_pos++] = ' ';
|
||||||
|
}
|
||||||
strcpy(buf + start_pos, matched);
|
strcpy(buf + start_pos, matched);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user