X-Git-Url: https://diplodocus.org/git/nmh/blobdiff_plain/c4db59aa4b58bca9cd146ae30f507c16218a67d7..cf57870921b26703aad420c6741c524b33736ff1:/uip/mhlogin.c diff --git a/uip/mhlogin.c b/uip/mhlogin.c index 46a5a161..4a42aea2 100644 --- a/uip/mhlogin.c +++ b/uip/mhlogin.c @@ -11,6 +11,7 @@ #include #include +#include #include #define MHLOGIN_SWITCHES \ @@ -35,13 +36,12 @@ DEFINE_SWITCH_ARRAY(MHLOGIN, switches); static char * geta (void) { - char *cp; static char line[BUFSIZ]; if (fgets(line, sizeof(line), stdin) == NULL) done (1); - if ((cp = strchr(line, '\n'))) - *cp = 0; + trim_suffix_c(line, '\n'); + return line; } @@ -71,7 +71,7 @@ do_login(const char *svc, const char *user, const char *browser, int snoop) mh_oauth_log_to(stderr, ctx); } - fn = getcpy(mh_oauth_cred_fn(svc)); + fn = mh_xstrdup(mh_oauth_cred_fn(svc)); if ((url = mh_oauth_get_authorize_url(ctx)) == NULL) { adios(NULL, mh_oauth_get_err_string(ctx));