# (C) QP2 - How to modify prompt line

**URL:** <https://forum.codecrafters.io/t/c-qp2-how-to-modify-prompt-line/5111>\
**Category:** Challenges\
**Tags:** challenge:shell\
**Created:** [February 21, 2025, 9:34am UTC](https://forum.codecrafters.io/t/c-qp2-how-to-modify-prompt-line/5111 "2025-02-21T09:34:25Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![yuriko192](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/yuriko192/32/5070_2.png) [@yuriko192](https://forum.codecrafters.io/u/yuriko192)\
**Post date:** [February 21, 2025, 9:34am UTC](https://forum.codecrafters.io/t/c-qp2-how-to-modify-prompt-line/5111/1 "2025-02-21T09:34:25Z")

</div>

Repo link: [https://github.com/yuriko192/codecrafters-shell-c](https://github.com/yuriko192/codecrafters-shell-c)

currently im trying to solve the challenge Builtin completion #qp2  
but i kept receiving the error prompt line doesnt match expected value after tab is pressed

```auto
[tester::#QP2] Running tests for Stage #QP2 (Autocompletion - Builtin completion)
[tester::#QP2] Running ./your_program.sh
[tester::#QP2] ✓ Received prompt ($ )
[tester::#QP2] Typed "ech"
[tester::#QP2] ✓ Prompt line matches "$ ech"
[tester::#QP2] Pressed "<TAB>" (expecting autocomplete to "echo")
[your-program] $ ech
[tester::#QP2] Output does not match expected value.
[tester::#QP2] Expected: "$ echo "
[tester::#QP2] Received: "$ ech"
[tester::#QP2] Assertion failed.
[tester::#QP2] Test failed

```

so far, ive tried to enter rawmode to make sure the code is run on every keypress by using this logic in the file `app/shell.c`

```c

void set_terminal_raw_mode() {
    struct termios new_settings;
    tcgetattr(STDIN_FILENO, &original_settings);
    new_settings = original_settings;
    new_settings.c_lflag &= ~(ICANON | ECHO);
    new_settings.c_cc[VMIN] = 1;
    new_settings.c_cc[VTIME] = 0;
    tcsetattr(STDIN_FILENO, TCSANOW, &new_settings);
}

```

and ive modified my input logic to the func `void get_input(char **input)` in `app/main.c`

my logic for initializing the autocomplete trie is in the file `app/builtins.c` with the func named `void initialize_autocomplete() `

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [April 6, 2025, 7:00pm UTC](https://forum.codecrafters.io/t/c-qp2-how-to-modify-prompt-line/5111/5 "2025-04-06T19:00:54Z")

</div>

Hey @yuriko192, looks like you’ve got past this stage. Do you happen to remember what was wrong? Would love to see if we can improve the tester / instructions.

---

<div class="post-metadata">

**Author:** ![yuriko192](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/yuriko192/32/5070_2.png) [@yuriko192](https://forum.codecrafters.io/u/yuriko192)\
**Post date:** [April 7, 2025, 3:48pm UTC](https://forum.codecrafters.io/t/c-qp2-how-to-modify-prompt-line/5111/7 "2025-04-07T15:48:10Z")

</div>

nope, still stuck @andy1li i past the stage by trying another language

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [April 14, 2025, 3:10am UTC](https://forum.codecrafters.io/t/c-qp2-how-to-modify-prompt-line/5111/9 "2025-04-14T03:10:16Z")

</div>

Hey @yuriko192, sorry for the delayed response!

The issue was due to your repo using an older Alpine-based buildpack. I’ve upgraded it to the latest version and pushed a commit to your repo. You can run `git pull` to get the latest changes.

---

<div class="post-metadata">

**Author:** ![andy1li](https://yyz1.discourse-cdn.com/flex003/user_avatar/forum.codecrafters.io/andy1li/32/10_2.png) [@andy1li](https://forum.codecrafters.io/u/andy1li)\
**Post date:** [April 20, 2025, 9:00am UTC](https://forum.codecrafters.io/t/c-qp2-how-to-modify-prompt-line/5111/11 "2025-04-20T09:00:49Z")

</div>

Closing this thread due to inactivity. If you still need assistance, feel free to reopen or start a new discussion!

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex003/uploads/codecrafters/original/3X/7/0/700657133935c15703e22c7c8870394f6e6dc27d.svg) [@system](https://forum.codecrafters.io/u/system)\
**Post date:** [April 25, 2025, 9:01am UTC](https://forum.codecrafters.io/t/c-qp2-how-to-modify-prompt-line/5111/12 "2025-04-25T09:01:25Z")

</div>

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.
