yanglint REFACTOR reflect changes in libyang 2.0 in yanglint
diff --git a/tools/lint/configuration.c b/tools/lint/configuration.c
index 5bda4ed..6e684a8 100644
--- a/tools/lint/configuration.c
+++ b/tools/lint/configuration.c
@@ -24,6 +24,8 @@
 
 #include "linenoise/linenoise.h"
 
+#include "common.h"
+
 /* Yanglint home (appended to ~/) */
 #define YL_DIR ".yanglint"
 
@@ -35,14 +37,14 @@
     char *user_home, *yl_dir;
 
     if (!(pw = getpwuid(getuid()))) {
-        fprintf(stderr, "Determining home directory failed (%s).\n", strerror(errno));
+        YLMSG_E("Determining home directory failed (%s).\n", strerror(errno));
         return NULL;
     }
     user_home = pw->pw_dir;
 
     yl_dir = malloc(strlen(user_home) + 1 + strlen(YL_DIR) + 1);
     if (!yl_dir) {
-        fprintf(stderr, "Memory allocation failed (%s).\n", strerror(errno));
+        YLMSG_E("Memory allocation failed (%s).\n", strerror(errno));
         return NULL;
     }
     sprintf(yl_dir, "%s/%s", user_home, YL_DIR);
@@ -51,14 +53,14 @@
     if (ret == -1) {
         if (errno == ENOENT) {
             /* directory does not exist */
-            fprintf(stdout, "Configuration directory \"%s\" does not exist, creating it.\n", yl_dir);
+            YLMSG_E("Configuration directory \"%s\" does not exist, creating it.\n", yl_dir);
             if (mkdir(yl_dir, 00700)) {
-                fprintf(stderr, "Configuration directory \"%s\" cannot be created (%s).\n", yl_dir, strerror(errno));
+                YLMSG_E("Configuration directory \"%s\" cannot be created (%s).\n", yl_dir, strerror(errno));
                 free(yl_dir);
                 return NULL;
             }
         } else {
-            fprintf(stderr, "Configuration directory \"%s\" exists but cannot be accessed (%s).\n", yl_dir, strerror(errno));
+            YLMSG_E("Configuration directory \"%s\" exists but cannot be accessed (%s).\n", yl_dir, strerror(errno));
             free(yl_dir);
             return NULL;
         }
@@ -71,22 +73,23 @@
 load_config(void)
 {
     char *yl_dir, *history_file;
+
     if ((yl_dir = get_yanglint_dir()) == NULL) {
         return;
     }
 
     history_file = malloc(strlen(yl_dir) + 9);
     if (!history_file) {
-        fprintf(stderr, "Memory allocation failed (%s).\n", strerror(errno));
+        YLMSG_E("Memory allocation failed (%s).\n", strerror(errno));
         free(yl_dir);
         return;
     }
 
     sprintf(history_file, "%s/history", yl_dir);
     if (access(history_file, F_OK) && (errno == ENOENT)) {
-        fprintf(stdout, "No saved history.\n");
+        YLMSG_E("No saved history.\n");
     } else if (linenoiseHistoryLoad(history_file)) {
-        fprintf(stderr, "Failed to load history.\n");
+        YLMSG_E("Failed to load history.\n");
     }
 
     free(history_file);
@@ -104,14 +107,14 @@
 
     history_file = malloc(strlen(yl_dir) + 9);
     if (!history_file) {
-        fprintf(stderr, "Memory allocation failed (%s).\n", strerror(errno));
+        YLMSG_E("Memory allocation failed (%s).\n", strerror(errno));
         free(yl_dir);
         return;
     }
 
     sprintf(history_file, "%s/history", yl_dir);
     if (linenoiseHistorySave(history_file)) {
-        fprintf(stderr, "Failed to save history.\n");
+        YLMSG_E("Failed to save history.\n");
     }
 
     free(history_file);