]> diplodocus.org Git - nmh/blobdiff - uip/mhlogin.c
Create and use header file for uip/mhfree.c's exports.
[nmh] / uip / mhlogin.c
index d6dd0afdc1d20d954a644625c428b745e1c8ea05..32183863c1f403a080e0f4c3ca59686a5a56b419 100644 (file)
@@ -1,5 +1,4 @@
-/*
- * mhlogin.c -- login to external (OAuth) services
+/* mhlogin.c -- login to external (OAuth) services
  *
  * This code is Copyright (c) 2014, by the authors of nmh.  See the
  * COPYRIGHT file in the root directory of the nmh distribution for
@@ -36,13 +35,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;
 }
 
@@ -110,7 +108,7 @@ do_login(const char *svc, const char *user, const char *browser, int snoop)
       code = geta();
     }
     if (cred == NULL) {
-      advise(NULL, "error exchanging code for OAuth2 token");
+      inform("error exchanging code for OAuth2 token");
       adios(NULL, mh_oauth_get_err_string(ctx));
     }