4 #include "pbc_memory.h"
6 char *pbc_getline(const char *prompt
) {
8 if (prompt
) fputs(prompt
, stdout
);
9 if (!fgets(s
, 1024, stdin
)) return NULL
;
10 if (feof(stdin
)) return NULL
;
11 /* use strdup rather than pbc_strdup. because
12 * 1. readline version of this function uses malloc.
13 * 2. pbc_malloc called by pbc_strdup may differ from malloc.
14 * here we keep consistency.