]> granicus.if.org Git - graphviz/commitdiff
replace all instances of exit() with graphviz_exit()
authorMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Sun, 16 Jan 2022 15:46:41 +0000 (16:46 +0100)
committerMagnus Jacobsson <Magnus.Jacobsson@berotec.se>
Mon, 31 Jan 2022 07:26:19 +0000 (08:26 +0100)
Partial fix for https://gitlab.com/graphviz/graphviz/-/issues/2178.

62 files changed:
cmd/dot/dot.c
cmd/dotty/mswin32/dotty.c
cmd/edgepaint/edgepaintmain.c
cmd/gvmap/cluster.c
cmd/gvmap/gvmap.c
cmd/lefty/gfxview.c
cmd/lefty/lefty.c
cmd/lefty/ws/gtk/gview.c
cmd/lefty/ws/mswin32/gcommon.c
cmd/lefty/ws/x11/gview.c
cmd/lneato/mswin32/lneato.c
cmd/smyrna/gltemplate.c
cmd/smyrna/glutrender.c
cmd/smyrna/main.c
cmd/smyrna/viewport.c
cmd/tools/acyclic.c
cmd/tools/bcomps.c
cmd/tools/ccomps.c
cmd/tools/cvtgxl.c
cmd/tools/dijkstra.c
cmd/tools/gc.c
cmd/tools/gml2gv.c
cmd/tools/graphml2gv.c
cmd/tools/gv2gml.c
cmd/tools/gvcolor.c
cmd/tools/gvgen.c
cmd/tools/gvpack.c
cmd/tools/gxl2gv.c
cmd/tools/mm2gv.c
cmd/tools/nop.c
cmd/tools/sccmap.c
cmd/tools/tred.c
cmd/tools/unflatten.c
contrib/diffimg/diffimg.c
contrib/prune/prune.c
doc/libgraph/sccmap.c
lib/ast/error.c
lib/cgraph/sprint.c
lib/common/input.c
lib/common/memory.c
lib/common/xml.c
lib/dotgen/mincross.c
lib/expr/excc.c
lib/expr/exerror.c
lib/expr/exeval.c
lib/fdpgen/dbg.c
lib/gvc/gvconfig.c
lib/gvc/gvdevice.c
lib/gvpr/compile.c
lib/gvpr/gvpr.c
lib/label/nrtmain.c
lib/neatogen/legal.c
lib/ortho/ortho.c
lib/sfdpgen/post_process.c
lib/sparse/DotIO.c
lib/sparse/SparseMatrix.c
lib/sparse/general.h
plugin/glitz/gvdevice_glitz.c
plugin/xlib/gvdevice_xlib.c
rtest/cdiff.c
tclpkg/tclpathplan/find_ints.c
tclpkg/tclpathplan/intersect.c

index 030c23085988942dbb170c3c3b09ba700fe3f36c..6781f1cf5b4e57c9d1556104f9f21a46495ebad9 100644 (file)
@@ -15,6 +15,7 @@
 #include "config.h"
 
 #include <cgraph/cgraph.h>
+#include <cgraph/exit.h>
 #include <gvc/gvc.h>
 #include <gvc/gvio.h>
 
@@ -40,7 +41,7 @@ static void intr(int s)
        gvRenderJobs(Gvc, G);
 /* Note that we don't call gvFinalize() so that we don't start event-driven
  * devices like -Tgtk or -Txlib */
-    exit (gvFreeContext(Gvc));
+    graphviz_exit(gvFreeContext(Gvc));
 }
 
 #ifndef NO_FPERR
@@ -48,7 +49,7 @@ static void fperr(int s)
 {
     fprintf(stderr, "caught SIGFPE %d\n", s);
     /* signal (s, SIG_DFL); raise (s); */
-    exit(1);
+    graphviz_exit(1);
 }
 #endif
 #endif
index fec5799fa830af8ebe2ef6136321be609a06414e..0366885fb7efeeafaefe6a877f343655ed2bdb0d 100644 (file)
@@ -19,6 +19,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include <cgraph/exit.h>
+
 static char *shellpath;
 
 static char *buildpath (char *);
@@ -50,16 +52,16 @@ int APIENTRY WinMain (
     if (!shellpath || !(path = buildpath ("lefty"))) {
         if (!GetModuleFileName (hInstance, cmd, 256) ||
                 !(s = strrchr (cmd, '\\')))
-            exit (1);
+            graphviz_exit(1);
         *s = 0;
         shellpath = &cmd[0];
         if (!(path = buildpath ("lefty")))
-            exit (1);
+            graphviz_exit(1);
     }
     argv = CommandLineToArgvW(lpCmdLine, &argc);
     if (argc == 1 && strcmp(argv[0], "-?") == 0) {
         fprintf(stderr, "usage: dotty [-V] [-lm (sync|async)] [-el (0|1)] <filename>\n");
-        exit(0);
+        graphviz_exit(0);
     }
     if (lpCmdLine[0] == 0)
         snprintf(cmd, sizeof(cmd), "%s -e \"load('dotty.lefty');%sdotty.init();"
@@ -82,7 +84,7 @@ int APIENTRY WinMain (
         &si,              // Pointer to STARTUPINFO structure.
         &pi             // Pointer to PROCESS_INFORMATION structure.
     );
-    exit (0);
+    graphviz_exit(0);
 }
 
 #define PATHDEL '\\'
index 279052fe76d3224cf1c81f6729a09e0e6017cd1e..c6fa23065f9f52832643767488eba346c28488b3 100644 (file)
@@ -12,6 +12,7 @@
 
 #include <cgraph/cgraph.h>
 #include <cgraph/agxbuf.h>
+#include <cgraph/exit.h>
 #include <cgraph/unreachable.h>
 #include <ingraphs/ingraphs.h>
 #include <common/pointset.h>
@@ -50,7 +51,7 @@ static FILE *openFile(const char *name, const char* cmd)
        fp = fopen(name, "w");
        if (!fp) {
                fprintf(stderr, "%s: could not open file %s for writing\n", cmd, name);
-               exit(EXIT_FAILURE);
+               graphviz_exit(EXIT_FAILURE);
        }
        return fp;
 }
@@ -70,7 +71,7 @@ static void usage (char* cmd, int eval){
   fprintf(stderr, "       parallel but is on the opposite ends of the shared point (around 180 degree).\n");
   fprintf(stderr, " -v               : verbose\n");
   fprintf(stderr, " -o fname         :  write output to file fname (stdout)\n");
-  exit(eval);
+  graphviz_exit(eval);
 }
 
 /* checkG:
index dd1f519f99f38eec254c38ef3aec5da91fb64b1e..f9573d29a7e5e9c49df3a4f8dabd4bb86f75e607 100644 (file)
@@ -61,7 +61,7 @@ static void usage(char* cmd, int eval)
 {
     fprintf(stderr, "Usage: %s <options> graphfile\n", cmd);
     fputs (usestr, stderr);
-    exit(eval);
+    graphviz_exit(eval);
 }
 
 static FILE *openFile(const char *name, const char* cmd)
@@ -71,7 +71,7 @@ static FILE *openFile(const char *name, const char* cmd)
     fp = fopen(name, "w");
     if (!fp) {
        fprintf(stderr, "%s: could not open file %s for writing\n", cmd, name);
-       exit(-1);
+       graphviz_exit(-1);
     }
     return fp;
 }
index 1cf66ff6bf25e3adcf070aa42d5a2b2dda0379fc..f206ff0d2fa015e922027aa6bb7ff302382852e6 100644 (file)
@@ -125,7 +125,7 @@ static void usage(char* cmd, int eval)
 {
     fprintf(stderr, "Usage: %s <options> graphfile\n", cmd);
     fputs (usestr, stderr);
-    exit(eval);
+    graphviz_exit(eval);
 }
 
 static FILE *openFile(const char *name, const char* cmd)
@@ -135,7 +135,7 @@ static FILE *openFile(const char *name, const char* cmd)
     fp = fopen(name, "w");
     if (!fp) {
        fprintf(stderr, "%s: could not open file %s for writing\n", cmd, name);
-       exit(-1);
+       graphviz_exit(-1);
     }
     return (fp);
 }
index 932e70a895cb79c099583b89bd38c0eb322c30e3..eaef13046a41a2c55a2d805b5c73f6861d1802dc 100644 (file)
@@ -10,6 +10,7 @@
 
 /* Lefteris Koutsofios - AT&T Labs Research */
 
+#include <cgraph/exit.h>
 #include "common.h"
 #include "g.h"
 #include "mem.h"
@@ -234,7 +235,7 @@ void GFXviewcb (Gevent_t *evp) {
     fn = "closeview";
     if (!wo || !(fo = Tfinds (wo, fn)) || Tgettype (fo) != T_CODE)
         if (!(fo = Tfinds (root, fn)) || Tgettype (fo) != T_CODE)
-            exit (0);
+            graphviz_exit(0);
     fm = Mpushmark (fo);
     to = Ttable (2);
     Mpushmark (to);
index a1a6cc69e521f75e733d4ae7082d097f2a55bcd6..56d8d551e4faef86be48450449202c71dd86e713 100644 (file)
@@ -15,6 +15,7 @@
 #define LEFTYVERSION "10 Mar 2005"
 
 #include "builddate.h"
+#include <cgraph/exit.h>
 #include "common.h"
 #include "g.h"
 #include "code.h"
@@ -304,7 +305,7 @@ eop:
     term ();
 #endif
     printusage ();
-    exit (0);
+    graphviz_exit(0);
 }
 
 #endif
@@ -409,7 +410,7 @@ static void usage(int eval)
 {
     fprintf (stderr, "Usage: lefty [options] [file]\n");
     fputs (usestr, stderr);
-    exit (eval);
+    graphviz_exit(eval);
 }
 
 static void processstr (char *buf) {
@@ -475,7 +476,7 @@ static void processargs (int argc, char *argv[]) {
                 fclose(fp);
             if ((fp = fopen (argv[0], "r")) == NULL) {
                 fprintf (stderr, "cannot open input file: %s\n", argv[0]);
-                exit(2);
+                graphviz_exit(2);
             }
         }
         argv++, argc--;
index 514494ff01176a05ffaa851cba6c3165d716cf03..f0ea35ce4abbd0074400a7c6add19e4d9cf13fd1 100644 (file)
@@ -9,6 +9,7 @@
  *************************************************************************/
 
 
+#include <cgraph/exit.h>
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
@@ -182,12 +183,12 @@ void Gwmdelaction(GtkWidget * w, GdkEvent * evp, char **app,
 
     widget = findwidget((unsigned long) w, G_VIEWWIDGET);
     if (!widget)
-       exit(0);
+       graphviz_exit(0);
 
     gev.type = 0, gev.code = 0, gev.data = 0;
     gev.wi = widget - &Gwidgets[0];
     if (WVU->func)
        (*WVU->func) (&gev);
     else
-       exit(0);
+       graphviz_exit(0);
 }
index bfbde0845797cce9e7d97ce6c398c0a480db7b20..e63ccf0ddbafee50b80564763a3b587450103683 100644 (file)
@@ -11,6 +11,8 @@
 /* Lefteris Koutsofios - AT&T Labs Research */
 
 #include <stdbool.h>
+
+#include <cgraph/exit.h>
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
@@ -188,7 +190,7 @@ int Gprocessevents (int waitflag, int mode) {
     switch (waitflag) {
     case TRUE:
         if (!GetMessage(&msg, (HWND) NULL, (UINT) NULL, (UINT) NULL))
-            exit (msg.wParam);
+            graphviz_exit(msg.wParam);
         TranslateMessage(&msg);
         DispatchMessage(&msg);
         if (mode == G_ONEEVENT)
@@ -198,7 +200,7 @@ int Gprocessevents (int waitflag, int mode) {
     case FALSE:
         while (PeekMessage(&msg, (HWND) 0, (UINT) 0, (UINT) 0, PM_REMOVE)) {
             if (msg.message == WM_QUIT)
-                exit (msg.wParam);
+                graphviz_exit(msg.wParam);
             TranslateMessage(&msg);
             DispatchMessage(&msg);
             if (mode == G_ONEEVENT)
@@ -233,17 +235,17 @@ LRESULT CALLBACK LeftyWndProc (
         break;
     case WM_CLOSE:
         if (!widget)
-            exit (0);
+            graphviz_exit(0);
         if (WVU->closing)
             DestroyWindow (hwnd);
         if (Gnocallbacks)
-            exit (0);
+            graphviz_exit(0);
         gev.type = 0, gev.code = 0, gev.data = 0;
         gev.wi = widget - &Gwidgets[0];
         if (WVU->func)
             (*WVU->func) (&gev);
         else
-            exit (0);
+            graphviz_exit(0);
         break;
     case WM_PALETTECHANGED:
         palettechanged = (HWND) wparam;
index 7725d904a3fcb889f8ba08decd772f584260dede..acec8237fceea98a9bbed17e24cf74d2826284af 100644 (file)
@@ -10,6 +10,7 @@
 
 /* Lefteris Koutsofios - AT&T Labs Research */
 
+#include <cgraph/exit.h>
 #include "common.h"
 #include "g.h"
 #include "gcommon.h"
@@ -234,11 +235,11 @@ void Gwmdelaction (Widget w, XEvent *evp, char **app, unsigned int *anp) {
 
     widget = findwidget ((unsigned long) w, G_VIEWWIDGET);
     if (!widget)
-        exit (0);
+        graphviz_exit(0);
     gev.type = 0, gev.code = 0, gev.data = 0;
     gev.wi = widget - &Gwidgets[0];
     if (WVU->func)
         (*WVU->func) (&gev);
     else
-        exit (0);
+        graphviz_exit(0);
 }
index 25f0e046b3faee3c33ef545125e4f0281b75a246..2e222455ee632ef4b1aea5f626dd4b7058e6f72a 100644 (file)
@@ -19,6 +19,8 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
+#include <cgraph/exit.h>
+
 static char *shellpath;
 
 static char *buildpath (char *);
@@ -37,16 +39,16 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
     if (!shellpath || !(path = buildpath ("lefty"))) {
         if (!GetModuleFileName (hInstance, cmd, 256) ||
                 !(s = strrchr (cmd, '\\')))
-            exit (1);
+            graphviz_exit(1);
         *s = 0;
         shellpath = &cmd[0];
         if (!(path = buildpath ("lefty")))
-            exit (1);
+            graphviz_exit(1);
     }
     argv = CommandLineToArgvW(pCmdLine, &argc);
     if (argc == 1 && wcscmp(argv[0], L"-?") == 0) {
         fprintf(stderr, "usage: lneato [-V] [-lm (sync|async)] [-el (0|1)] <filename>\n");
-        exit(0);
+        graphviz_exit(0);
     }
     if (pCmdLine[0] == 0)
         snprintf(cmd, sizeof(cmd), "%s -e \"load('dotty.lefty');"
@@ -57,7 +59,7 @@ int WINAPI wWinMain (HINSTANCE hInstance, HINSTANCE hPrevInstance,
                  pCmdLine);
 
     handle = WinExec (cmd, SW_SHOW);
-    exit (0);
+    graphviz_exit(0);
 }
 
 #define PATHDEL '\\'
index a7fa339dc445e44d2f6691f82868639cd0c33e29..90108092d661c27c525ef4dffded3dfaaa896434 100644 (file)
@@ -13,6 +13,7 @@
 #include "gui.h"
 #include "viewport.h"
 #include "gltemplate.h"
+#include <cgraph/exit.h>
 #include <glcomp/glutils.h>
 #include "glexpose.h"
 #include "glmotion.h"
@@ -427,7 +428,7 @@ GdkGLConfig *configure_gl(void)
                                             GDK_GL_MODE_DEPTH);
        if (glconfig == NULL) {
            g_print("*** No appropriate OpenGL-capable visual found.\n");
-           exit(1);
+           graphviz_exit(1);
        }
     }
 
index 300bee3eda5691584fa13a4bb694bc34d59431fa..66c423b375ba6330b99450dedd64f3576d711723 100644 (file)
@@ -8,6 +8,8 @@
  * Contributors: Details at https://graphviz.org
  *************************************************************************/
 
+#include <cgraph/exit.h>
+
 #include "glutrender.h"
 #include "viewport.h"
 #include "arcball.h"
@@ -153,7 +155,7 @@ static void cb_drag(int X, int Y)
 static void cb_keyboard(unsigned char key, int x, int y)
 {
     if (key==27)    /*ESC*/
-       exit (1);
+       graphviz_exit(1);
     if(key=='3')
        switch2D3D(NULL, 0, 0,glMouseLeftButton);
     if(key=='c')
@@ -210,7 +212,7 @@ static int cb_game_mode(char* optArg)
     else 
     {
        printf("smyrna cannot initialize requested screen resolution and rate!\n");
-       exit(-1);
+       graphviz_exit(-1);
 
     }
 
index b85f8f012bc52196fbcaa6be36e38dad8062a11d..60083869855e802b97ffc482b00a6c8652ef881e 100644 (file)
@@ -25,6 +25,7 @@
 #include "support.h"
 #include "menucallbacks.h"
 #include "gltemplate.h"
+#include <cgraph/exit.h>
 #include <common/memory.h>
 #include "gvprpipe.h"
 #include "frmobjectui.h"
@@ -79,7 +80,7 @@ static char *useString = "Usage: smyrna [-v?] <file>\n\
 static void usage(int v)
 {
     fputs(useString, stdout);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static char *Info[] = {
@@ -108,7 +109,7 @@ static char *parseArgs(int argc, char *argv[], ViewInfo * view)
        case 'V':
            fprintf(stderr, "%s version %s (%s)\n",
                    Info[0], Info[1], Info[2]);
-           exit (0);
+           graphviz_exit(0);
            break;
        case '?':
            if (optopt == '\0')
index ae246171a9ab6818c1450fc827be49aa06e851b8..065b33dad1f5c052001a7fa87eb538959fc7441a 100644 (file)
@@ -30,6 +30,7 @@
 #include "arcball.h"
 #include "hotkeymap.h"
 #include "topviewfuncs.h"
+#include <cgraph/exit.h>
 #include <cgraph/strcasecmp.h>
 
 
@@ -267,7 +268,7 @@ void init_viewport(ViewInfo * view)
        fprintf(stderr,
                "default attributes template graph file \"%s\" not found\n",
                view->template_file);
-       exit(-1);
+       graphviz_exit(-1);
     } 
     view->systemGraphs.def_attrs = agread(input_file, NULL);
     fclose (input_file);
@@ -276,21 +277,21 @@ void init_viewport(ViewInfo * view)
        fprintf(stderr,
                "could not load default attributes template graph file \"%s\"\n",
                view->template_file);
-       exit(-1);
+       graphviz_exit(-1);
     }
     if (!path)
        path = smyrnaPath("attr_widgets.dot");
     input_file2 = fopen(path, "rb");
     if (!input_file2) {
        fprintf(stderr, "default attributes template graph file \"%s\" not found\n",smyrnaPath("attr_widgets.dot"));
-       exit(-1);
+       graphviz_exit(-1);
 
     }
     view->systemGraphs.attrs_widgets = agread(input_file2, NULL);
     fclose (input_file2);
     if (!(view->systemGraphs.attrs_widgets )) {
        fprintf(stderr,"could not load default attribute widgets graph file \"%s\"\n",smyrnaPath("attr_widgets.dot"));
-       exit(-1);
+       graphviz_exit(-1);
     }
     //init graphs
     view->g = NULL;            //no graph, gl screen should check it
index 903804bf9a421d238efdc270f4f2070b9b3f872a..a38933add4815ddb4fa701db7d6a2d3ba85fefd2 100644 (file)
@@ -24,6 +24,8 @@
 
 #include <stdlib.h>
 #include <cgraph/cgraph.h>
+#include <cgraph/exit.h>
+
 typedef struct {
     Agrec_t h;
     int mark;
@@ -106,7 +108,7 @@ static char *useString = "Usage: %s [-nv?] [-o outfile] <file>\n\
 static void usage(int v)
 {
     fprintf(stderr, useString, cmd);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static FILE *openFile(const char *name, const char *mode)
@@ -122,7 +124,7 @@ static FILE *openFile(const char *name, const char *mode)
            modestr = "writing";
        fprintf(stderr, "%s: could not open file %s for %s\n",
                cmd, name, modestr);
-       exit(-1);
+       graphviz_exit(-1);
     }
     return (fp);
 }
@@ -200,7 +202,7 @@ int main(int argc, char *argv[])
            if (Verbose)
                fprintf(stderr, "Graph \"%s\" is undirected\n", graphName(g));
        }
-       exit(rv);
+       graphviz_exit(rv);
     } else
-       exit(-1);
+       graphviz_exit(-1);
 }
index 857959c5d9045489c94d0c98622df7dc8a373cad..bab9b6c4a120480e030c727f485b48d11d66c152 100644 (file)
@@ -24,6 +24,7 @@
 
 #include <stdlib.h>
 #include <cgraph/cgraph.h>
+#include <cgraph/exit.h>
 
 typedef struct {
     Agrec_t h;
@@ -153,7 +154,7 @@ static void gwrite(Agraph_t * g, int ng, int nb)
        if (!outf) {
            fprintf(stderr, "Could not open %s for writing\n", name);
            perror("bcomps");
-           exit(1);
+           graphviz_exit(1);
        }
        agwrite(g, outf);
        fclose(outf);
@@ -305,7 +306,7 @@ If no files are specified, stdin is used\n";
 static void usage(int v)
 {
     printf("%s",useString);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static void split(char *name)
index 80a9a4ff768610f211919102a60f843195b0afbe..014385874e3404a3a32f2186f9d513143e494040 100644 (file)
 #include <cgraph/cgraph.h>
 #include <cgraph/likely.h>
 #include <cgraph/unreachable.h>
+#include <cgraph/exit.h>
 
 static void *xmalloc(size_t size) {
   void *p = malloc(size);
   if (UNLIKELY(size > 0 && p == NULL)) {
     fprintf(stderr, "ccomps: out of memory\n");
-    exit(EXIT_FAILURE);
+    graphviz_exit(EXIT_FAILURE);
   }
   return p;
 }
@@ -37,7 +38,7 @@ static void *xcalloc(size_t count, size_t size) {
   void *p = calloc(count, size);
   if (UNLIKELY(count > 0 && size > 0 && p == NULL)) {
     fprintf(stderr, "ccomps: out of memory\n");
-    exit(EXIT_FAILURE);
+    graphviz_exit(EXIT_FAILURE);
   }
   return p;
 }
@@ -46,7 +47,7 @@ static void *xrealloc(void *ptr, size_t size) {
   void *p = realloc(ptr, size);
   if (UNLIKELY(size > 0 && p == NULL)) {
     fprintf(stderr, "ccomps: out of memory\n");
-    exit(EXIT_FAILURE);
+    graphviz_exit(EXIT_FAILURE);
   }
   return p;
 }
@@ -129,7 +130,7 @@ If no files are specified, stdin is used\n";
 static void usage(int v)
 {
     printf("%s",useString);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static void split(char *name)
index 06598eceb42984a577849a27ba0362381df0b26e..1fea650d57314eb4617d711c0a5985c650c31114 100644 (file)
@@ -21,6 +21,7 @@
 #include <stdlib.h>
 
 #include "convert.h"
+#include <cgraph/exit.h>
 #include <ingraphs/ingraphs.h>
 
 typedef enum { Unset, ToGV, ToGXL } mode;
@@ -64,7 +65,7 @@ static FILE *openFile(const char *name)
     if (!fp) {
        fprintf(stderr, "%s: could not open file %s for writing\n", CmdName, name);
        perror(name);
-       exit(1);
+       graphviz_exit(1);
     }
     return fp;
 }
@@ -78,7 +79,7 @@ static const char *use = "Usage: %s [-gd?] [-o<file>] [<graphs>]\n\
 static void usage(int v)
 {
     fprintf(stderr, use, CmdName);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static char *cmdName(char *path)
@@ -156,12 +157,12 @@ static void initargs(int argc, char **argv)
            else {
                fprintf(stderr, "%s: option -%c unrecognized\n", CmdName,
                        optopt);
-               exit(1);
+               graphviz_exit(1);
            }
            break;
        default:
            fprintf(stderr, "cvtgxl: unexpected error\n");
-           exit(EXIT_FAILURE);
+           graphviz_exit(EXIT_FAILURE);
        }
     }
 
@@ -213,9 +214,9 @@ int main(int argc, char **argv)
 #else
        fputs("cvtgxl: not configured for conversion from GXL to GV\n",
              stderr);
-       exit(1);
+       graphviz_exit(1);
 
 #endif
     }
-    exit(0);
+    graphviz_exit(0);
 }
index fe63cfc2bb61ad5392841836a0dba547206f29f0..3da01a16c1da21a489ba2e1bb9cb2ab26d091a6f 100644 (file)
@@ -15,6 +15,7 @@
 #include <stdlib.h>
 #include <math.h>
 #include <cgraph/cgraph.h>
+#include <cgraph/exit.h>
 #include <ingraphs/ingraphs.h>
 #include <getopt.h>
 
@@ -225,7 +226,7 @@ If no files are specified, stdin is used\n";
 static void usage(int v)
 {
     printf("%s",useString);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static void init(int argc, char *argv[])
@@ -307,5 +308,5 @@ int main(int argc, char **argv)
     }
     free(Nodes);
     free(Files);
-    exit(code);
+    graphviz_exit(code);
 }
