Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit ef57784

Browse files
committed
fix bug make_command_token
1 parent 8b746b2 commit ef57784

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

‎prompt.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,11 @@ commands make_command_token(char *command_line) // 명령어 전체 문장 토
327327
}
328328

329329
to_lower_case(command); // 명령어 소문자화
330-
result.argv[result.argc] = (char *)calloc(strlen(command), sizeof(char)); // 메모리 공간 할당
330+
result.argv[result.argc] = (char *)calloc(BUFFER_SIZE, sizeof(char)); // 메모리 공간 할당
331331
strcpy(result.argv[result.argc++], command); // 토큰 배열에 복사
332332

333333
while((tmp = strtok(NULL, " ")) != NULL) { // 나머지 인자 복사
334-
result.argv[result.argc] = (char *)calloc(strlen(command), sizeof(char)); // 메모리 공간 할당
334+
result.argv[result.argc] = (char *)calloc(BUFFER_SIZE, sizeof(char)); // 메모리 공간 할당
335335
strcpy(result.argv[result.argc++], tmp); // 토큰 배열에 복사
336336
}
337337

@@ -355,7 +355,7 @@ int get_command_type(char *command) // COMMAND 타입 확인 및 반환
355355
return EXIT;
356356
else if(!strcmp(command, "help"))
357357
return HELP;
358-
else
358+
else
359359
return UNKNOWN;
360360
}
361361

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /