]> diplodocus.org Git - nmh/blobdiff - uip/mhlogin.c
Alter mh-chart(7)'s NAME to be lowercase.
[nmh] / uip / mhlogin.c
index 46a5a161d8e0b91e5d144f5ede136a5b63d025a1..4a42aea275ab07832326f0190e3c00024d8af883 100644 (file)
@@ -11,6 +11,7 @@
 #include <string.h>
 
 #include <h/mh.h>
+#include <h/utils.h>
 #include <h/oauth.h>
 
 #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));