index 792fb4ae5b6ddf9b37c791fb735f5632839ad2f5..2c9e6594e8c55ce106eeb2e4a851f71130bf3fc8 100644 (file)
@@ -27,6 +27,8 @@
 
 #include <cgraph/cgraph.h>
 #include <cgraph/cghdr.h>
+#include <cgraph/exit.h>
+
 typedef struct {
     Agrec_t h;
     int dfs_mark;
@@ -79,7 +81,7 @@ If no files are specified, stdin is used\n";
 static void usage(int v)
 {
     printf("%s",useString);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static void init(int argc, char *argv[])
@@ -131,7 +133,7 @@ static void init(int argc, char *argv[])
            break;
        default:
            fprintf(stderr, "gc: unexpected error\n");
-           exit(EXIT_FAILURE);
+           graphviz_exit(EXIT_FAILURE);
        }
     }
     argv += optind;
@@ -182,14 +184,14 @@ static void push(Agnode_t * np)
            blk_t *bp = NEW(blk_t);
            if (bp == 0) {
                fprintf(stderr, "gc: Out of memory\n");
-               exit(1);
+               graphviz_exit(1);
            }
            bp->prev = Stk.curblk;
            bp->next = NULL;
            bp->data = N_NEW(BIGBUF, Agnode_t *);
            if (bp->data == 0) {
                fprintf(stderr, "gc: Out of memory\n");
-               exit(1);
+               graphviz_exit(1);
            }
            bp->endp = bp->data + BIGBUF;
            Stk.curblk->next = bp;
index 3ee0c40658486d0d96747b75e746af95e0cbec24..14d30cb42dfa71bc2f6ef213534688f12f971e9f 100644 (file)
@@ -19,6 +19,8 @@
 
 #include <getopt.h>
 
+#include <cgraph/exit.h>
+
 #define N_NEW(n,t)       calloc((n),sizeof(t))
 
 static int Verbose;
@@ -60,7 +62,7 @@ static FILE *openFile(const char *name)
         fprintf(stderr, "%s: could not open file %s for writing\n",
                 CmdName, name);
         perror(name);
-        exit(1);
+        graphviz_exit(1);
     }
     return fp;
 }
@@ -76,7 +78,7 @@ If no files are specified, stdin is used\n";
 static void usage(int v)
 {
     printf(useString, CmdName);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static char *cmdName(char *path)
@@ -176,6 +178,6 @@ int main(int argc, char **argv)
            fflush(outFile);
        }
     }
-    exit(rv);
+    graphviz_exit(rv);
 }
 
index a0505a7e3bccb6676c6938d37a94cd335bf2c610..dfbc4ee3697865ac3b922559dbbe80783fced9a4 100644 (file)
@@ -11,6 +11,7 @@
 
 #include    "convert.h"
 #include    <cgraph/agxbuf.h>
+#include    <cgraph/exit.h>
 #include    <getopt.h>
 #ifdef HAVE_EXPAT
 #include    <expat.h>
@@ -71,7 +72,7 @@ static void popString(slist ** stk)
     slist *sp = *stk;
     if (!sp) {
        fprintf(stderr, "PANIC: graphml2gv: empty element stack\n");
-       exit(1);
+       graphviz_exit(1);
     }
     *stk = sp->next;
     free(sp);
@@ -81,7 +82,7 @@ static char *topString(slist * stk)
 {
     if (!stk) {
        fprintf(stderr, "PANIC: graphml2gv: empty element stack\n");
-       exit(1);
+       graphviz_exit(1);
     }
     return stk->buf;
 }
@@ -209,7 +210,7 @@ static void push_subg(Agraph_t * g)
     if (GSP == STACK_DEPTH) {
        fprintf(stderr, "graphml2gv: Too many (> %d) nestings of subgraphs\n",
                STACK_DEPTH);
-       exit(1);
+       graphviz_exit(1);
     } else if (GSP == 0)
        root = g;
     G = Gstack[GSP++] = g;
@@ -220,7 +221,7 @@ static Agraph_t *pop_subg(void)
     Agraph_t *g;
     if (GSP == 0) {
        fprintf(stderr, "graphml2gv: Gstack underflow in graph parser\n");
-       exit(1);
+       graphviz_exit(1);
     }
     g = Gstack[--GSP];
     if (GSP > 0)
@@ -665,7 +666,7 @@ static FILE *openFile(const char *name)
     if (!fp) {
        fprintf(stderr, "%s: could not open file %s for writing\n", CmdName, name);
        perror(name);
-       exit(1);
+       graphviz_exit(1);
     }
     return fp;
 }
