fprintf (stderr, "-r arg %s must be a non-negative integer - ignored\n", optarg);
break;
case 'T':
- if ((*optarg == 'g') && ((*(optarg+1) == 'v')))
+ if (!strcmp(optarg, "gv"))
opts->fmt = FMT_GV;
- else if ((*optarg == 's') && (!strcmp(optarg+1,"imple")))
+ else if (!strcmp(optarg,"simple"))
opts->fmt = FMT_SIMPLE;
else
fprintf (stderr, "-T arg %s must be \"gv\" or \"simple\" - ignored\n", optarg);
#define elementsof(x) (sizeof(x)/sizeof(x[0]))
#define newof(p,t,n,x) ((p)?(t*)realloc((char*)(p),sizeof(t)*(n)+(x)):(t*)calloc(1,sizeof(t)*(n)+(x)))
#define oldof(p,t,n,x) ((p)?(t*)realloc((char*)(p),sizeof(t)*(n)+(x)):(t*)malloc(sizeof(t)*(n)+(x)))
-#define streq(a,b) (*(a)==*(b)&&!strcmp(a,b))
-#define strneq(a,b,n) (*(a)==*(b)&&!strncmp(a,b,n))
+#define streq(a,b) (!strcmp(a,b))
+#define strneq(a,b,n) (!strncmp(a,b,n))
#define memzero(b,n) memset(b,0,n)
extern char *pathpath(char *, const char *, const char *, int);
{
char *p = agget(g, "outputorder");
if (p) {
- char c = *p;
- if ((c == 'n') && !strcmp(p + 1, "odesfirst"))
+ if (!strcmp(p, "nodesfirst"))
return EMIT_SORTED;
- if ((c == 'e') && !strcmp(p + 1, "dgesfirst"))
+ if (!strcmp(p, "edgesfirst"))
return EMIT_EDGE_SORTED;
}
return 0;
cache_name_idx = inkpot->cache[i].name_idx;
cache_color = &TAB_STRINGS[TAB_NAMES[cache_name_idx].string_idx];
- if (cache_color[0] != color[0] || (strcmp(cache_color, color) != 0))
+ if (strcmp(cache_color, color) != 0)
continue;
/* found */
for (i=0; i < inkpot->active_schemes; i++) {
j = inkpot->scheme_list[i];
p = &TAB_STRINGS[TAB_ICOLORS[j].string_idx];
- if (*p != *s || strcmp(p, s) != 0)
+ if (strcmp(p, s) != 0)
continue;
/* FIXME - deal with subschemes */
first = TAB_ICOLORS[j].range_idx;
val = agxget(obj, a);
if (!val)
return emptystring;
- if (a->name[0] == 'l' && strcmp(a->name, "label") == 0 && aghtmlstr(val)) {
+ if (strcmp(a->name, "label") == 0 && aghtmlstr(val)) {
len = strlen(val);
hs = (char*)malloc(len + 3);
hs[0] = '<';
int len;
char *hs;
- if (a->name[0] == 'l' && val[0] == '<' && strcmp(a->name, "label") == 0) {
+ if (strcmp(a->name, "label") == 0 && val[0] == '<') {
len = strlen(val);
if (val[len-1] == '>') {
hs = strdup(val+1);
if (!n)
return false;
// removal of the protonode is not permitted
- if (agnameof(n)[0] == '\001' && strcmp (agnameof(n), "\001proto") ==0)
+ if (strcmp (agnameof(n), "\001proto") ==0)
return false;
agdelete(agraphof(n), n);
return true;
if (!e)
return false;
// removal of the protoedge is not permitted
- if ((agnameof(aghead(e))[0] == '\001' && strcmp (agnameof(aghead(e)), "\001proto") == 0)
- || (agnameof(agtail(e))[0] == '\001' && strcmp (agnameof(agtail(e)), "\001proto") == 0))
+ if (strcmp (agnameof(aghead(e)), "\001proto") == 0
+ || strcmp (agnameof(agtail(e)), "\001proto") == 0)
return false;
agdelete(agroot(agraphof(aghead(e))), e);
return true;
int len;
char *hs;
- if (a->name[0] == 'l' && val[0] == '<' && strcmp(a->name, "label") == 0) {
+ if (strcmp(a->name, "label") == 0 && val[0] == '<') {
len = strlen(val);
if (val[len-1] == '>') {
hs = strdup(val+1);