diff options
author | 2015-09-04 09:25:34 +0200 | |
---|---|---|
committer | 2015-09-04 09:25:34 +0200 | |
commit | 3baeb11a8fbcfcdbc31976d421f17b85503b3ecd (patch) | |
tree | 04891d88c1127148f1b390b5a24414e85b270aee /moon-abe/pbc-0.5.14/pbc/pbc_getline.c | |
parent | 67c5b73910f5fc437429c356978081b252a59480 (diff) |
init attribute-based encryption
Change-Id: Iba1a3d722110abf747a0fba366f3ebc911d25b25
Diffstat (limited to 'moon-abe/pbc-0.5.14/pbc/pbc_getline.c')
-rw-r--r-- | moon-abe/pbc-0.5.14/pbc/pbc_getline.c | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/moon-abe/pbc-0.5.14/pbc/pbc_getline.c b/moon-abe/pbc-0.5.14/pbc/pbc_getline.c new file mode 100644 index 00000000..dc44cc40 --- /dev/null +++ b/moon-abe/pbc-0.5.14/pbc/pbc_getline.c @@ -0,0 +1,17 @@ +#include <stdio.h> +#include <string.h> + +#include "pbc_memory.h" + +char *pbc_getline(const char *prompt) { + char s[1024]; + if (prompt) fputs(prompt, stdout); + if (!fgets(s, 1024, stdin)) return NULL; + if (feof(stdin)) return NULL; + /* use strdup rather than pbc_strdup. because + * 1. readline version of this function uses malloc. + * 2. pbc_malloc called by pbc_strdup may differ from malloc. + * here we keep consistency. + */ + return strdup(s); +} |