char *INPerror(int type) { const char *val; char *ebuf; /*CDHW Lots of things set errMsg but it is never used so let's hack it in CDHW*/ if ( errMsg ) { val = errMsg; errMsg = NULL;} else /*CDHW end of hack CDHW*/ val = SPerror(type); if (!val) return NULL; #ifdef HAVE_ASPRINTF if (errRtn) asprintf(&ebuf, "%s detected in routine \"%s\"\n", val, errRtn); else asprintf(&ebuf, "%s\n", val); #else /* ~ HAVE_ASPRINTF */ if (errRtn){ ebuf = (char *) tmalloc(strlen(val) + strlen(errRtn) + 25); sprintf(ebuf, "%s detected in routine \"%s\"\n", val, errRtn); } else{ ebuf = (char *) tmalloc(strlen(val) + 2); sprintf(ebuf, "%s\n", val); } #endif /* HAVE_ASPRINTF */ FREE(errMsg); /* pn: really needed ? */ return ebuf; }
char *INPerror(int type) { char *val; char *ebuf; /*CDHW Lots of things set errMsg but it is never used so let's hack it in CDHW*/ if ( errMsg ) { val = errMsg; errMsg = NULL; } else /*CDHW end of hack CDHW*/ val = copy(SPerror(type)); if (!val) return NULL; if (errRtn) ebuf = tprintf("%s detected in routine \"%s\"\n", val, errRtn); else ebuf = tprintf("%s\n", val); tfree(val); return ebuf; }