@@ -679,7 +680,7 @@ static const char *use = "Usage: %s [-gd?] [-o<file>] [<graphs>]\n\
 static void usage(int v)
 {
     fprintf(stderr, use, CmdName);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static char *cmdName(char *path)
@@ -778,9 +779,9 @@ int main(int argc, char **argv)
            fflush(outFile);
        }
     }
-    exit(rv);
+    graphviz_exit(rv);
 #else
     fputs("cvtgxl: not configured for conversion from GXL to GV\n", stderr);
-    exit(1);
+    graphviz_exit(1);
 #endif
 }
index c490087e422747693aa87b3e1c5004dad720c14c..a3bf85abf2faec85e12b6da2d1eb4f274d066705 100644 (file)
@@ -25,6 +25,7 @@
 #include <getopt.h>
 
 #include <cgraph/cgraph.h>
+#include <cgraph/exit.h>
 #include <common/types.h>
 #include <common/utils.h>
 #include <ctype.h>
@@ -190,7 +191,7 @@ arrowEnd (char* s0, char* pfx, int* fp, double* xp, double* yp)
     s = readPoint (s, xp, yp);
     if (s == NULL) {
        fprintf (stderr, "Illegal spline end: %s\n", s0);
-       exit (1);
+       graphviz_exit(1);
     }
     *fp = 1;
     return s;
@@ -673,7 +674,7 @@ static FILE *openFile(const char *name)
         fprintf(stderr, "%s: could not open file %s for writing\n",
                 CmdName, name);
         perror(name);
-        exit(1);
+        graphviz_exit(1);
     }
     return fp;
 }
@@ -687,7 +688,7 @@ If no files are specified, stdin is used\n";
 static void usage(int v)
 {
     printf(useString, CmdName);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static char *cmdName(char *cmd)
@@ -765,5 +766,5 @@ int main(int argc, char **argv)
        gv_to_gml(G, outFile);
        fflush(outFile);
     }
-    exit(rv);
+    graphviz_exit(rv);
 }
index 771300f6f9d1019e4679fd8cfca8e049b73fa50e..5e1e1e696e7a3f1e65bd16fe6862aa2fdbe16f3d 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <assert.h>
 #include <cgraph/cgraph.h>
+#include <cgraph/exit.h>
 #include <stdlib.h>
 typedef struct Agnodeinfo_t {
     Agrec_t h;
@@ -78,7 +79,7 @@ If no files are specified, stdin is used\n";
 static void usage(int v)
 {
     printf("%s",useString);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static void init(int argc, char *argv[])
@@ -99,7 +100,7 @@ static void init(int argc, char *argv[])
            break;
        default:
            fprintf(stderr, "gvcolor: unexpected error\n");
-           exit(EXIT_FAILURE);
+           graphviz_exit(EXIT_FAILURE);
        }
     }
     argv += optind;
@@ -121,7 +122,7 @@ static void color(Agraph_t * g)
     if (agattr(g, AGNODE, "pos", 0) == NULL) {
        fprintf(stderr,
                "graph must be run through 'dot' before 'gvcolor'\n");
-       exit(1);
+       graphviz_exit(1);
     }
     aginit(g, AGNODE, "nodeinfo", sizeof(Agnodeinfo_t), TRUE);
     if (agattr(g, AGNODE, "style", 0) == NULL)
@@ -253,5 +254,5 @@ int main(int argc, char **argv)
        agclose(g);
     }
 
-    exit(0);
+    graphviz_exit(0);
 }
index 74ef9302ada8a590d7168fd79eb538be3e1d8aef..ced1e935c96e95e95c191f459bd4cd20f543ba79 100644 (file)
@@ -25,6 +25,8 @@
 #include <getopt.h>
 #include "graph_generator.h"
 
+#include <cgraph/exit.h>
+
 typedef enum { unknown, grid, circle, complete, completeb, 
     path, tree, torus, cylinder, mobius, randomg, randomt, ball,
     sierpinski, hypercube, star, wheel, trimesh
@@ -54,7 +56,7 @@ static FILE *openFile(const char *name)
     fp = fopen(name, "w");
     if (!fp) {
        fprintf(stderr, "%s: could not open file %s for writing\n", cmd, name);
-       exit(1);
+       graphviz_exit(1);
     }
     return fp;
 }
@@ -92,7 +94,7 @@ static char *Usage = "Usage: %s [-dv?] [options]\n\
 static void usage(int v)
 {
     fprintf(v ? stderr : stdout, Usage, cmd);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static void errexit(int opt) {
@@ -543,5 +545,5 @@ int main(int argc, char *argv[])
     }
     fprintf(opts.outfile, "}\n");
 
-    exit(0);
+    graphviz_exit(0);
 }
index 5ee21a08a01bf63f6137dbf03d455f6129c78ec7..ac8a54c936145487f2cb1f4113526125c6b7e2d6 100644 (file)
@@ -21,6 +21,7 @@
 
 #include <assert.h>
 #include <gvc/gvc.h>
+#include <cgraph/exit.h>
 #include <common/render.h>
 #include <neatogen/neatoprocs.h>
 #include <ingraphs/ingraphs.h>
@@ -94,7 +95,7 @@ If no files are specified, stdin is used\n";
 static void usage(int v)
 {
     printf("%s",useString);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static FILE *openFile(const char *name)
@@ -104,7 +105,7 @@ static FILE *openFile(const char *name)
     fp = fopen(name, "w");
     if (!fp) {
        fprintf(stderr, "gvpack: could not open file %s for writing\n", name);
-       exit(1);
+       graphviz_exit(1);
     }
     return (fp);
 }
@@ -298,7 +299,7 @@ static void init_graph(Agraph_t *g, bool fill, GVC_t *gvc) {
     if (d != 2) {
        fprintf(stderr, "Error: graph %s has dim = %d (!= 2)\n", agnameof(g),
                d);
-       exit(1);
+       graphviz_exit(1);
     }
     Ndim = GD_ndim(g) = 2;
     init_node_edge(g);
@@ -311,7 +312,7 @@ static void init_graph(Agraph_t *g, bool fill, GVC_t *gvc) {
            else if (ret > 0)
                fprintf(stderr, "gvpack does not support backgrounds as found in graph %s\n",
                    agnameof(g));
-           exit(1);
+           graphviz_exit(1);
        }
        if (Concentrate) { /* check for edges without pos info */
            for (n = agfstnode(g); n; n = agnxtnode(g, n)) {
@@ -781,7 +782,7 @@ static Agraph_t **readGraphs(int *cp, GVC_t* gvc)
        else if (kind.directed != g->desc.directed) {
            fprintf(stderr,
                    "Error: all graphs must be directed or undirected\n");
-           exit(1);
+           graphviz_exit(1);
        } else if (!agisstrict(g))
            kind = g->desc;
        init_graph(g, doPack, gvc);
@@ -859,13 +860,13 @@ int main(int argc, char *argv[])
     gvc = gvContextPlugins(lt_preloaded_symbols, DEMAND_LOADING);
     gs = readGraphs(&cnt, gvc);
     if (cnt == 0)
-       exit(0);
+       graphviz_exit(0);
 
     /* pack graphs */
     if (doPack) {
        if (packGraphs(cnt, gs, 0, &pinfo)) {
            fprintf(stderr, "gvpack: packing of graphs failed.\n");
-           exit(1);
+           graphviz_exit(1);
        }
     }
 
@@ -879,5 +880,5 @@ int main(int argc, char *argv[])
        attach_attrs(g);
     }
     agwrite(g, outfp);
-    exit(0);
+    graphviz_exit(0);
 }
index b1936977b1d8ef6996ff6b8c68a6848ca243e01d..f0a8faa74b159e4a43b33d8779723d7a1dc13a4f 100644 (file)
@@ -11,6 +11,7 @@
 #include    <assert.h>
 #include    "convert.h"
 #include    <cgraph/agxbuf.h>
+#include    <cgraph/exit.h>
 #ifdef HAVE_EXPAT
 #include    <expat.h>
 #include    <ctype.h>
@@ -56,7 +57,7 @@ static void *gcalloc(size_t nmemb, size_t size)
     char *rv = calloc(nmemb, size);
     if (rv == NULL) {
        fprintf(stderr, "out of memory\n");
-       exit(EXIT_FAILURE);
+       graphviz_exit(EXIT_FAILURE);
     }
     return rv;
 }
@@ -78,7 +79,7 @@ static void popString(slist ** stk)
     slist *sp = *stk;
     if (!sp) {
        fprintf(stderr, "PANIC: gxl2gv: empty element stack\n");
-       exit(1);
+       graphviz_exit(1);
     }
     *stk = sp->next;
     free(sp);
@@ -88,7 +89,7 @@ static char *topString(slist * stk)
 {
     if (!stk) {
        fprintf(stderr, "PANIC: gxl2gv: empty element stack\n");
-       exit(1);
+       graphviz_exit(1);
     }
     return stk->buf;
 }
@@ -224,7 +225,7 @@ static void push_subg(Agraph_t * g)
     if (GSP == STACK_DEPTH) {
        fprintf(stderr, "gxl2gv: Too many (> %d) nestings of subgraphs\n",
                STACK_DEPTH);
-       exit(1);
+       graphviz_exit(1);
     } else if (GSP == 0)
        root = g;
     G = Gstack[GSP++] = g;
@@ -235,7 +236,7 @@ static Agraph_t *pop_subg(void)
     Agraph_t *g;
     if (GSP == 0) {
        fprintf(stderr, "gxl2gv: Gstack underflow in graph parser\n");
-       exit(1);
+       graphviz_exit(1);
     }
     g = Gstack[--GSP];
     if (GSP > 0)
@@ -709,7 +710,7 @@ Agraph_t *gxl_to_gv(FILE * gxlFile)
 
     if (udata == NULL) {
        fprintf(stderr, "out of memory\n");
-       exit(1);
+       graphviz_exit(1);
     }
 
     XML_SetUserData(parser, udata);
@@ -729,7 +730,7 @@ Agraph_t *gxl_to_gv(FILE * gxlFile)
                    "%s at line %lu\n",
                    XML_ErrorString(XML_GetErrorCode(parser)),
                    XML_GetCurrentLineNumber(parser));
