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

Function prompt_yn

src/cli/cli.c:6816–6843  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6814}
6815
6816static bool prompt_yn(const char *question) {
6817 if (g_auto_answer == AUTO_YES) {
6818 printf("%s (y/n): y (auto)\n", question);
6819 return true;
6820 }
6821 if (g_auto_answer == AUTO_NO) {
6822 printf("%s (y/n): n (auto)\n", question);
6823 return false;
6824 }
6825
6826 /* Non-interactive stdin: default to "no" to avoid hanging */
6827#ifndef _WIN32
6828 if (!isatty(fileno(stdin))) {
6829 (void)fprintf(stderr,
6830 "error: interactive prompt requires a terminal. Use -y or -n flags.\n");
6831 return false;
6832 }
6833#endif
6834
6835 printf("%s (y/n): ", question);
6836 (void)fflush(stdout);
6837
6838 char buf[CLI_BUF_16];
6839 if (!fgets(buf, sizeof(buf), stdin)) {
6840 return false;
6841 }
6842 return (buf[0] == 'y' || buf[0] == 'Y') ? true : false;
6843}
6844
6845/* ── SHA-256 checksum verification ─────────────────────────────── */
6846

Callers 4

cbm_cmd_installFunction · 0.85
cbm_cmd_uninstallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected