MCPcopy Create free account
hub / github.com/ElementsProject/lightning / read_line

Function read_line

common/hsm_secret.c:407–426  ·  view source on GitHub ↗

Read line from stdin (uses tal allocation) */

Source from the content-addressed store, hash-verified

405
406/* Read line from stdin (uses tal allocation) */
407static const char *read_line(const tal_t *ctx)
408{
409 char *line = NULL;
410 size_t size = 0;
411
412 if (getline(&line, &size, stdin) < 0) {
413 free(line);
414 return NULL;
415 }
416
417 /* Strip newline */
418 size_t len = strlen(line);
419 if (strends(line, "\n"))
420 len--;
421
422 /* Convert to tal string */
423 char *result = tal_strndup(ctx, line, len);
424 free(line);
425 return result;
426}
427
428const char *read_stdin_pass(const tal_t *ctx, enum hsm_secret_error *err)
429{

Callers 2

read_stdin_passFunction · 0.85
read_stdin_mnemonicFunction · 0.85

Calls 1

strendsFunction · 0.85

Tested by

no test coverage detected