-           exit(1);
+           graphviz_exit(1);
        }
     } while (!done);
     XML_ParserFree(parser);
index 1385f875e470e12269cad91fb345507dade29ca4..dab5fafddda5234f798450444f9405e32079e88c 100644 (file)
@@ -214,7 +214,7 @@ static char* useString = "Usage: %s [-uvcl] [-o file] matrix_market_filename\n\
 static void usage(int eval)
 {
     fprintf(stderr, useString, cmd);
-    exit(eval);
+    graphviz_exit(eval);
 }
 
 static FILE *openF(char *fname, char *mode)
@@ -223,7 +223,7 @@ static FILE *openF(char *fname, char *mode)
     if (!f) {
        fprintf(stderr, "Could not open %s for %s\n", fname,
                ((*mode == 'r') ? "reading" : "writing"));
-       exit(1);
+       graphviz_exit(1);
     }
     return f;
 }
@@ -325,7 +325,7 @@ int main(int argc, char *argv[])
 
     if (!A) {
        fprintf(stderr, "cannot import from file %s\n", pv.infile);
-       exit(1);
+       graphviz_exit(1);
     }
 
     if (pv.undirected) {
index f14450aacdc33abbc12e88633d070dde236527a9..6c902c931f9714f26fca7d9c7d280ea9c15ca88f 100644 (file)
@@ -11,6 +11,7 @@
 #include "config.h"
 
 #include <cgraph/cgraph.h>
+#include <cgraph/exit.h>
 #include <ingraphs/ingraphs.h>
 #include <stdbool.h>
 #include <stdio.h>
@@ -32,7 +33,7 @@ If no files are specified, stdin is used\n";
 static void usage(int v)
 {
     printf("%s",useString);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static void init(int argc, char *argv[])
@@ -56,7 +57,7 @@ static void init(int argc, char *argv[])
            break;
        default:
            fprintf(stderr, "nop: unexpected error\n");
-           exit(EXIT_FAILURE);
+           graphviz_exit(EXIT_FAILURE);
        }
     }
     argv += optind;
index e6a1fb8cc6f93f7939ce49a092968283fc807494..707235c3dcfcbdc6cd8db3989f790e991d53886d 100644 (file)
@@ -29,6 +29,7 @@
 #include <unistd.h>
 #endif
 #include <cgraph/cgraph.h>
+#include <cgraph/exit.h>
 #include <ingraphs/ingraphs.h>
 
 #include <getopt.h>
@@ -289,7 +290,7 @@ static FILE *openFile(const char *name)
     fp = fopen(name, "w");
     if (!fp) {
        fprintf(stderr, "gvpack: could not open file %s for writing\n", name);
-       exit(1);
+       graphviz_exit(1);
     }
     return (fp);
 }
@@ -306,7 +307,7 @@ If no files are specified, stdin is used\n";
 static void usage(int v)
 {
     printf(useString, CmdName);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static void scanArgs(int argc, char **argv)
index 26a97c5fc4ca52efb4da65bee5507a6c3ac4ede6..2e4e51495953650f0697c8033a26bec7a94e8a2b 100644 (file)
@@ -20,6 +20,7 @@
 #include "config.h"
 
 #include <cgraph/cgraph.h>
+#include <cgraph/exit.h>
 #include <common/arith.h>
 #include <common/types.h>
 #include <common/utils.h>
@@ -87,14 +88,14 @@ static void push(estack_t* sp, Agedge_t * ep, nodeinfo_t* ninfo)
            blk_t *bp = NEW(blk_t);
            if (bp == 0) {
                fprintf(stderr, "%s: Out of memory\n", CmdName);
-               exit(1);
+               graphviz_exit(1);
            }
            bp->prev = sp->Stk.curblk;
            bp->next = NULL;
            bp->data = N_NEW(BIGBUF, Agedge_t *);
            if (bp->data == 0) {
                fprintf(stderr, "%s: Out of memory\n", CmdName);
-               exit(1);
+               graphviz_exit(1);
            }
            bp->endp = bp->data + BIGBUF;
            sp->Stk.curblk->next = bp;
@@ -237,7 +238,7 @@ If no files are specified, stdin is used\n";
 static void usage(int v)
 {
     printf(useString, CmdName);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static void init(int argc, char *argv[])
index e3e9be61ff44defc5eef25db2e9d8c8b2c558668..6c57283a47fd2c0b69d22b8d3513d8010f36b8e7 100644 (file)
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #endif
 #include    <cgraph/cgraph.h>
+#include    <cgraph/exit.h>
 #include    <ingraphs/ingraphs.h>
 
 #include <getopt.h>
@@ -142,7 +143,7 @@ static char *useString =
 static void usage(int v)
 {
     fprintf(stderr, useString, cmd);
-    exit(v);
+    graphviz_exit(v);
 }
 
 static FILE *openFile(const char *name)
@@ -152,7 +153,7 @@ static FILE *openFile(const char *name)
     fp = fopen(name, "w");
     if (!fp) {
        fprintf(stderr, "%s: could not open file %s for writing\n", cmd, name);
-       exit(-1);
+       graphviz_exit(-1);
     }
     return fp;
 }
index 5b4d6acdce1f38ef893cf5a1a116fdd532196f01..5d2d30f7c9bd086486ba2f26d6060ea32e5af871 100644 (file)
@@ -39,6 +39,8 @@
 #include <gd.h>
 #include <stdbool.h>
 
+#include <cgraph/exit.h>
+
 static char *pstopng="gs -dNOPAUSE -sDEVICE=pngalpha -sOutputFile=- -q -";
 
 static gdImagePtr imageLoad (char *filename)
@@ -52,12 +54,12 @@ static gdImagePtr imageLoad (char *filename)
     ext = strrchr(filename, '.');
     if (!ext) {
         fprintf(stderr, "Filename \"%s\" has no file extension.\n", filename);
-        exit(EX_USAGE);
+        graphviz_exit(EX_USAGE);
     }
     rc = stat(filename, &statbuf);
     if (rc) {
         fprintf(stderr, "Failed to stat \"%s\"\n", filename);
-         exit(EX_NOINPUT);
+         graphviz_exit(EX_NOINPUT);
     }
     if (strcasecmp(ext, ".ps") == 0) {
        ext = ".png";
@@ -78,14 +80,14 @@ static gdImagePtr imageLoad (char *filename)
        free(tmp);
         if (!f) {
             fprintf(stderr, "Failed to open converted \"%s%s\"\n", filename, ext);
-            exit(EX_NOINPUT);
+            graphviz_exit(EX_NOINPUT);
         }
     }
     else {
         f = fopen(filename, "rb");
         if (!f) {
             fprintf(stderr, "Failed to open \"%s\"\n", filename);
-            exit(EX_NOINPUT);
+            graphviz_exit(EX_NOINPUT);
         }
     }
     im = 0;
@@ -94,7 +96,7 @@ static gdImagePtr imageLoad (char *filename)
         im = gdImageCreateFromPng(f);
 #else
         fprintf(stderr, "PNG support is not available\n");
-        exit(EX_UNAVAILABLE);
+        graphviz_exit(EX_UNAVAILABLE);
 #endif
     }
     else if (strcasecmp(ext, ".gif") == 0) {
@@ -102,7 +104,7 @@ static gdImagePtr imageLoad (char *filename)
         im = gdImageCreateFromGif(f);
 #else
         fprintf(stderr, "GIF support is not available\n");
-        exit(EX_UNAVAILABLE);
+        graphviz_exit(EX_UNAVAILABLE);
 #endif
     }
     else if (strcasecmp(ext, ".jpg") == 0) {
@@ -110,13 +112,13 @@ static gdImagePtr imageLoad (char *filename)
         im = gdImageCreateFromJpeg(f);
 #else
         fprintf(stderr, "JPEG support is not available\n");
-        exit(EX_UNAVAILABLE);
+        graphviz_exit(EX_UNAVAILABLE);
 #endif
     }
     fclose(f);
     if (!im) {
         fprintf(stderr, "Loading image from file  \"%s\" failed!\n", filename);
-        exit(EX_DATAERR);
+        graphviz_exit(EX_DATAERR);
     }
     return im;
 }
@@ -152,11 +154,11 @@ int main(int argc, char **argv)
 
     if (argc == 2 && strcmp(argv[1], "-?") == 0) {
         fprintf(stderr, "Usage: diffimg image1 image2 [outimage]\n");
-        exit(0);
+        graphviz_exit(0);
     }
     if (argc < 3) {
         fprintf(stderr, "Usage: diffimg image1 image2 [outimage]\n");
-        exit(EX_USAGE);
+        graphviz_exit(EX_USAGE);
     }
     A = imageLoad(argv[1]);
     B = imageLoad(argv[2]);
index ddf7896aac26aca7722bdda6732776e43ab19ef4..159969b26041af4a54f721367b9340d20d5a31c2 100644 (file)
@@ -21,6 +21,7 @@
 #include <getopt.h>
 
 #include "cgraph.h"
+#include "exit.h"
 #include "ingraphs.h"
 #include "generic_list.h"
 
@@ -103,7 +104,7 @@ int main(int argc, char **argv)
        case 'h':
            {
                help_message(progname);
-               exit(EXIT_SUCCESS);
+               graphviz_exit(EXIT_SUCCESS);
                break;
            }
        case 'v':
@@ -114,19 +115,19 @@ int main(int argc, char **argv)
        case '?':
            if (optopt == '?') {
                help_message(progname);
-               exit(EXIT_SUCCESS);
+               graphviz_exit(EXIT_SUCCESS);
            } else if (isprint(optopt)) {
                fprintf(stderr, "Unknown option `-%c'.\n", optopt);
            } else {
                fprintf(stderr, "Unknown option character `\\x%X'.\n",
                        optopt);
            }
-           exit(EXIT_FAILURE);
+           graphviz_exit(EXIT_FAILURE);
            break;
 
        default:
            help_message(progname);
-           exit(EXIT_FAILURE);
+           graphviz_exit(EXIT_FAILURE);
            break;
        }
     }
