From 65899c99e600529c58f922b1a947dd28ce4e6788 Mon Sep 17 00:00:00 2001
From: Gregory Nutt <gnutt@nuttx.org>
Date: Tue, 14 Jun 2016 14:18:07 -0600
Subject: [PATCH] apps/nshlib:  Change some *err() message to *info() messages
 if what was a *dbg() message does not indicate and error condition.

---
 nshlib/nsh_console.c                |  3 ++-
 nshlib/nsh_netcmds.c                | 29 ++++++++++++++++-------------
 nshlib/nsh_netinit.c                |  4 ++--
 nshlib/nsh_romfsetc.c               | 11 +++++------
 nshlib/nsh_telnetd.c                |  2 +-
 system/i2c/i2c_main.c               |  2 +-
 system/ubloxmodem/ubloxmodem_main.c | 14 +++++++++-----
 7 files changed, 36 insertions(+), 29 deletions(-)

diff --git a/nshlib/nsh_console.c b/nshlib/nsh_console.c
index 04e1eec11..7544d226a 100644
--- a/nshlib/nsh_console.c
+++ b/nshlib/nsh_console.c
@@ -183,7 +183,8 @@ static ssize_t nsh_consolewrite(FAR struct nsh_vtbl_s *vtbl,
   ret = fwrite(buffer, 1, nbytes, pstate->cn_outstream);
   if (ret < 0)
     {
-      err("[%d] Failed to send buffer: %d\n", pstate->cn_outfd, errno);
+      err("ERROR: [%d] Failed to send buffer: %d\n",
+          pstate->cn_outfd, errno);
     }
   return ret;
 #else
diff --git a/nshlib/nsh_netcmds.c b/nshlib/nsh_netcmds.c
index 3ee906ab4..8f7dee3ad 100644
--- a/nshlib/nsh_netcmds.c
+++ b/nshlib/nsh_netcmds.c
@@ -475,7 +475,7 @@ static int nsh_gethostip(FAR char *hostname, FAR union ip_addr_u *ipaddr,
   he = gethostbyname(hostname);
   if (he == NULL)
     {
-      nerr("gethostbyname failed: %d\n", h_errno);
+      nerr("ERROR: gethostbyname failed: %d\n", h_errno);
       return -ENOENT;
     }
 
@@ -483,7 +483,8 @@ static int nsh_gethostip(FAR char *hostname, FAR union ip_addr_u *ipaddr,
 
   else if (he->h_addrtype != addrtype)
     {
-      nerr("gethostbyname returned an address of type: %d\n", he->h_addrtype);
+      nerr("ERROR: gethostbyname returned an address of type: %d\n",
+           he->h_addrtype);
       return -ENOEXEC;
     }
   else if (addrtype == AF_INET)
@@ -499,7 +500,8 @@ static int nsh_gethostip(FAR char *hostname, FAR union ip_addr_u *ipaddr,
 
   else if (he->h_addrtype != AF_INET)
     {
-      nerr("gethostbyname returned an address of type: %d\n", he->h_addrtype);
+      nerr("ERROR: gethostbyname returned an address of type: %d\n",
+           he->h_addrtype);
       return -ENOEXEC;
     }
   else
@@ -511,7 +513,8 @@ static int nsh_gethostip(FAR char *hostname, FAR union ip_addr_u *ipaddr,
 
   else if (he->h_addrtype != AF_INET6)
     {
-      nerr("gethostbyname returned an address of type: %d\n", he->h_addrtype);
+      nerr("ERROR: gethostbyname returned an address of type: %d\n",
+           he->h_addrtype);
       return -ENOEXEC;
     }
   else
@@ -886,7 +889,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
 
   if (hw)
     {
-      nerr("HW MAC: %s\n", hw);
+      ninfo("HW MAC: %s\n", hw);
       netlib_setmacaddr(intf, mac);
     }
 #endif
@@ -915,7 +918,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
         {
           /* Set DHCP addr */
 
-          nerr("DHCPC Mode\n");
+          ninfo("DHCPC Mode\n");
           gip = addr.s_addr = 0;
         }
       else
@@ -923,7 +926,7 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
         {
           /* Set host IP address */
 
-          nerr("Host IP: %s\n", hostip);
+          ninfo("Host IP: %s\n", hostip);
           gip = addr.s_addr = inet_addr(hostip);
         }
 
@@ -950,14 +953,14 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
 
       if (gwip)
         {
-          nerr("Gateway: %s\n", gwip);
+          ninfo("Gateway: %s\n", gwip);
           gip = addr.s_addr = inet_addr(gwip);
         }
       else
         {
           if (gip)
             {
-              nerr("Gateway: default\n");
+              ninfo("Gateway: default\n");
               gip  = NTOHL(gip);
               gip &= ~0x000000ff;
               gip |= 0x00000001;
@@ -990,12 +993,12 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
     {
       if (mask)
         {
-          nerr("Netmask: %s\n",mask);
+          ninfo("Netmask: %s\n",mask);
           addr.s_addr = inet_addr(mask);
         }
       else
         {
-          nerr("Netmask: Default\n");
+          ninfo("Netmask: Default\n");
           addr.s_addr = inet_addr("255.255.255.0");
         }
 
@@ -1020,12 +1023,12 @@ int cmd_ifconfig(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
     {
       if (dns)
         {
-          nerr("DNS: %s\n", dns);
+          ninfo("DNS: %s\n", dns);
           addr.s_addr = inet_addr(dns);
         }
       else
         {
-          nerr("DNS: Default\n");
+          ninfo("DNS: Default\n");
           addr.s_addr = gip;
         }
 
diff --git a/nshlib/nsh_netinit.c b/nshlib/nsh_netinit.c
index fcd1f5f16..0adec1467 100644
--- a/nshlib/nsh_netinit.c
+++ b/nshlib/nsh_netinit.c
@@ -366,7 +366,7 @@ static void nsh_netinit_signal(int signo, FAR siginfo_t *siginfo,
   /* What is the count on the semaphore?  Don't over-post */
 
   ret = sem_getvalue(&g_notify_sem, &semcount);
-  nllerr("Entry: semcount=%d\n", semcount);
+  nllinfo("Entry: semcount=%d\n", semcount);
 
   if (ret == OK && semcount <= 0)
     {
@@ -600,7 +600,7 @@ errout_with_sigaction:
 errout_with_socket:
   close(sd);
 errout:
-  nerr("Aborting\n");
+  nerr("ERROR: Aborting\n");
   return ret;
 }
 #endif
diff --git a/nshlib/nsh_romfsetc.c b/nshlib/nsh_romfsetc.c
index 314a412cc..99dc3d635 100644
--- a/nshlib/nsh_romfsetc.c
+++ b/nshlib/nsh_romfsetc.c
@@ -103,24 +103,23 @@ int nsh_romfsetc(void)
                          NSECTORS(romfs_img_len), CONFIG_NSH_ROMFSSECTSIZE);
   if (ret < 0)
     {
-      err("nsh: romdisk_register failed: %d\n", -ret);
+      ferr("ERROR: romdisk_register failed: %d\n", -ret);
       return ERROR;
     }
 
   /* Mount the file system */
 
-  info("Mounting ROMFS filesystem at target=%s with source=%s\n",
-       CONFIG_NSH_ROMFSMOUNTPT, MOUNT_DEVNAME);
+  finfo("Mounting ROMFS filesystem at target=%s with source=%s\n",
+        CONFIG_NSH_ROMFSMOUNTPT, MOUNT_DEVNAME);
 
   ret = mount(MOUNT_DEVNAME, CONFIG_NSH_ROMFSMOUNTPT, "romfs", MS_RDONLY, NULL);
   if (ret < 0)
     {
-      err("nsh: mount(%s,%s,romfs) failed: %d\n",
-          MOUNT_DEVNAME, CONFIG_NSH_ROMFSMOUNTPT, errno);
+      ferr("ERROR: mount(%s,%s,romfs) failed: %d\n",
+           MOUNT_DEVNAME, CONFIG_NSH_ROMFSMOUNTPT, errno);
       return ERROR;
     }
   return OK;
 }
 
 #endif /* CONFIG_NSH_ROMFSETC */
-
diff --git a/nshlib/nsh_telnetd.c b/nshlib/nsh_telnetd.c
index 8ea7ff083..f4e1da0f7 100644
--- a/nshlib/nsh_telnetd.c
+++ b/nshlib/nsh_telnetd.c
@@ -205,7 +205,7 @@ int nsh_telnetstart(void)
   ret = telnetd_start(&config);
   if (ret < 0)
     {
-      err("Failed to tart the Telnet daemon: %d\n", ret);
+      err("ERROR: Failed to tart the Telnet daemon: %d\n", ret);
     }
 
   return ret;
diff --git a/system/i2c/i2c_main.c b/system/i2c/i2c_main.c
index 675aa57fb..286739c3a 100644
--- a/system/i2c/i2c_main.c
+++ b/system/i2c/i2c_main.c
@@ -426,7 +426,7 @@ ssize_t i2ctool_write(FAR struct i2ctool_s *i2ctool, FAR const void *buffer, siz
   ret = fwrite(buffer, 1, nbytes, OUTSTREAM(i2ctool));
   if (ret < 0)
     {
-      err("[%d] Failed to send buffer: %d\n", OUTFD(i2ctool), errno);
+      err("ERROR: [%d] Failed to send buffer: %d\n", OUTFD(i2ctool), errno);
     }
 
   return ret;
diff --git a/system/ubloxmodem/ubloxmodem_main.c b/system/ubloxmodem/ubloxmodem_main.c
index 273dce39f..2a8a74dbd 100644
--- a/system/ubloxmodem/ubloxmodem_main.c
+++ b/system/ubloxmodem/ubloxmodem_main.c
@@ -59,14 +59,18 @@
  ****************************************************************************/
 
 #ifdef CONFIG_MODEM_U_BLOX_DEBUG
-#  define m_err     err
-#  define m_info    info
-#  define m_vllerr  llerr
-#  define m_vllinfo llinfo
+#  define m_err    err
+#  define m_warn   llwarn
+#  define m_info   info
+#  define m_llerr  llerr
+#  define m_llwarn llwarn
+#  define m_llinfo llinfo
 #else
 #  define m_err(x...)
+#  define m_warn(x...)
 #  define m_info(x...)
 #  define m_llerr(x...)
+#  define m_llwarn(x...)
 #  define m_llinfo(x...)
 #endif
 
@@ -364,7 +368,7 @@ static int ubloxmodem_at(FAR struct ubloxmodem_cxt* cxt)
 
   ret = chat_single(fd, atcmd, resp);
 
-  m_err("test result: %d\n", ret);
+  m_info("test result: %d\n", ret);
 
   close(fd);
   return ret;