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

Function prompt_yn

src/cli/cli.c:6980–7007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6978}
6979
6980static bool prompt_yn(const char *question) {
6981 if (g_auto_answer == AUTO_YES) {
6982 printf("%s (y/n): y (auto)\n", question);
6983 return true;
6984 }
6985 if (g_auto_answer == AUTO_NO) {
6986 printf("%s (y/n): n (auto)\n", question);
6987 return false;
6988 }
6989
6990 /* Non-interactive stdin: default to "no" to avoid hanging */
6991#ifndef _WIN32
6992 if (!isatty(fileno(stdin))) {
6993 (void)fprintf(stderr,
6994 "error: interactive prompt requires a terminal. Use -y or -n flags.\n");
6995 return false;
6996 }
6997#endif
6998
6999 printf("%s (y/n): ", question);
7000 (void)fflush(stdout);
7001
7002 char buf[CLI_BUF_16];
7003 if (!fgets(buf, sizeof(buf), stdin)) {
7004 return false;
7005 }
7006 return (buf[0] == 'y' || buf[0] == 'Y') ? true : false;
7007}
7008
7009/* ── SHA-256 checksum verification ─────────────────────────────── */
7010

Callers 4

cbm_cmd_installFunction · 0.85
cbm_cmd_uninstallFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected