mirror of
https://codeberg.org/scip/pcp.git
synced 2025-12-17 20:00:58 +01:00
catch missing input
This commit is contained in:
@@ -25,7 +25,7 @@
|
|||||||
|
|
||||||
char *pcp_getstdin(const char *prompt) {
|
char *pcp_getstdin(const char *prompt) {
|
||||||
char line[255];
|
char line[255];
|
||||||
char *out;
|
char *out = NULL;
|
||||||
|
|
||||||
fprintf(stderr, "%s: ", prompt);
|
fprintf(stderr, "%s: ", prompt);
|
||||||
|
|
||||||
@@ -67,9 +67,11 @@ void pcp_keygen(char *passwd) {
|
|||||||
pcp_key_t *key = NULL;
|
pcp_key_t *key = NULL;
|
||||||
|
|
||||||
char *owner = pcp_getstdin("Enter the name of the key owner");
|
char *owner = pcp_getstdin("Enter the name of the key owner");
|
||||||
|
if(owner != NULL)
|
||||||
memcpy(k->owner, owner, strlen(owner) + 1);
|
memcpy(k->owner, owner, strlen(owner) + 1);
|
||||||
|
|
||||||
char *mail = pcp_getstdin("Enter the email address of the key owner");
|
char *mail = pcp_getstdin("Enter the email address of the key owner");
|
||||||
|
if(mail != NULL)
|
||||||
memcpy(k->mail, _lc(mail), strlen(mail) + 1);
|
memcpy(k->mail, _lc(mail), strlen(mail) + 1);
|
||||||
|
|
||||||
if(debug)
|
if(debug)
|
||||||
|
|||||||
Reference in New Issue
Block a user