From: ellson Date: Fri, 1 Aug 2008 17:23:29 +0000 (+0000) Subject: continue to recognize dot2gxl and gxl2dot as possible command names for automatic... X-Git-Tag: LAST_LIBGRAPH~32^2~3722 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=cffe65cfdbbf04d48c69e331b28a11fae39966f4;p=graphviz continue to recognize dot2gxl and gxl2dot as possible command names for automatic conversion direction determination fix an unrelated crash --- diff --git a/cmd/tools/cvtgxl.c b/cmd/tools/cvtgxl.c index 487866c32..35a0a7501 100644 --- a/cmd/tools/cvtgxl.c +++ b/cmd/tools/cvtgxl.c @@ -19,15 +19,15 @@ * Written by Emden R. Gansner and Krishnam Pericherla */ -#include - +#include #ifdef HAVE_GETOPT_H #include #else #include "compat_getopt.h" #endif -#include +#include "convert.h" +#include "ingraphs.h" typedef enum { Unset, ToGV, ToGXL } mode; @@ -123,20 +123,16 @@ static void checkInput(void) static void setAction(void) { - switch (*CmdName) { - case 'd': - case 'D': + if (tolower(CmdName[0]) == 'd') act = ToGXL; - break; - case 'g': - case 'G': - act = ToGV; - break; - default: - if (Files) - checkInput(); - break; + else if (tolower(CmdName[0]) == 'g') { + if (tolower(CmdName[1]) == 'v') + act = ToGXL; + else + act = ToGV; } + else if (Files) + checkInput(); if (act == Unset) { fprintf(stderr, "Cannot determine conversion type\n"); diff --git a/cmd/tools/gv2gxl.c b/cmd/tools/gv2gxl.c index 1e245d05b..e2eccdd62 100644 --- a/cmd/tools/gv2gxl.c +++ b/cmd/tools/gv2gxl.c @@ -646,7 +646,7 @@ static void writePort(Agedge_t * e, FILE * gxlFile, char *name) char *val; val = agget(e, name); - if (val[0]) { + if (val && val[0]) { tabover(gxlFile); fprintf(gxlFile, "\t\n", name); tabover(gxlFile);