1
0
Fork 0
forked from fun/fun

Added input_hidden() to ask for passwords in the CLI without echoing the chars. (0.37.37)

This commit is contained in:
Johannes Findeisen 2026-01-02 20:12:01 +01:00
commit b32f7e839b
7 changed files with 172 additions and 4 deletions

View file

@ -709,6 +709,20 @@ static int emit_primary(Bytecode *bc, const char *src, size_t len, size_t *pos)
free(name);
return 1;
}
if (strcmp(name, "input_hidden") == 0) {
(*pos)++; /* '(' */
int hasPrompt = 0;
skip_spaces(src, len, pos);
if (*pos < len && src[*pos] != ')') {
if (!emit_expression(bc, src, len, pos)) { parser_fail(*pos, "input_hidden expects 0 or 1 argument"); free(name); return 0; }
hasPrompt = 1;
}
if (!consume_char(src, len, pos, ')')) { parser_fail(*pos, "Expected ')' after input_hidden arg(s)"); free(name); return 0; }
/* operand bit0 = hasPrompt, bit1 = hidden */
bytecode_add_instruction(bc, OP_INPUT_LINE, (hasPrompt ? 1 : 0) | 2);
free(name);
return 1;
}
if (strcmp(name, "proc_run") == 0) {
(*pos)++; /* '(' */
if (!emit_expression(bc, src, len, pos)) { parser_fail(*pos, "proc_run expects 1 argument (command string)"); free(name); return 0; }