MCPcopy Create free account
hub / github.com/DeusData/codebase-memory-mcp / prompt_yn

Function prompt_yn

src/cli/cli.c:6667–6694  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6665}
6666
6667static bool prompt_yn(const char *question) {
6668 if (g_auto_answer == AUTO_YES) {
6669 printf("%s (y/n): y (auto)\n", question);
6670 return true;
6671 }
6672 if (g_auto_answer == AUTO_NO) {
6673 printf("%s (y/n): n (auto)\n", question);
6674 return false;
6675 }
6676
6677 /* Non-interactive stdin: default to "no" to avoid hanging */
6678#ifndef _WIN32
6679 if (!isatty(fileno(stdin))) {
6680 (void)fprintf(stderr,
6681 "error: interactive prompt requires a terminal. Use -y or -n flags.\n");
6682 return false;
6683 }
6684#endif
6685
6686 printf("%s (y/n): ", question);
6687 (void)fflush(stdout);
6688
6689 char buf[CLI_BUF_16];
6690 if (!fgets(buf, sizeof(buf), stdin)) {
6691 return false;
6692 }
6693 return (buf[0] == 'y' || buf[0] == 'Y') ? true : false;
6694}
6695
6696/* ── SHA-256 checksum verification ─────────────────────────────── */
6697

Callers 4

cbm_cmd_installFunction · 0.85
cbm_cmd_uninstallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected