inperror.c
来自「ngspice又一个电子CAD仿真软件代码.功能更全」· C语言 代码 · 共 54 行
C
54 行
/**********Copyright 1990 Regents of the University of California. All rights reserved.Author: 1985 Thomas L. Quarles**********//* * provide the error message appropriate for the given error code */#include "ngspice.h"#include <stdio.h>#ifdef HAVE_STRING_H#include <string.h>#endif#include "fteext.h"#include "ifsim.h"#include "iferrmsg.h"#include "sperror.h"#include "inp.h"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;}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?