diff options
author | rsc <devnull@localhost> | 2004-12-27 19:36:51 +0000 |
---|---|---|
committer | rsc <devnull@localhost> | 2004-12-27 19:36:51 +0000 |
commit | a812ae4b4392cade3321da1a146a231ff88db3b7 (patch) | |
tree | 5ddcda3efed1d7cf7791faa5f93dc7b33a56a944 /src/cmd/secstore/util.c | |
parent | 73bfbacb2409b10f45fd080891a95de29cafe4a0 (diff) | |
download | plan9port-a812ae4b4392cade3321da1a146a231ff88db3b7.tar.gz plan9port-a812ae4b4392cade3321da1a146a231ff88db3b7.tar.bz2 plan9port-a812ae4b4392cade3321da1a146a231ff88db3b7.zip |
secstore from ehg
Diffstat (limited to 'src/cmd/secstore/util.c')
-rw-r--r-- | src/cmd/secstore/util.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/src/cmd/secstore/util.c b/src/cmd/secstore/util.c new file mode 100644 index 00000000..d791bc72 --- /dev/null +++ b/src/cmd/secstore/util.c @@ -0,0 +1,38 @@ +#include <u.h> +#include <libc.h> + +void * +emalloc(ulong n) +{ + void *p = malloc(n); + if(p == nil) + sysfatal("emalloc"); + memset(p, 0, n); + return p; +} + +void * +erealloc(void *p, ulong n) +{ + if ((p = realloc(p, n)) == nil) + sysfatal("erealloc"); + return p; +} + +char * +estrdup(char *s) +{ + if ((s = strdup(s)) == nil) + sysfatal("estrdup"); + return s; +} + +char * +getpassm(char *prompt) +{ + char *p = getpass(prompt); + + if(p == nil || (p = strdup(p)) == nil) + sysfatal("getpassm"); + return p; +} |