@@ -143,7 +144,7 @@ int main(int argc, char **argv)
        if (agisdirected(graph) == 0) {
            fprintf(stderr,
                    "*** Error: Graph is undirected! Pruning works only with directed graphs!\n");
-           exit(EXIT_FAILURE);
+           graphviz_exit(EXIT_FAILURE);
        }
 
        /* attach node data for marking to all nodes */
@@ -185,7 +186,7 @@ int main(int argc, char **argv)
                    if (attr == NULL) {
                        fprintf(stderr, "Couldn't create attribute: %s\n",
                                ((strattr_t *) attr_list->data[j])->n);
-                       exit(EXIT_FAILURE);
+                       graphviz_exit(EXIT_FAILURE);
                    }
                    agxset(node, attr,
                           ((strattr_t *) attr_list->data[j])->v);
@@ -197,7 +198,7 @@ int main(int argc, char **argv)
     }
     free(attr_list);
     free(node_list);
-    exit(EXIT_SUCCESS);
+    graphviz_exit(EXIT_SUCCESS);
 }
 
 int remove_child(Agraph_t * graph, Agnode_t * node)
@@ -263,14 +264,14 @@ generic_list_t *addattr(generic_list_t * l, char *a)
     sp = malloc(sizeof(strattr_t));
     if (sp == NULL) {
        perror("[addattr()->malloc()]");
-       exit(EXIT_FAILURE);
+       graphviz_exit(EXIT_FAILURE);
     }
 
     /* Split argument spec. at first '=' */
     p = strchr(a, '=');
     if (p == NULL) {
        fprintf(stderr, "Invalid argument specification: %s\n", a);
-       exit(EXIT_FAILURE);
+       graphviz_exit(EXIT_FAILURE);
     }
     *(p++) = '\0';
 
@@ -278,14 +279,14 @@ generic_list_t *addattr(generic_list_t * l, char *a)
     sp->n = strdup(a);
     if (sp->n == NULL) {
        perror("[addattr()->strdup()]");
-       exit(EXIT_FAILURE);
+       graphviz_exit(EXIT_FAILURE);
     }
 
     /* pointer to argument value */
     sp->v = strdup(p);
     if (sp->v == NULL) {
        perror("[addattr()->strdup()]");
-       exit(EXIT_FAILURE);
+       graphviz_exit(EXIT_FAILURE);
     }
 
     return add_to_generic_list(l, (gl_data) sp);
@@ -299,7 +300,7 @@ generic_list_t *addnode(generic_list_t * l, char *n)
     sp = strdup(n);
     if (sp == NULL) {
        perror("[addnode()->strdup()]");
-       exit(EXIT_FAILURE);
+       graphviz_exit(EXIT_FAILURE);
     }
 
     return add_to_generic_list(l, (gl_data) sp);
index 0d33f723fe2a1d1c02bf9b3490f8027a223110af..4c2bba84dc98f9493c5602bbfa382844943f29c3 100644 (file)
@@ -16,6 +16,7 @@
 #include <unistd.h>
 #endif
 #include "cgraph.h"
+#include "exit.h"
 #include "ingraphs.h"
 
 #include <getopt.h>
@@ -259,7 +260,7 @@ static FILE *openFile(const char *name)
        fp = fopen(name, "w");
        if (!fp) {
                fprintf(stderr, "gvpack: could not open file %s for writing\n", name);
-               exit(1);
+               graphviz_exit(1);
        }
        return (fp);
 }
@@ -276,7 +277,7 @@ If no files are specified, stdin is used\n";
 static void usage(int v)
 {
        printf(useString, CmdName);
-       exit(v);
+       graphviz_exit(v);
 }
 
 static void scanArgs(int argc, char **argv)
index d3259c52d351df0d7fc910932a1533210c22a7f2..81e04573e6b77407ca983deb005acad04ff3e48d 100644 (file)
@@ -22,6 +22,7 @@
 
 #include <ast/ast.h>
 #include <ast/error.h>
+#include <cgraph/exit.h>
 #include <stddef.h>
 #include <string.h>
 #include <errno.h>
@@ -82,7 +83,7 @@ void errorv(const char *id, int level, const char *s, va_list ap)
        sfprintf(sfstderr, "\n%s", strerror(errno));
     sfprintf(sfstderr, "\n");
     if (level >= ERROR_FATAL)
-       exit(level - ERROR_FATAL + 1);
+       graphviz_exit(level - ERROR_FATAL + 1);
 }
 
 void error(int level, const char *s, ...)
index 6f9476d859e531a48930667ffb417d4cbc074942..316bebd0142c9ef41c9b5910aaa0636617e6ac61 100644 (file)
@@ -1,5 +1,6 @@
 #include <assert.h>
 #include <cgraph/sprint.h>
+#include <cgraph/exit.h>
 #include <stdarg.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -59,7 +60,7 @@ char *NONNULL gv_sprint_or_exit(const char *NONNULL format, ...) {
 
   if (s == NULL) {
     fprintf(stderr, "gv_sprint failed\n");
-    exit(EXIT_FAILURE);
+    graphviz_exit(EXIT_FAILURE);
   }
 
   return s;
index 38289f27c567d757a3a8cb1558797ff52822cfe5..dd0e04baa9028daeb1d294acbb61b2b2592bf66c 100644 (file)
@@ -15,6 +15,7 @@
 #include <gvc/gvc.h>
 #include <xdot/xdot.h>
 #include <cgraph/agxbuf.h>
+#include <cgraph/exit.h>
 #include <cgraph/strcasecmp.h>
 #include <stdbool.h>
 #include <stddef.h>
@@ -91,7 +92,7 @@ int dotneato_usage(int exval)
     fputs(configItems, outs);
 
     if (GvExitOnUsage && (exval >= 0))
-       exit(exval);
+       graphviz_exit(exval);
     return (exval+1);
        
 }
@@ -248,7 +249,7 @@ int dotneato_args_initialize(GVC_t * gvc, int argc, char **argv)
     /* must happen before trying to select any plugins */
     if (gvc->common.config) {
         gvconfig(gvc, gvc->common.config);
-       exit (0);
+       graphviz_exit(0);
     }
 
     /* feed the globals */
@@ -307,7 +308,7 @@ int dotneato_args_initialize(GVC_t * gvc, int argc, char **argv)
                        /* Q: Should 'dot -c' be suggested generally or only when val = "dot"? */
                        fprintf(stderr, " No formats found.\nPerhaps \"dot -c\" needs to be run (with installer's privileges) to register the plugins?\n");
                    }
-                   if (GvExitOnUsage) exit(1);
+                   if (GvExitOnUsage) graphviz_exit(1);
                    return(2);
                }
                break;
@@ -335,7 +336,7 @@ int dotneato_args_initialize(GVC_t * gvc, int argc, char **argv)
                            fprintf(stderr, " No layouts found.\nPerhaps \"dot -c\" needs to be run (with installer's privileges) to register the plugins?\n");
                        }
                    }
-                   if (GvExitOnUsage) exit(1);
+                   if (GvExitOnUsage) graphviz_exit(1);
                    return(2);
                 }
                Kflag = 1;
@@ -347,7 +348,7 @@ int dotneato_args_initialize(GVC_t * gvc, int argc, char **argv)
                fprintf(stderr, "%s - %s version %s (%s)\n",
                        gvc->common.cmdname, gvc->common.info[0], 
                        gvc->common.info[1], gvc->common.info[2]);
-               if (GvExitOnUsage) exit(0);
+               if (GvExitOnUsage) graphviz_exit(0);
                return (1);
                break;
            case 'l':
@@ -442,7 +443,7 @@ int dotneato_args_initialize(GVC_t * gvc, int argc, char **argv)
                }
            }
 
-           if (GvExitOnUsage) exit(1);
+           if (GvExitOnUsage) graphviz_exit(1);
            return(2);
        }
     }
index 6071a769ea75f8c5c2af42e49696ae30bb174d2a..e75d51724285e3ac122eb7730cc80133cc5ff33a 100644 (file)
@@ -10,6 +10,7 @@
 
 #include "config.h"
 
+#include <cgraph/exit.h>
 #include <cgraph/likely.h>
 #include <stdio.h>
 #include <stdlib.h>
@@ -28,7 +29,7 @@ void *zrealloc(void *ptr, size_t size, size_t elt, size_t osize)
     void *p = realloc(ptr, size * elt);
     if (UNLIKELY(p == NULL && size)) {
        fprintf(stderr, "out of memory\n");
-       exit(EXIT_FAILURE);
+       graphviz_exit(EXIT_FAILURE);
     }
     if (osize < size)
        memset((char *) p + (osize * elt), '\0', (size - osize) * elt);
@@ -40,7 +41,7 @@ void *gcalloc(size_t nmemb, size_t size)
     char *rv = calloc(nmemb, size);
     if (UNLIKELY(nmemb > 0 && size > 0 && rv == NULL)) {
        fprintf(stderr, "out of memory\n");
-       exit(EXIT_FAILURE);
+       graphviz_exit(EXIT_FAILURE);
     }
     return rv;
 }
@@ -53,7 +54,7 @@ void *gmalloc(size_t nbytes)
     rv = malloc(nbytes);
     if (UNLIKELY(rv == NULL)) {
        fprintf(stderr, "out of memory\n");
-       exit(EXIT_FAILURE);
+       graphviz_exit(EXIT_FAILURE);
     }
     return rv;
 }
@@ -63,7 +64,7 @@ void *grealloc(void *ptr, size_t size)
     void *p = realloc(ptr, size);
     if (UNLIKELY(p == NULL && size)) {
        fprintf(stderr, "out of memory\n");
-       exit(EXIT_FAILURE);
+       graphviz_exit(EXIT_FAILURE);
     }
     return p;
 }
index 000d7471c0b5025163fe8ce538a9a9269ec77982..d4103fc09f3d7b6d52f0ba5ebd4d54dd9e1565ac 100644 (file)
@@ -1,3 +1,4 @@
+#include <cgraph/exit.h>
 #include <cgraph/unreachable.h>
 #include <common/types.h>
 #include <common/utils.h>
