secstore from ehg
This commit is contained in:
parent
73bfbacb24
commit
a812ae4b43
10 changed files with 1633 additions and 0 deletions
38
src/cmd/secstore/util.c
Normal file
38
src/cmd/secstore/util.c
Normal file
|
|
@ -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;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue