]> granicus.if.org Git - graphviz/commitdiff
Use agerr for warning and error messages.
authorerg <devnull@localhost>
Thu, 5 May 2005 21:13:31 +0000 (21:13 +0000)
committererg <devnull@localhost>
Thu, 5 May 2005 21:13:31 +0000 (21:13 +0000)
lib/gvc/gvconfig.c
lib/gvc/gvplugin.c

index 436b2b5ac4879d90aeb035daaa49eb3b8967d78d..8856d6a1c6df92198e54a37bf88d007a84f3c77f 100644 (file)
@@ -147,7 +147,7 @@ static int gvconfig_plugin_install_from_config(GVC_t * gvc, char *s)
        path = token(&nest, &s);
        rc = strncmp(path, libdir, strlen(libdir));
         if(rc) {
-           fprintf(stderr, "config contains invalid path\n");
+           agerr (AGERR, "config contains invalid path\n");
            return 0;
        }
        if (nest == 0)
@@ -158,7 +158,7 @@ static int gvconfig_plugin_install_from_config(GVC_t * gvc, char *s)
            api = token(&nest, &s);
            gv_api = gvplugin_api(api);
            if (gv_api == -1) {
-               fprintf(stderr, "invalid api in config: %s %s\n", path, api);
+               agerr(AGERR, "invalid api in config: %s %s\n", path, api);
                return 0;
            }
            do {
@@ -171,7 +171,7 @@ static int gvconfig_plugin_install_from_config(GVC_t * gvc, char *s)
                rc = gvplugin_install (gvc, gv_api,
                                type, quality, packagename, path, NULL);
                if (!rc) {
-                   fprintf(stderr, "config error: %s %s %s\n", path, api, type);
+                   agerr(AGERR, "config error: %s %s %s\n", path, api, type);
                    return 0;
                }
            } while (nest == 2);
@@ -229,7 +229,7 @@ static void config_rescan(GVC_t *gvc, char *config_path)
     if (config_path) {
        f = fopen(config_path,"w");
        if (!f) {
-           fprintf(stderr,"failed to open %s for write.\n", config_path);
+           agerr(AGERR,"failed to open %s for write.\n", config_path);
        }
     }
 
@@ -336,18 +336,18 @@ void gvconfig(GVC_t * gvc)
 
        rc = 0;
        if (config_st.st_size > MAX_SZ_CONFIG) {
-           fprintf(stderr,"%s is bigger than I can handle.\n", config_path);
+           agerr(AGERR,"%s is bigger than I can handle.\n", config_path);
        }
        else {
            f = fopen(config_path,"r");
            if (!f) {
-               fprintf(stderr,"failed to open %s for read.\n", config_path);
+               agerr (AGERR,"failed to open %s for read.\n", config_path);
            }
            else {
                config_text = malloc(config_st.st_size + 1);
                sz = fread(config_text, 1, config_st.st_size, f);
                if (sz == 0) {
-                   fprintf(stderr,"%s is zero sized, or other read error.\n", config_path);
+                   agerr(AGERR,"%s is zero sized, or other read error.\n", config_path);
                    free(config_text);
                }
                else {
@@ -360,7 +360,7 @@ void gvconfig(GVC_t * gvc)
                fclose(f);
        }
        if (!rc) {
-           fprintf(stderr,"rescanning for plugins\n");
+           agerr(AGERR,"rescanning for plugins\n");
            config_rescan(gvc, config_path);
        }
     }
index 1f95d6f77f4184c2106a04e71ff1ee23abd207d0..9b5bbb85c3e4eec4a0b4b0a71a36f6f5a125edcb 100644 (file)
@@ -29,6 +29,7 @@
 #include        "types.h"
 #include        "macros.h"
 #include        "gvc.h"
+#include        "graph.h"
 
 /*
  * Define an apis array of name strings using an enumerated api_t as index.
@@ -106,19 +107,19 @@ gvplugin_library_t *gvplugin_library_load(char *path)
     char *suffix = "_LTX_library";
 
     if (lt_dlinit()) {
-        fprintf(stderr,"failed to init libltdl\n");
+        agerr(AGERR, "failed to init libltdl\n");
         return NULL;
     }
     hndl = lt_dlopen (path);
     if (!hndl) {
-        fprintf(stderr,"failed to dlopen %s\n", path);
+        agerr(AGERR, "failed to dlopen %s\n", path);
         return NULL;
     }
 
     s = strrchr(path, '/');
     len = strlen(s); 
     if (len < strlen("libgvplugin_x")) {
-       fprintf(stderr,"invalid plugin path \"%s\"\n", path);
+       agerr (AGERR,"invalid plugin path \"%s\"\n", path);
        return NULL;
     }
     sym = malloc(len + strlen(suffix) + 1);
@@ -128,14 +129,14 @@ gvplugin_library_t *gvplugin_library_load(char *path)
 
     ptr = lt_dlsym (hndl, sym);
     if (!ptr) {
-        fprintf(stderr,"failed to resolve %s in %s\n", sym, path);
+        agerr (AGERR,"failed to resolve %s in %s\n", sym, path);
        free(sym);
         return NULL;
     }
     free(sym);
     return (gvplugin_library_t *)(ptr);
 #else
-    fprintf(stderr,"dynamic loading not available\n");
+    agerr (AGERR,"dynamic loading not available\n");
     return NULL;
 #endif
 }