@@ -119,7 +120,7 @@ static int xml_core(char previous, const char **current, xml_flags_t flags,
     // TODO: a better strategy than aborting on malformed data
     if (is_invalid) {
       fprintf(stderr, "Error during conversion to \"UTF-8\". Quiting.\n");
-      exit(EXIT_FAILURE);
+      graphviz_exit(EXIT_FAILURE);
     }
 
     // Decode the character. Refer again to the above table to understand this
index 32609344cf9e5edccbc7c03fe13eee98cfa390e4..ae4d373dadc68271c59744b9560e46d40ebbdc5b 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <assert.h>
 #include <cgraph/cgraph.h>
+#include <cgraph/exit.h>
 #include <dotgen/dot.h>
 #include <limits.h>
 #include <stdbool.h>
@@ -1870,7 +1871,7 @@ void virtual_weight(edge_t * e)
     assert(t >= 0);
     if (INT_MAX / t < ED_weight(e)) {
        agerr(AGERR, "overflow when calculating virtual weight of edge\n");
-       exit(EXIT_FAILURE);
+       graphviz_exit(EXIT_FAILURE);
     }
 
     ED_weight(e) *= t;
index df67259c016d5df4d50b8d96c9f79bd52aa7accf..0f119e2b7f31325e35f718658ba714df14259c1a 100644 (file)
@@ -21,6 +21,7 @@
        int             tmp;            /* temp var index               */ \
        Exccdisc_t*     ccdisc;         /* excc() discipline            */
 
+#include <cgraph/exit.h>
 #include <expr/exlib.h>
 #include <stddef.h>
 #include <stdio.h>
@@ -224,7 +225,7 @@ gen(Excc_t* cc, Exnode_t* expr)
                sfprintf(cc->ccdisc->text, "%s", expr->data.variable.symbol->name);
                return;
        case EXIT:
-               sfprintf(cc->ccdisc->text, "exit(");
+                sfprintf(cc->ccdisc->text, "exit(");
                gen(cc, x);
                sfprintf(cc->ccdisc->text, ");\n");
                return;
index c63ae4acf6176cc5eb0ad6ce4e4e9e8f3cd2392d..4b720ce87274bda45b956e0718a3db2ca1ad3cec 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <assert.h>
+#include <cgraph/exit.h>
 #include <expr/exlib.h>
 #include <stdarg.h>
 #include <stdio.h>
@@ -74,7 +75,7 @@ exerror(const char* format, ...)
     free(s);
        }
        else if (expr.program->disc->flags & EX_FATAL)
-               exit(1);
+               graphviz_exit(1);
 }
 
 void 
index 0af282ee2a192a9dda3297d9f423c1d8615084e7..71476e695fca3a8f59816d6c468fa39bcd7da8a8 100644 (file)
@@ -21,6 +21,7 @@
 #define _BLD_sfio 1
 #endif
 
+#include <cgraph/exit.h>
 #include <expr/exlib.h>
 #include <expr/exop.h>
 #include <inttypes.h>
@@ -1240,7 +1241,7 @@ eval(Expr_t* ex, Exnode_t* expr, void* env)
                if (ex->disc->exitf)
                        (*ex->disc->exitf) (ex, env, (int)v.integer);
                else
-                       exit((int)v.integer);
+                       graphviz_exit((int)v.integer);
                /*NOTREACHED*/
                v.integer = -1;
                return v;
@@ -1483,7 +1484,7 @@ eval(Expr_t* ex, Exnode_t* expr, void* env)
                Sfio_t *buffer = sfstropen();
                if (buffer == NULL) {
                        fprintf(stderr, "out of memory\n");
-                       exit(EXIT_FAILURE);
+                       graphviz_exit(EXIT_FAILURE);
                }
                print(ex, expr, env, buffer);
                v.string = exstash(buffer, ex->ve);
index 3677ab90c45eb1a31767e072e13284e21ac709af..3ae15c5e9452a42717c2717cb19c50e0bb8dc145 100644 (file)
@@ -18,6 +18,7 @@
 
 #define FDP_PRIVATE
 
+#include <cgraph/exit.h>
 #include <fdpgen/dbg.h>
 #include <neatogen/neatoprocs.h>
 #include <fdpgen/fdp.h>
@@ -182,7 +183,7 @@ void dumpG(graph_t * g, char *fname, int expMode)
     fp = fopen(fname, "w");
     if (!fp) {
        fprintf(stderr, "Couldn not open %s \n", fname);
-       exit(1);
+       graphviz_exit(1);
     }
     outputGraph(g, fp, expMode);
     fclose(fp);
index 4773a60c3140dd585f86e967b5e9b9510bbabc59..04f39557570d9f178b734dd58038e61401a11250 100644 (file)
@@ -14,6 +14,7 @@
 #define _GNU_SOURCE 1
 #endif
 
+#include <cgraph/exit.h>
 #include <gvc/gvconfig.h>
 
 #include <ctype.h>
@@ -490,7 +491,7 @@ static void config_rescan(GVC_t *gvc, char *config_path)
        f = fopen(config_path,"w");
        if (!f) {
            agerr(AGERR,"failed to open %s for write.\n", config_path);
-           exit(1);
+           graphviz_exit(1);
        }
 
        fprintf(f, "# This file was generated by \"dot -c\" at time of install.\n\n");
index e9ec37ee7a1ed17912a46f1b0c49393570131ce1..ba922b63627ed919205ca5bad4e6b31035f0f11b 100644 (file)
@@ -46,6 +46,7 @@ static uint64_t crc;
 #endif /* HAVE_LIBZ */
 
 #include <assert.h>
+#include <cgraph/exit.h>
 #include <common/const.h>
 #include <common/memory.h>
 #include <gvc/gvplugin_device.h>
@@ -68,7 +69,7 @@ static size_t gvwrite_no_z(GVJ_t * job, const void *s, size_t len) {
            job->output_data = realloc(job->output_data, job->output_data_allocated);
            if (!job->output_data) {
                 (job->common->errorfn) ("memory allocation failure\n");
-               exit(1);
+               graphviz_exit(1);
            }
        }
        memcpy(job->output_data + job->output_data_position, s, len);
@@ -211,7 +212,7 @@ size_t gvwrite (GVJ_t * job, const char *s, size_t len)
            df = realloc(df, dfallocated);
            if (! df) {
                 (job->common->errorfn) ("memory allocation failure\n");
-               exit(1);
+               graphviz_exit(1);
            }
        }
 
@@ -225,14 +226,14 @@ size_t gvwrite (GVJ_t * job, const char *s, size_t len)
            int r = deflate(z, Z_NO_FLUSH);
            if (r != Z_OK) {
                 (job->common->errorfn) ("deflation problem %d\n", r);
-               exit(1);
+               graphviz_exit(1);
            }
 
            if ((olen = z->next_out - df)) {
                ret = gvwrite_no_z(job, df, olen);
                if (ret != olen) {
                     (job->common->errorfn) ("gvwrite_no_z problem %d\n", ret);
-                   exit(1);
+                   graphviz_exit(1);
                }
            }
        }
@@ -240,14 +241,14 @@ size_t gvwrite (GVJ_t * job, const char *s, size_t len)
 #else
         NOTUSED(olen);
        (job->common->errorfn) ("No libz support.\n");
-       exit(1);
+       graphviz_exit(1);
 #endif
     }
     else { /* uncompressed write */
        ret = gvwrite_no_z (job, s, len);
        if (ret != len) {
            (job->common->errorfn) ("gvwrite_no_z problem %d\n", len);
-           exit(1);
+           graphviz_exit(1);
        }
     }
     return len;
@@ -356,14 +357,14 @@ void gvdevice_finalize(GVJ_t * job)
        }
        if (ret != Z_STREAM_END) {
             (job->common->errorfn) ("deflation finish problem %d cnt=%d\n", ret, cnt);
-           exit(1);
+           graphviz_exit(1);
        }
        gvwrite_no_z(job, df, z->next_out - df);
 
        ret = deflateEnd(z);
        if (ret != Z_OK) {
            (job->common->errorfn) ("deflation end problem %d\n", ret);
-           exit(1);
+           graphviz_exit(1);
        }
        out[0] = (unsigned char)crc;
        out[1] = (unsigned char)(crc >> 8);
@@ -376,7 +377,7 @@ void gvdevice_finalize(GVJ_t * job)
        gvwrite_no_z(job, out, sizeof(out));
 #else
        (job->common->errorfn) ("No libz support\n");
-       exit(1);
+       graphviz_exit(1);
 #endif
     }
 
index 11d3701fb9008bfd90d263e1b0a61287fd693685..f2237a34655bed420d731f0e6efaa5b59b546a3e 100644 (file)
@@ -22,6 +22,7 @@
 #include <gvpr/compile.h>
 #include <assert.h>
 #include <cgraph/cgraph.h>
+#include <cgraph/exit.h>
 #include <cgraph/itos.h>
 #include <ast/error.h>
 #include <gvpr/actions.h>
@@ -205,7 +206,7 @@ static char *symName(Expr_t * ex, int op)
        int bytes = vsnprintf(NULL, 0, "<unknown (%d)>", op);
        if (bytes < 0) {
                fprintf(stderr, "%s: vsnprintf failure\n", __func__);
-               exit(EXIT_FAILURE);
+               graphviz_exit(EXIT_FAILURE);
        }
 
        // construct a managed buffer to store this name
index d9d4f7c1f659a6399a095b1e58837435a817f12c..d99fa521fac0826c13d4012dfb4a781c3d684c1f 100644 (file)
@@ -26,6 +26,7 @@
 #include <gvpr/gprstate.h>
 #include <cgraph/agxbuf.h>
 #include <cgraph/cgraph.h>
+#include <cgraph/exit.h>
 #include <common/globals.h>
 #include <ingraphs/ingraphs.h>
 #include <gvpr/compile.h>
@@ -908,7 +909,7 @@ gverrorf (Expr_t *handle, Exdisc_t *discipline, int level, const char *fmt, ...)
     if (level >= ERROR_ERROR) {
        Gpr_t *state = (Gpr_t*)(discipline->user);
        if (state->flags & GV_USE_EXIT)
-            exit(1);
+            graphviz_exit(1);
        else if (state->flags & GV_USE_JUMP)
            longjmp (jbuf, 1);
     }
