Select update variant. Returns 0=standard, 1=ui, -1=error. */
| 11354 | |
| 11355 | /* Select update variant. Returns 0=standard, 1=ui, -1=error. */ |
| 11356 | static int select_update_variant(int variant_flag) { |
| 11357 | if (variant_flag == VARIANT_A) { |
| 11358 | return 0; |
| 11359 | } |
| 11360 | if (variant_flag == VARIANT_B) { |
| 11361 | return CLI_TRUE; |
| 11362 | } |
| 11363 | #ifndef _WIN32 |
| 11364 | if (!isatty(fileno(stdin))) { |
| 11365 | (void)fprintf(stderr, "error: variant selection requires a terminal. " |
| 11366 | "Use --standard or --ui flag.\n"); |
| 11367 | return CLI_ERR; |
| 11368 | } |
| 11369 | #endif |
| 11370 | printf("Which binary variant do you want?\n"); |
| 11371 | printf(" 1) standard — MCP server only\n"); |
| 11372 | printf(" 2) ui — MCP server + embedded graph visualization\n"); |
| 11373 | printf("Choose (1/2): "); |
| 11374 | (void)fflush(stdout); |
| 11375 | char choice[CLI_BUF_16]; |
| 11376 | if (!fgets(choice, sizeof(choice), stdin)) { |
| 11377 | (void)fprintf(stderr, "error: failed to read input\n"); |
| 11378 | return CLI_ERR; |
| 11379 | } |
| 11380 | return (choice[0] == '2') ? CLI_TRUE : 0; |
| 11381 | } |
| 11382 | |
| 11383 | /* Case-insensitive prefix match (portable — no strncasecmp dependency). */ |
| 11384 | static bool prefix_icase(const char *s, const char *prefix) { |