index f1c2eeda9fcf49d003f8b1dc32e1b9cd8d7f154d..6ec8d87387f16cea53926ce27388106ceee94d0b 100644 (file)
@@ -13,6 +13,7 @@
 #include <string.h>
 #include <unistd.h>
 
+#include <cgraph/exit.h>
 #include <common/memory.h>
 #include <gvc/gvc.h>
 #include <labels/xlabels.h>
@@ -105,14 +106,14 @@ int doxlabel(opts_t * opts)
     if (!(gp = agread(opts->inf))) {
        fprintf(stderr, "%s: %s not a dot file\n", progname,
                opts->infname);
-       exit(1);
+       graphviz_exit(1);
     }
     fclose(opts->inf);
 
     fprintf(stderr, "laying out %s\n", opts->lay);
     if (gvLayout(opts->gvc, gp, opts->lay)) {
        fprintf(stderr, "%s: layout %s failed\n", progname, opts->lay);
-       exit(1);
+       graphviz_exit(1);
     }
 
     fprintf(stderr, "attach labels\n");
@@ -236,7 +237,7 @@ static FILE *openFile(const char *name, const char *mode)
            modestr = "writing";
        fprintf(stderr, "%s: could not open file %s for %s -- %s\n",
                progname, name, modestr, strerror(errno));
-       exit(1);
+       graphviz_exit(1);
     }
     return (fp);
 }
@@ -266,7 +267,7 @@ static void init(int argc, char *argv[], opts_t * opts)
            else {
                fprintf(stderr, "%s: unknown layout %s\n", progname,
                        optarg);
-               exit(1);
+               graphviz_exit(1);
            }
            break;
        case 'T':
@@ -276,7 +277,7 @@ static void init(int argc, char *argv[], opts_t * opts)
            else {
                fprintf(stderr, "%s: unknown format %s\n", progname,
                        optarg);
-               exit(1);
+               graphviz_exit(1);
            }
            break;
        case 'v':
@@ -291,7 +292,7 @@ static void init(int argc, char *argv[], opts_t * opts)
            break;
        default:
            usage(progname);
-           exit(1);
+           graphviz_exit(1);
        }
     }
 
index 8cd663add777d192aaff09425c61d9977ba7fc5d..34a2522fc25f5c44f2f95da8acc86c830d0a9275 100644 (file)
@@ -9,6 +9,7 @@
  *************************************************************************/
 
 #include <math.h>
+#include <cgraph/exit.h>
 #include <neatogen/neato.h>
 #include <pathplan/pathutil.h>
 
@@ -263,7 +264,7 @@ static int find_intersection(vertex *l,
 #ifdef RECORD_INTERSECTS
     if (input->ninters >= MAXINTS) {
        agerr(AGERR, "using too many intersections\n");
-       exit(1);
+       graphviz_exit(1);
     }
 
     ilist[input->ninters].firstv = l;
index 7eb4cd5486d4e6a0352e7a3ed804c8d807027639..4d4e71daac7179b740ac757ebd3545b4383199c3 100644 (file)
@@ -28,6 +28,7 @@
 #include <ortho/maze.h>
 #include <ortho/fPQ.h>
 #include <ortho/ortho.h>
+#include <cgraph/exit.h>
 #include <common/memory.h>
 #include <common/geomprocs.h>
 #include <common/globals.h>
@@ -1439,7 +1440,7 @@ coordOf (cell* cp, snode* np)
     }
     else {
        agerr (AGERR, "Node not adjacent to cell -- Aborting\n");
-       exit(EXIT_FAILURE);
+       graphviz_exit(EXIT_FAILURE);
     }
     return p;
 }
index be2777fd809552bc6b39bee45343cdd221deb505..fc6784ab5794baf47d9f80d55e02ae085844e626 100644 (file)
@@ -16,6 +16,7 @@
 #include <stdbool.h>
 #include <stdlib.h>
 
+#include <cgraph/exit.h>
 #include <common/types.h>
 #include <common/memory.h>
 #include <common/globals.h>
@@ -197,7 +198,7 @@ StressMajorizationSmoother StressMajorizationSmoother2_new(SparseMatrix A, int d
        } else {
          fprintf(stderr,"ideal_dist_scheme value wrong");
          assert(0);
-         exit(1);
+         graphviz_exit(1);
        }
 
        /*      
@@ -239,7 +240,7 @@ StressMajorizationSmoother StressMajorizationSmoother2_new(SparseMatrix A, int d
          } else {
            fprintf(stderr,"ideal_dist_scheme value wrong");
            assert(0);
-           exit(1);
+           graphviz_exit(1);
          }
 
          jw[nz] = ja[l];
index 94fe1d0d0979ff0603ee9f687207d3563f8062a5..284586013e81391e5ae7debb38d839db3e73e3b1 100644 (file)
@@ -102,7 +102,7 @@ SparseMatrix_import_dot (Agraph_t* g, int dim, double **label_sizes, double **x,
   nedges = agnedges (g);
   if (format != FORMAT_CSR && format != FORMAT_COORD) {
     fprintf (stderr, "Format %d not supported\n", format);
-    exit (1);
+    graphviz_exit(1);
   }
 
   /* Assign node ids */
index 4f4d51859adb7d85d13bb1073c5a8d39b35bc412..a76fbb61739abcea72529c33d7554969c12896fb 100644 (file)
@@ -2612,7 +2612,7 @@ SparseMatrix SparseMatrix_distance_matrix_khops(int khops, SparseMatrix D0, int
       fprintf(stderr,"{%d,%d}=%f,",94,list[j],dist[list[j]]);
     }
     fprintf(stderr,"\n");
-    exit(1);
+    graphviz_exit(1);
 
     */
 
index f481e33e76fcd68ae1d3ef733899852bfac33025..37be67e80b0089a2879ce65687f54b854452a657 100644 (file)
@@ -21,6 +21,7 @@
  */
 #ifndef STANDALONE
 #include "cgraph.h"
+#include "exit.h"
 #include "globals.h"
 #include "logic.h"
 #include "arith.h"
index 0de8db49fe97cddf7e0eab7087f85d6b6bd6780a..c3e344fedd149b81228b7e62c79b32a49aea9d9f 100644 (file)
@@ -33,6 +33,7 @@
 #endif
 #include <errno.h>
 
+#include <cgraph/exit.h>
 #include <gvc/gvplugin_device.h>
 
 #include <cairo.h>
@@ -102,7 +103,7 @@ static void handle_client_message(GVJ_t * job, XClientMessageEvent * cmev)
     window = (window_t *)job->window;
     if (cmev->format == 32
         && (Atom) cmev->data.l[0] == window->wm_delete_window_atom)
-        exit(0);
+        graphviz_exit(0);
 }
 
 static bool handle_keypress(GVJ_t *job, XKeyEvent *kev)
index 8d8b198131b0b345606217787c7955ec89f7e3b0..e2423a15105b9bdfde47db03abb1eb0fe4147d25 100644 (file)
@@ -36,6 +36,7 @@
 #include <fcntl.h>
 #endif
 
+#include <cgraph/exit.h>
 #include <gvc/gvplugin_device.h>
 
 #include <cairo.h>
@@ -89,7 +90,7 @@ static void handle_client_message(GVJ_t * job, XClientMessageEvent * cmev)
     window = job->window;
     if (cmev->format == 32
         && (Atom) cmev->data.l[0] == window->wm_delete_window_atom)
-        exit(0);
+        graphviz_exit(0);
 }
 
 static bool handle_keypress(GVJ_t *job, XKeyEvent *kev)
index 96d4cc606569d5b4bb8f25dc8313cbc8a88b1182..9743e5edfb5851de1a8c32968c6e921568c05986 100644 (file)
@@ -17,6 +17,8 @@
 #include <sys/stat.h>
 #include <fcntl.h>
 
+#include <cgraph/exit.h>
+
 static int openF(char *fname)
 {
     int fd = open(fname, O_RDONLY);
@@ -24,7 +26,7 @@ static int openF(char *fname)
     if (fd < 0) {
        fprintf(stderr, "Could not open %s for reading: %s\n\n", fname,
                strerror(errno));
-       exit(1);
+       graphviz_exit(1);
     }
     return fd;
 }
@@ -51,7 +53,7 @@ main(int argc, char *argv[])
 
     if (argc != 3) {
        fprintf(stderr, "Usage: %s <file1> <file2>\n", argv[0]);
-       exit(1);
+       graphviz_exit(1);
     }
 
     f1 = openF(argv[1]);
@@ -92,6 +94,6 @@ main(int argc, char *argv[])
     } else
        xval = 0;
 
-    exit(xval);
+    graphviz_exit(xval);
 
 }
index 0a739eaa7edf7e0004fc8776cf5ec0d5af551cb3..c001ebac40044fb88f7f6f75eb555fbca41ac461 100644 (file)
@@ -12,6 +12,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 
+#include <cgraph/exit.h>
+
 void find_intersection(struct vertex *l, struct vertex *m,
                       struct intersection ilist[], struct data *input);
 static int gt(const void *a, const void *b);
@@ -73,7 +75,7 @@ void find_ints(struct vertex vertex_list[],
                if ((tempa = templ->active) == NULL) {
                    fprintf(stderr,
                            "\n***ERROR***\n trying to delete a non line\n");
-                   exit(1);
+                   graphviz_exit(1);
                }
                if (all.number == 1)
                    all.final = all.first = NULL;       /* delete the line */
index d72f4d091f8f54452ae8b900b4e630259353d2b8..d58faa32df6dd6fb5fa02f23da5a34cae2f00d23 100644 (file)
@@ -9,6 +9,7 @@
  *************************************************************************/
 
 #include <cgraph/unreachable.h>
+#include <cgraph/exit.h>
 #include <math.h>
 #include <stdio.h>
 #include "simple.h"
@@ -181,7 +182,7 @@ void find_intersection(struct vertex *l,
 
     if (input->ninters >= MAXINTS) {
        fprintf(stderr, "\n**ERROR**\n using too many intersections\n");
-       exit(1);
+       graphviz_exit(1);
     }
 
     ilist[input->ninters].firstv = l;