prevent string overflow by adding the string length
to the cp_getvar parameters. Used only with CP_STRING
This commit is contained in:
parent
7592644400
commit
09c876550f
|
|
@ -38,7 +38,7 @@ com_ahelp(wordlist *wl)
|
|||
env |= E_NOPLOTS;
|
||||
|
||||
/* determine level */
|
||||
if (cp_getvar("level", CP_STRING, slevel)) {
|
||||
if (cp_getvar("level", CP_STRING, slevel, sizeof(slevel))) {
|
||||
switch (*slevel) {
|
||||
case 'b': level = 1;
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ com_display(wordlist *wl)
|
|||
dvs = TMALLOC(struct dvec *, len);
|
||||
for (d = plot_cur->pl_dvecs, i = 0; d; d = d->v_next, i++)
|
||||
dvs[i] = d;
|
||||
if (!cp_getvar("nosort", CP_BOOL, NULL))
|
||||
if (!cp_getvar("nosort", CP_BOOL, NULL, 0))
|
||||
qsort(dvs, (size_t) len, sizeof(struct dvec *), dcomp);
|
||||
|
||||
out_printf("Title: %s\n", plot_cur->pl_title);
|
||||
|
|
|
|||
|
|
@ -76,9 +76,9 @@ com_fft(wordlist *wl)
|
|||
|
||||
win = TMALLOC(double, length);
|
||||
maxt = time[length-1];
|
||||
if (!cp_getvar("specwindow", CP_STRING, window))
|
||||
if (!cp_getvar("specwindow", CP_STRING, window, sizeof(window)))
|
||||
strcpy(window, "hanning");
|
||||
if (!cp_getvar("specwindoworder", CP_NUM, &order))
|
||||
if (!cp_getvar("specwindoworder", CP_NUM, &order, 0))
|
||||
order = 2;
|
||||
if (order < 2)
|
||||
order = 2;
|
||||
|
|
@ -296,9 +296,9 @@ com_psd(wordlist *wl)
|
|||
|
||||
win = TMALLOC(double, length);
|
||||
maxt = time[length-1];
|
||||
if (!cp_getvar("specwindow", CP_STRING, window))
|
||||
if (!cp_getvar("specwindow", CP_STRING, window, sizeof(window)))
|
||||
strcpy(window, "hanning");
|
||||
if (!cp_getvar("specwindoworder", CP_NUM, &order))
|
||||
if (!cp_getvar("specwindoworder", CP_NUM, &order, 0))
|
||||
order = 2;
|
||||
if (order < 2)
|
||||
order = 2;
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ com_hardcopy(wordlist *wl)
|
|||
int hc_button;
|
||||
int foundit;
|
||||
|
||||
if (!cp_getvar("hcopydev", CP_STRING, device))
|
||||
if (!cp_getvar("hcopydev", CP_STRING, device, sizeof(device)))
|
||||
*device = '\0';
|
||||
|
||||
if (wl) {
|
||||
|
|
@ -48,7 +48,7 @@ com_hardcopy(wordlist *wl)
|
|||
tempf = TRUE;
|
||||
}
|
||||
|
||||
if (!cp_getvar("hcopydevtype", CP_STRING, buf))
|
||||
if (!cp_getvar("hcopydevtype", CP_STRING, buf, sizeof(buf)))
|
||||
devtype = "postscript";
|
||||
else
|
||||
devtype = buf;
|
||||
|
|
@ -161,7 +161,7 @@ com_hardcopy(wordlist *wl)
|
|||
if (*device) {
|
||||
#ifdef SYSTEM_PLOT5LPR
|
||||
if (!strcmp(devtype, "plot5") || !strcmp(devtype, "MFB")) {
|
||||
if (!cp_getvar("lprplot5", CP_STRING, format))
|
||||
if (!cp_getvar("lprplot5", CP_STRING, format, size_of(format)))
|
||||
strcpy(format, SYSTEM_PLOT5LPR);
|
||||
(void) sprintf(buf, format, device, fname);
|
||||
fprintf(cp_out, "Printing %s on the %s printer.\n", fname, device);
|
||||
|
|
@ -172,7 +172,7 @@ com_hardcopy(wordlist *wl)
|
|||
#ifdef SYSTEM_PSLPR
|
||||
if (!printed && !strcmp(devtype, "postscript")) {
|
||||
/* note: check if that was a postscript printer XXX */
|
||||
if (!cp_getvar("lprps", CP_STRING, format))
|
||||
if (!cp_getvar("lprps", CP_STRING, format, size_of(format)))
|
||||
strcpy(format, SYSTEM_PSLPR);
|
||||
(void) sprintf(buf, format, device, fname);
|
||||
fprintf(cp_out, "Printing %s on the %s printer.\n", fname, device);
|
||||
|
|
|
|||
|
|
@ -235,7 +235,7 @@ static int count;
|
|||
void
|
||||
com_showmod(wordlist *wl)
|
||||
{
|
||||
if (cp_getvar("altshow", CP_BOOL, NULL))
|
||||
if (cp_getvar("altshow", CP_BOOL, NULL, 0))
|
||||
all_show(wl, 1);
|
||||
else
|
||||
all_show_old(wl, 1);
|
||||
|
|
@ -245,7 +245,7 @@ com_showmod(wordlist *wl)
|
|||
void
|
||||
com_show(wordlist *wl)
|
||||
{
|
||||
if (cp_getvar("altshow", CP_BOOL, NULL))
|
||||
if (cp_getvar("altshow", CP_BOOL, NULL, 0))
|
||||
all_show(wl, 0);
|
||||
else
|
||||
all_show_old(wl, 0);
|
||||
|
|
@ -273,7 +273,7 @@ all_show(wordlist *wl, int mode)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!cp_getvar("width", CP_NUM, &screen_width))
|
||||
if (!cp_getvar("width", CP_NUM, &screen_width, 0))
|
||||
screen_width = DEF_WIDTH;
|
||||
count = (screen_width - LEFT_WIDTH) / (DEV_WIDTH + 1);
|
||||
count = 1;
|
||||
|
|
@ -435,7 +435,7 @@ all_show_old(wordlist *wl, int mode)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!cp_getvar("width", CP_NUM, &screen_width))
|
||||
if (!cp_getvar("width", CP_NUM, &screen_width, 0))
|
||||
screen_width = DEF_WIDTH;
|
||||
count = (screen_width - LEFT_WIDTH) / (DEV_WIDTH + 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -123,11 +123,11 @@ com_diff(wordlist *wl)
|
|||
wordlist *tw;
|
||||
char numbuf[BSIZE_SP], numbuf2[BSIZE_SP], numbuf3[BSIZE_SP], numbuf4[BSIZE_SP]; /* For printnum */
|
||||
|
||||
if (!cp_getvar("diff_vntol", CP_REAL, &vntol))
|
||||
if (!cp_getvar("diff_vntol", CP_REAL, &vntol, 0))
|
||||
vntol = 1.0e-6;
|
||||
if (!cp_getvar("diff_abstol", CP_REAL, &abstol))
|
||||
if (!cp_getvar("diff_abstol", CP_REAL, &abstol, 0))
|
||||
abstol = 1.0e-12;
|
||||
if (!cp_getvar("diff_reltol", CP_REAL, &reltol))
|
||||
if (!cp_getvar("diff_reltol", CP_REAL, &reltol, 0))
|
||||
reltol = 0.001;
|
||||
|
||||
/* Let's try to be clever about defaults. This code is ugly. */
|
||||
|
|
|
|||
|
|
@ -65,11 +65,11 @@ fourier(wordlist *wl, struct plot *current_plot)
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (!cp_getvar("nfreqs", CP_NUM, &nfreqs) || nfreqs < 1)
|
||||
if (!cp_getvar("nfreqs", CP_NUM, &nfreqs, 0) || nfreqs < 1)
|
||||
nfreqs = 10;
|
||||
if (!cp_getvar("polydegree", CP_NUM, &polydegree) || polydegree < 0)
|
||||
if (!cp_getvar("polydegree", CP_NUM, &polydegree, 0) || polydegree < 0)
|
||||
polydegree = 1;
|
||||
if (!cp_getvar("fourgridsize", CP_NUM, &fourgridsize) || fourgridsize < 1)
|
||||
if (!cp_getvar("fourgridsize", CP_NUM, &fourgridsize, 0) || fourgridsize < 1)
|
||||
fourgridsize = DEF_FOURGRIDSIZE;
|
||||
|
||||
time = current_plot->pl_scale;
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ static int hcopygraphid;
|
|||
|
||||
int GL_Init(void)
|
||||
{
|
||||
if (!cp_getvar("hcopyscale", CP_STRING, psscale)) {
|
||||
if (!cp_getvar("hcopyscale", CP_STRING, psscale, 32)) {
|
||||
scale = 1.0;
|
||||
} else {
|
||||
sscanf(psscale, "%lf", &scale);
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ inp_list(FILE *file, struct card *deck, struct card *extras, int type)
|
|||
file = cp_more;
|
||||
}
|
||||
|
||||
renumber = cp_getvar("renumber", CP_BOOL, NULL);
|
||||
renumber = cp_getvar("renumber", CP_BOOL, NULL, 0);
|
||||
|
||||
if (type == LS_LOGICAL) {
|
||||
top1:
|
||||
|
|
@ -588,7 +588,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
|||
cp_vset("pretemp", CP_REAL, &temperature_value);
|
||||
}
|
||||
if (ft_ngdebug) {
|
||||
cp_getvar("pretemp", CP_REAL, &testemp);
|
||||
cp_getvar("pretemp", CP_REAL, &testemp, 0);
|
||||
printf("test temperature %f\n", testemp);
|
||||
}
|
||||
|
||||
|
|
@ -600,7 +600,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
|||
SetAnalyse("Prepare Deck", 0);
|
||||
#endif
|
||||
/* Now expand subcircuit macros and substitute numparams.*/
|
||||
if (!cp_getvar("nosubckt", CP_BOOL, NULL))
|
||||
if (!cp_getvar("nosubckt", CP_BOOL, NULL, 0))
|
||||
if ((deck->nextcard = inp_subcktexpand(deck->nextcard)) == NULL) {
|
||||
line_free(realdeck, TRUE);
|
||||
line_free(deck->actualLine, TRUE);
|
||||
|
|
@ -723,7 +723,7 @@ inp_spsource(FILE *fp, bool comfile, char *filename, bool intfile)
|
|||
}
|
||||
|
||||
if (ciprefix(".meas", dd->line)) {
|
||||
if (cp_getvar("autostop", CP_BOOL, NULL)) {
|
||||
if (cp_getvar("autostop", CP_BOOL, NULL, 0)) {
|
||||
if (strstr(dd->line, " max ") ||
|
||||
strstr(dd->line, " min ") ||
|
||||
strstr(dd->line, " avg ") ||
|
||||
|
|
@ -876,7 +876,7 @@ inp_dodeck(
|
|||
/*PN FTESTATS*/
|
||||
ft_curckt->FTEstats = TMALLOC(FTESTATistics, 1);
|
||||
}
|
||||
noparse = cp_getvar("noparse", CP_BOOL, NULL);
|
||||
noparse = cp_getvar("noparse", CP_BOOL, NULL, 0);
|
||||
|
||||
|
||||
/* We check preliminary for the scale option. This special processing
|
||||
|
|
@ -944,12 +944,12 @@ inp_dodeck(
|
|||
out_init();
|
||||
/* if_inpdeck() may return NULL upon error */
|
||||
if (ckt) {
|
||||
if (cp_getvar("warn", CP_NUM, &warn))
|
||||
if (cp_getvar("warn", CP_NUM, &warn, 0))
|
||||
ckt->CKTsoaCheck = warn;
|
||||
else
|
||||
ckt->CKTsoaCheck = 0;
|
||||
|
||||
if (cp_getvar("maxwarns", CP_NUM, &maxwarns))
|
||||
if (cp_getvar("maxwarns", CP_NUM, &maxwarns, 0))
|
||||
ckt->CKTsoaMaxWarns = maxwarns;
|
||||
else
|
||||
ckt->CKTsoaMaxWarns = 5;
|
||||
|
|
@ -1017,7 +1017,7 @@ inp_dodeck(
|
|||
}
|
||||
|
||||
/* Only print out netlist if brief is FALSE */
|
||||
if (!cp_getvar("brief", CP_BOOL, NULL)) {
|
||||
if (!cp_getvar("brief", CP_BOOL, NULL, 0)) {
|
||||
/* output deck */
|
||||
out_printf("\nProcessed Netlist\n");
|
||||
out_printf("=================\n");
|
||||
|
|
@ -1137,7 +1137,7 @@ com_edit(wordlist *wl)
|
|||
bool inter, permfile;
|
||||
char buf[BSIZE_SP];
|
||||
|
||||
if (!cp_getvar("interactive", CP_BOOL, NULL)) {
|
||||
if (!cp_getvar("interactive", CP_BOOL, NULL, 0)) {
|
||||
fprintf(cp_err,
|
||||
"Warning: `edit' is disabled because 'interactive' has not been set.\n"
|
||||
" perhaps you want to 'set interactive'\n");
|
||||
|
|
@ -1357,7 +1357,7 @@ doedit(char *filename)
|
|||
{
|
||||
char buf[BSIZE_SP], buf2[BSIZE_SP], *editor;
|
||||
|
||||
if (cp_getvar("editor", CP_STRING, buf2)) {
|
||||
if (cp_getvar("editor", CP_STRING, buf2, 512)) {
|
||||
editor = buf2;
|
||||
} else {
|
||||
if ((editor = getenv("EDITOR")) == NULL) {
|
||||
|
|
|
|||
|
|
@ -491,7 +491,7 @@ ngspice_compat_mode(void)
|
|||
{
|
||||
char behaviour[80];
|
||||
|
||||
if (cp_getvar("ngbehavior", CP_STRING, behaviour)) {
|
||||
if (cp_getvar("ngbehavior", CP_STRING, behaviour, 80)) {
|
||||
if (strcasecmp(behaviour, "all") == 0)
|
||||
return COMPATMODE_ALL;
|
||||
if (strcasecmp(behaviour, "hs") == 0)
|
||||
|
|
@ -599,7 +599,7 @@ inp_readall(FILE *fp, char *dir_name, bool comfile, bool intfile, bool *expr_w_t
|
|||
inp_fix_gnd_name(working);
|
||||
inp_chk_for_multi_in_vcvs(working, &rv. line_number);
|
||||
|
||||
if (cp_getvar("addcontrol", CP_BOOL, NULL))
|
||||
if (cp_getvar("addcontrol", CP_BOOL, NULL, 0))
|
||||
inp_add_control_section(working, &rv . line_number);
|
||||
#ifndef XSPICE
|
||||
inp_poly_err(working);
|
||||
|
|
@ -1144,7 +1144,7 @@ inp_pathresolve(const char *name)
|
|||
#if defined(__MINGW32__) || defined(_MSC_VER)
|
||||
|
||||
/* If variable 'mingwpath' is set: convert mingw /d/... to d:/... */
|
||||
if (cp_getvar("mingwpath", CP_BOOL, NULL) && name[0] == DIR_TERM_LINUX && isalpha_c(name[1]) && name[2] == DIR_TERM_LINUX) {
|
||||
if (cp_getvar("mingwpath", CP_BOOL, NULL, 0) && name[0] == DIR_TERM_LINUX && isalpha_c(name[1]) && name[2] == DIR_TERM_LINUX) {
|
||||
strcpy(buf, name);
|
||||
buf[0] = buf[1];
|
||||
buf[1] = ':';
|
||||
|
|
@ -1158,7 +1158,7 @@ inp_pathresolve(const char *name)
|
|||
return copy(name);
|
||||
|
||||
/* fail if this was an absolute filename or if there is no sourcepath var */
|
||||
if (is_absolute_pathname(name) || !cp_getvar("sourcepath", CP_LIST, &v))
|
||||
if (is_absolute_pathname(name) || !cp_getvar("sourcepath", CP_LIST, &v, 0))
|
||||
return NULL;
|
||||
|
||||
for (; v; v = v->va_next) {
|
||||
|
|
@ -1512,7 +1512,7 @@ inp_add_control_section(struct card *deck, int *line_number)
|
|||
found_run = TRUE;
|
||||
}
|
||||
|
||||
if (cp_getvar("rawfile", CP_STRING, rawfile)) {
|
||||
if (cp_getvar("rawfile", CP_STRING, rawfile, 1000)) {
|
||||
line = tprintf("write %s", rawfile);
|
||||
prev_card = insert_new_line(prev_card, line, (*line_number)++, 0);
|
||||
}
|
||||
|
|
@ -1531,7 +1531,7 @@ inp_add_control_section(struct card *deck, int *line_number)
|
|||
if (op_line)
|
||||
deck = insert_new_line(deck, copy(op_line), (*line_number)++, 0);
|
||||
|
||||
if (cp_getvar("rawfile", CP_STRING, rawfile)) {
|
||||
if (cp_getvar("rawfile", CP_STRING, rawfile, 1000)) {
|
||||
line = tprintf("write %s", rawfile);
|
||||
deck = insert_new_line(deck, line, (*line_number)++, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -239,7 +239,7 @@ do_measure(
|
|||
}
|
||||
|
||||
/* don't allow autostop if no .meas commands are given in the input file */
|
||||
if ((cp_getvar("autostop", CP_BOOL, NULL)) && (ft_curckt->ci_meas == NULL)) {
|
||||
if ((cp_getvar("autostop", CP_BOOL, NULL, 0)) && (ft_curckt->ci_meas == NULL)) {
|
||||
fprintf(cp_err, "\nWarning: No .meas commands found!\n");
|
||||
fprintf(cp_err, " Option autostop is not available, ignored!\n\n");
|
||||
cp_remvar("autostop");
|
||||
|
|
@ -447,7 +447,7 @@ check_autostop(char* what)
|
|||
{
|
||||
bool flag = FALSE;
|
||||
|
||||
if (cp_getvar("autostop", CP_BOOL, NULL))
|
||||
if (cp_getvar("autostop", CP_BOOL, NULL, 0))
|
||||
flag = do_measure(what, TRUE);
|
||||
|
||||
return flag;
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ com_quit(wordlist *wl)
|
|||
bool noask =
|
||||
(wl && wl->wl_word && 1 == sscanf(wl->wl_word, "%d", &exitcode)) ||
|
||||
(wl && wl->wl_word && cieq(wl->wl_word, "noask")) ||
|
||||
!cp_getvar("askquit", CP_BOOL, NULL);
|
||||
!cp_getvar("askquit", CP_BOOL, NULL, 0);
|
||||
|
||||
/* update screen and reset terminal */
|
||||
gr_clean();
|
||||
|
|
|
|||
|
|
@ -359,7 +359,7 @@ nupa_done(void)
|
|||
|
||||
if (nerrors) {
|
||||
bool is_interactive = FALSE;
|
||||
if (cp_getvar("interactive", CP_BOOL, NULL))
|
||||
if (cp_getvar("interactive", CP_BOOL, NULL, 0))
|
||||
is_interactive = TRUE;
|
||||
printf(" Copies=%d Evals=%d Placeholders=%ld Symbols=%d Errors=%d\n",
|
||||
linecountS, evalcountS, placeholder, dictsize, nerrors);
|
||||
|
|
|
|||
|
|
@ -156,7 +156,7 @@ inp_nutsource(FILE *fp, bool comfile, char *filename)
|
|||
* fix the case before we do this but after we
|
||||
* deal with the commands.
|
||||
*/
|
||||
if (!cp_getvar("nosubckt", CP_BOOL, NULL))
|
||||
if (!cp_getvar("nosubckt", CP_BOOL, NULL, 0))
|
||||
deck->nextcard = inp_subcktexpand(deck->nextcard);
|
||||
deck->actualLine = realdeck;
|
||||
nutinp_dodeck(deck, tt, wl, FALSE, options, filename);
|
||||
|
|
|
|||
|
|
@ -154,11 +154,11 @@ beginPlot(JOB *analysisPtr, CKTcircuit *circuitPtr, char *cktName, char *analNam
|
|||
/*end saj*/
|
||||
|
||||
/* Check to see if we want to print informational data. */
|
||||
if (cp_getvar("printinfo", CP_BOOL, NULL))
|
||||
if (cp_getvar("printinfo", CP_BOOL, NULL, 0))
|
||||
fprintf(cp_err, "(debug printing enabled)\n");
|
||||
|
||||
/* Check to see if we want to save only interpolated data. */
|
||||
if (cp_getvar("interp", CP_BOOL, NULL)) {
|
||||
if (cp_getvar("interp", CP_BOOL, NULL, 0)) {
|
||||
interpolated = TRUE;
|
||||
fprintf(cp_out, "Warning: Interpolated raw file data!\n\n");
|
||||
}
|
||||
|
|
@ -1292,7 +1292,7 @@ OUTerror(int flags, char *format, IFuid *names)
|
|||
char buf[BSIZE_SP], *s, *bptr;
|
||||
int nindex = 0;
|
||||
|
||||
if ((flags == ERR_INFO) && cp_getvar("printinfo", CP_BOOL, NULL))
|
||||
if ((flags == ERR_INFO) && cp_getvar("printinfo", CP_BOOL, NULL, 0))
|
||||
return;
|
||||
|
||||
for (m = msgs; m->flag; m++)
|
||||
|
|
@ -1325,7 +1325,7 @@ OUTerrorf(int flags, const char *format, ...)
|
|||
struct mesg *m;
|
||||
va_list args;
|
||||
|
||||
if ((flags == ERR_INFO) && cp_getvar("printinfo", CP_BOOL, NULL))
|
||||
if ((flags == ERR_INFO) && cp_getvar("printinfo", CP_BOOL, NULL, 0))
|
||||
return;
|
||||
|
||||
for (m = msgs; m->flag; m++)
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s
|
|||
|
||||
/* Make sure the margin is correct */
|
||||
omargin = margin;
|
||||
novalue = cp_getvar("noasciiplotvalue", CP_BOOL, NULL);
|
||||
novalue = cp_getvar("noasciiplotvalue", CP_BOOL, NULL, 0);
|
||||
if (!novalue && !vec_eq(xscale, vecs))
|
||||
margin *= 2;
|
||||
else
|
||||
|
|
@ -67,16 +67,16 @@ ft_agraf(double *xlims, double *ylims, struct dvec *xscale, struct plot *plot, s
|
|||
if ((xscale->v_gridtype == GRID_YLOG) || (xscale->v_gridtype == GRID_LOGLOG))
|
||||
ylogscale = TRUE;
|
||||
|
||||
if (!cp_getvar("width", CP_NUM, &maxy))
|
||||
if (!cp_getvar("width", CP_NUM, &maxy, 0))
|
||||
maxy = DEF_WIDTH;
|
||||
|
||||
if (!cp_getvar("height", CP_NUM, &height))
|
||||
if (!cp_getvar("height", CP_NUM, &height, 0))
|
||||
height = DEF_HEIGHT;
|
||||
|
||||
if (ft_nopage)
|
||||
nobreakp = TRUE;
|
||||
else
|
||||
nobreakp = cp_getvar("nobreak", CP_BOOL, NULL);
|
||||
nobreakp = cp_getvar("nobreak", CP_BOOL, NULL, 0);
|
||||
|
||||
maxy -= (margin + FUDGE);
|
||||
maxx = xscale->v_length;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ ft_gnuplot(double *xlims, double *ylims, char *filename, char *title, char *xlab
|
|||
|
||||
extrange = 0.05 * (ylims[1] - ylims[0]);
|
||||
|
||||
if (!cp_getvar("gnuplot_terminal", CP_STRING, terminal)) {
|
||||
if (!cp_getvar("gnuplot_terminal", CP_STRING, terminal, sizeof(terminal))) {
|
||||
terminal_type = 1;
|
||||
} else {
|
||||
terminal_type = 1;
|
||||
|
|
@ -85,11 +85,11 @@ ft_gnuplot(double *xlims, double *ylims, char *filename, char *title, char *xlab
|
|||
terminal_type = 2;
|
||||
}
|
||||
|
||||
if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth))
|
||||
if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth, 0))
|
||||
linewidth = 1;
|
||||
if (linewidth < 1) linewidth = 1;
|
||||
|
||||
if (!cp_getvar("pointstyle", CP_STRING, pointstyle)) {
|
||||
if (!cp_getvar("pointstyle", CP_STRING, pointstyle, sizeof(pointstyle))) {
|
||||
markers = FALSE;
|
||||
} else {
|
||||
if (cieq(pointstyle,"markers"))
|
||||
|
|
@ -324,9 +324,9 @@ ft_writesimple(double *xlims, double *ylims, char *filename, char *title, char *
|
|||
NG_IGNORE(gridtype);
|
||||
NG_IGNORE(plottype);
|
||||
|
||||
appendwrite = cp_getvar("appendwrite", CP_BOOL, NULL);
|
||||
singlescale = cp_getvar("wr_singlescale", CP_BOOL, NULL);
|
||||
vecnames = cp_getvar("wr_vecnames", CP_BOOL, NULL);
|
||||
appendwrite = cp_getvar("appendwrite", CP_BOOL, NULL, 0);
|
||||
singlescale = cp_getvar("wr_singlescale", CP_BOOL, NULL, 0);
|
||||
vecnames = cp_getvar("wr_vecnames", CP_BOOL, NULL, 0);
|
||||
|
||||
/* Sanity checking. */
|
||||
for (v = vecs, numVecs = 0; v; v = v->v_link2)
|
||||
|
|
|
|||
|
|
@ -104,17 +104,17 @@ gr_init(double *xlims, double *ylims, /* The size of the screen. */
|
|||
cur.plotno = 0;
|
||||
|
||||
/* note: should do only once, maybe in gr_init_once */
|
||||
if (!cp_getvar("pointchars", CP_STRING, pointchars))
|
||||
if (!cp_getvar("pointchars", CP_STRING, pointchars, sizeof(pointchars)))
|
||||
(void) strcpy(pointchars, DEFPOINTCHARS);
|
||||
|
||||
if (!cp_getvar("ticmarks", CP_NUM, &graph->ticmarks)) {
|
||||
if (cp_getvar("ticmarks", CP_BOOL, NULL))
|
||||
if (!cp_getvar("ticmarks", CP_NUM, &graph->ticmarks, 0)) {
|
||||
if (cp_getvar("ticmarks", CP_BOOL, NULL, 0))
|
||||
graph->ticmarks = 10;
|
||||
else
|
||||
graph->ticmarks = 0;
|
||||
}
|
||||
|
||||
if (cp_getvar("ticlist", CP_LIST, ticlist)) {
|
||||
if (cp_getvar("ticlist", CP_LIST, ticlist, 0)) {
|
||||
wl = vareval("ticlist");
|
||||
ticlist = wl_flatten(wl);
|
||||
graph->ticdata = readtics(ticlist);
|
||||
|
|
@ -445,7 +445,7 @@ gr_pmsg(char *text)
|
|||
|
||||
DevUpdate();
|
||||
|
||||
if (cp_getvar("device", CP_STRING, buf) && !(strcmp("/dev/tty", buf) == 0))
|
||||
if (cp_getvar("device", CP_STRING, buf, sizeof(buf)) && !(strcmp("/dev/tty", buf) == 0))
|
||||
fprintf(cp_err, "%s", text);
|
||||
else if (currentgraph->grid.xlabel)
|
||||
/* MW. grid.xlabel may be NULL */
|
||||
|
|
|
|||
|
|
@ -41,7 +41,7 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart)
|
|||
if (nostart) {
|
||||
degree = currentgraph->degree;
|
||||
} else {
|
||||
if (!cp_getvar("polydegree", CP_NUM, °ree))
|
||||
if (!cp_getvar("polydegree", CP_NUM, °ree, 0))
|
||||
degree = 1;
|
||||
currentgraph->degree = degree;
|
||||
}
|
||||
|
|
@ -55,7 +55,7 @@ ft_graf(struct dvec *v, struct dvec *xs, bool nostart)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!cp_getvar("gridsize", CP_NUM, &gridsize))
|
||||
if (!cp_getvar("gridsize", CP_NUM, &gridsize, 0))
|
||||
gridsize = 0;
|
||||
|
||||
if ((gridsize < 0) || (gridsize > 10000)) {
|
||||
|
|
@ -325,7 +325,7 @@ plotinterval(struct dvec *v, double lo, double hi, register double *coeffs, int
|
|||
/* This is a problem -- how do we know what granularity to use? If
|
||||
* the guy cares about this he will use gridsize.
|
||||
*/
|
||||
if (!cp_getvar("polysteps", CP_NUM, &steps))
|
||||
if (!cp_getvar("polysteps", CP_NUM, &steps, 0))
|
||||
steps = GRANULARITY;
|
||||
|
||||
incr = (hi - lo) / (double) (steps + 1);
|
||||
|
|
|
|||
|
|
@ -417,7 +417,7 @@ plotit(wordlist *wl, char *hcopy, char *devname)
|
|||
}
|
||||
|
||||
if (!sameflag && !gfound) {
|
||||
if (cp_getvar("gridstyle", CP_STRING, buf)) {
|
||||
if (cp_getvar("gridstyle", CP_STRING, buf, sizeof(buf))) {
|
||||
if (eq(buf, "lingrid"))
|
||||
gtype = GRID_LIN;
|
||||
else if (eq(buf, "loglog"))
|
||||
|
|
@ -480,7 +480,7 @@ plotit(wordlist *wl, char *hcopy, char *devname)
|
|||
}
|
||||
|
||||
if (!sameflag && !pfound) {
|
||||
if (cp_getvar("plotstyle", CP_STRING, buf)) {
|
||||
if (cp_getvar("plotstyle", CP_STRING, buf, sizeof(buf))) {
|
||||
if (eq(buf, "linplot"))
|
||||
ptype = PLOT_LIN;
|
||||
else if (eq(buf, "noretraceplot"))
|
||||
|
|
|
|||
|
|
@ -38,13 +38,13 @@ ft_xgraph(double *xlims, double *ylims, char *filename, char *title, char *xlabe
|
|||
return;
|
||||
}
|
||||
|
||||
if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth))
|
||||
if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth, 0))
|
||||
linewidth = 1;
|
||||
|
||||
if (linewidth < 1)
|
||||
linewidth = 1;
|
||||
|
||||
if (!cp_getvar("pointstyle", CP_STRING, pointstyle)) {
|
||||
if (!cp_getvar("pointstyle", CP_STRING, pointstyle, sizeof(pointstyle))) {
|
||||
markers = FALSE;
|
||||
} else {
|
||||
if (cieq(pointstyle, "markers"))
|
||||
|
|
|
|||
|
|
@ -143,7 +143,7 @@ com_print(wordlist *wl)
|
|||
|
||||
out_init();
|
||||
if (!col) {
|
||||
if (cp_getvar("width", CP_NUM, &i))
|
||||
if (cp_getvar("width", CP_NUM, &i, 0))
|
||||
width = i;
|
||||
if (width < 60)
|
||||
width = 60;
|
||||
|
|
@ -219,7 +219,7 @@ com_print(wordlist *wl)
|
|||
} //end if (v->v_rlength == 1)
|
||||
} // end for loop
|
||||
} else { /* Print in columns. */
|
||||
if (cp_getvar("width", CP_NUM, &i))
|
||||
if (cp_getvar("width", CP_NUM, &i, 0))
|
||||
width = i;
|
||||
if (width < 40)
|
||||
width = 40;
|
||||
|
|
@ -227,16 +227,16 @@ com_print(wordlist *wl)
|
|||
buf = TREALLOC(char, buf, width + 1);
|
||||
buf2 = TREALLOC(char, buf2, width + 1);
|
||||
}
|
||||
if (cp_getvar("height", CP_NUM, &i))
|
||||
if (cp_getvar("height", CP_NUM, &i, 0))
|
||||
height = i;
|
||||
if (height < 20)
|
||||
height = 20;
|
||||
nobreak = cp_getvar("nobreak", CP_BOOL, NULL);
|
||||
nobreak = cp_getvar("nobreak", CP_BOOL, NULL, 0);
|
||||
if (!nobreak && !ft_nopage)
|
||||
nobreak = FALSE;
|
||||
else
|
||||
nobreak = TRUE;
|
||||
noprintscale = cp_getvar("noprintscale", CP_BOOL, NULL);
|
||||
noprintscale = cp_getvar("noprintscale", CP_BOOL, NULL, 0);
|
||||
bv = vecs;
|
||||
nextpage:
|
||||
/* Make the first vector of every page be the scale... */
|
||||
|
|
@ -397,7 +397,7 @@ com_write(wordlist *wl)
|
|||
file = ft_rawfile;
|
||||
}
|
||||
|
||||
if (cp_getvar("filetype", CP_STRING, buf)) {
|
||||
if (cp_getvar("filetype", CP_STRING, buf, sizeof(buf))) {
|
||||
if (eq(buf, "binary"))
|
||||
ascii = FALSE;
|
||||
else if (eq(buf, "ascii"))
|
||||
|
|
@ -405,7 +405,7 @@ com_write(wordlist *wl)
|
|||
else
|
||||
fprintf(cp_err, "Warning: strange file type %s\n", buf);
|
||||
}
|
||||
appendwrite = cp_getvar("appendwrite", CP_BOOL, NULL);
|
||||
appendwrite = cp_getvar("appendwrite", CP_BOOL, NULL, 0);
|
||||
|
||||
if (wl)
|
||||
names = ft_getpnames(wl, TRUE);
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ PS_Init(void)
|
|||
{
|
||||
char pswidth[30], psheight[30];
|
||||
|
||||
if (!cp_getvar("hcopyscale", CP_STRING, psscale)) {
|
||||
if (!cp_getvar("hcopyscale", CP_STRING, psscale, sizeof(psscale))) {
|
||||
scale = 1.0;
|
||||
} else {
|
||||
sscanf(psscale, "%lf", &scale);
|
||||
|
|
@ -93,7 +93,7 @@ PS_Init(void)
|
|||
}
|
||||
dispdev->numlinestyles = NUMELEMS(linestyle);
|
||||
/* plot color */
|
||||
if (!cp_getvar("hcopypscolor", CP_NUM, &setbgcolor)) {
|
||||
if (!cp_getvar("hcopypscolor", CP_NUM, &setbgcolor, 0)) {
|
||||
/* if not set, set plot to b&w and use line styles */
|
||||
colorflag = 0;
|
||||
dispdev->numcolors = 2;
|
||||
|
|
@ -102,11 +102,11 @@ PS_Init(void)
|
|||
/* get backgroung color and set plot to color */
|
||||
colorflag = 1;
|
||||
dispdev->numcolors = 21; /* don't know what the maximum should be */
|
||||
cp_getvar("hcopypstxcolor", CP_NUM, &settxcolor);
|
||||
cp_getvar("hcopypstxcolor", CP_NUM, &settxcolor, 0);
|
||||
}
|
||||
|
||||
/* plot size */
|
||||
if (!cp_getvar("hcopywidth", CP_STRING, pswidth)) {
|
||||
if (!cp_getvar("hcopywidth", CP_STRING, pswidth, sizeof( pswidth))) {
|
||||
dispdev->width = (int)(7.75 * 72.0 * scale); /* (8 1/2 - 3/4) * 72 */
|
||||
} else {
|
||||
sscanf(pswidth, "%d", &(dispdev->width));
|
||||
|
|
@ -115,7 +115,7 @@ PS_Init(void)
|
|||
if (dispdev->width >= 10000)
|
||||
dispdev->width = 10000;
|
||||
}
|
||||
if (!cp_getvar("hcopyheight", CP_STRING, psheight)) {
|
||||
if (!cp_getvar("hcopyheight", CP_STRING, psheight, sizeof(psheight))) {
|
||||
dispdev->height = dispdev->width;
|
||||
} else {
|
||||
sscanf(psheight, "%d", &(dispdev->height));
|
||||
|
|
@ -135,9 +135,9 @@ PS_Init(void)
|
|||
* viewport.height = absolute.height - 2 * viewportyoff
|
||||
*/
|
||||
|
||||
if (!cp_getvar("hcopyfont", CP_STRING, psfont))
|
||||
if (!cp_getvar("hcopyfont", CP_STRING, psfont, sizeof(psfont)))
|
||||
strcpy(psfont, "Helvetica");
|
||||
if (!cp_getvar("hcopyfontsize", CP_STRING, psfontsize)) {
|
||||
if (!cp_getvar("hcopyfontsize", CP_STRING, psfontsize, sizeof(psfontsize))) {
|
||||
fontsize = 10;
|
||||
fontwidth = 6;
|
||||
fontheight = 14;
|
||||
|
|
@ -422,7 +422,7 @@ PS_SelectColor(int colorid) /* should be replaced by PS_DefineColor */
|
|||
|
||||
/* Extract the rgbcolor, format is: "rgb:<red>/<green>/<blue>" */
|
||||
sprintf(colorN, "color%d", colorid);
|
||||
if (cp_getvar(colorN, CP_STRING, colorstring)) {
|
||||
if (cp_getvar(colorN, CP_STRING, colorstring, sizeof(colorstring))) {
|
||||
for (i = 0; colorstring[i]; i++)
|
||||
if (colorstring[i] == '/' || colorstring[i] == ':')
|
||||
colorstring[i] = ' ';
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ raw_write(char *name, struct plot *pl, bool app, bool binary)
|
|||
char buf[BSIZE_SP];
|
||||
char *branch;
|
||||
|
||||
raw_padding = !cp_getvar("nopadding", CP_BOOL, NULL);
|
||||
raw_padding = !cp_getvar("nopadding", CP_BOOL, NULL, 0);
|
||||
|
||||
/* Why bother printing out an empty plot? */
|
||||
if (!pl->pl_dvecs) {
|
||||
|
|
|
|||
|
|
@ -215,7 +215,7 @@ dosim(
|
|||
ww = wl_cons(copy(what), wl);
|
||||
}
|
||||
/* reset output file type according to variable given in spinit */
|
||||
if (cp_getvar("filetype", CP_STRING, buf)) {
|
||||
if (cp_getvar("filetype", CP_STRING, buf, sizeof(buf))) {
|
||||
if (eq(buf, "binary"))
|
||||
ascii = FALSE;
|
||||
else if (eq(buf, "ascii"))
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ com_resume(wordlist *wl)
|
|||
if (last_used_rawfile)
|
||||
dofile = TRUE;
|
||||
|
||||
if (cp_getvar("filetype", CP_STRING, buf)) {
|
||||
if (cp_getvar("filetype", CP_STRING, buf, sizeof(buf))) {
|
||||
if (eq(buf, "binary"))
|
||||
ascii = FALSE;
|
||||
else if (eq(buf, "ascii"))
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ com_spec(wordlist *wl)
|
|||
{
|
||||
char window[BSIZE_SP];
|
||||
double maxt = time[tlen-1];
|
||||
if (!cp_getvar("specwindow", CP_STRING, window))
|
||||
if (!cp_getvar("specwindow", CP_STRING, window, sizeof(window)))
|
||||
strcpy(window, "hanning");
|
||||
if (eq(window, "none"))
|
||||
for (i = 0; i < tlen; i++)
|
||||
|
|
@ -130,7 +130,7 @@ com_spec(wordlist *wl)
|
|||
}
|
||||
else if (eq(window, "blackman")) {
|
||||
int order;
|
||||
if (!cp_getvar("specwindoworder", CP_NUM, &order))
|
||||
if (!cp_getvar("specwindoworder", CP_NUM, &order, 0))
|
||||
order = 2;
|
||||
if (order < 2) /* only order 2 supported here */
|
||||
order = 2;
|
||||
|
|
@ -146,7 +146,7 @@ com_spec(wordlist *wl)
|
|||
} else if (eq(window, "gaussian")) {
|
||||
int order;
|
||||
double scale;
|
||||
if (!cp_getvar("specwindoworder", CP_NUM, &order))
|
||||
if (!cp_getvar("specwindoworder", CP_NUM, &order, 0))
|
||||
order = 2;
|
||||
if (order < 2)
|
||||
order = 2;
|
||||
|
|
@ -237,7 +237,7 @@ com_spec(wordlist *wl)
|
|||
dc[i] += tdvec[i][k]*amp;
|
||||
}
|
||||
}
|
||||
trace = cp_getvar("spectrace", CP_BOOL, NULL);
|
||||
trace = cp_getvar("spectrace", CP_BOOL, NULL, 0);
|
||||
for (j = (startf == 0 ? 1 : 0); j < fpts; j++) {
|
||||
freq[j] = startf + j*stepf;
|
||||
if (trace)
|
||||
|
|
|
|||
|
|
@ -213,18 +213,18 @@ inp_subcktexpand(struct card *deck) {
|
|||
struct card *c;
|
||||
wordlist *modnames = NULL;
|
||||
|
||||
if (!cp_getvar("substart", CP_STRING, start))
|
||||
if (!cp_getvar("substart", CP_STRING, start, sizeof(start)))
|
||||
strcpy(start, ".subckt");
|
||||
if (!cp_getvar("subend", CP_STRING, sbend))
|
||||
if (!cp_getvar("subend", CP_STRING, sbend, sizeof(sbend)))
|
||||
strcpy(sbend, ".ends");
|
||||
if (!cp_getvar("subinvoke", CP_STRING, invoke))
|
||||
if (!cp_getvar("subinvoke", CP_STRING, invoke, sizeof(invoke)))
|
||||
strcpy(invoke, "x");
|
||||
if (!cp_getvar("modelcard", CP_STRING, model))
|
||||
if (!cp_getvar("modelcard", CP_STRING, model, sizeof(model)))
|
||||
strcpy(model, ".model");
|
||||
if (!cp_getvar("modelline", CP_STRING, model))
|
||||
if (!cp_getvar("modelline", CP_STRING, model, sizeof(model)))
|
||||
strcpy(model, ".model");
|
||||
|
||||
use_numparams = cp_getvar("numparams", CP_BOOL, NULL);
|
||||
use_numparams = cp_getvar("numparams", CP_BOOL, NULL, 0);
|
||||
|
||||
use_numparams = TRUE;
|
||||
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ out_init(void)
|
|||
|
||||
noprint = nopause = FALSE;
|
||||
|
||||
if (cp_getvar("moremode", CP_BOOL, NULL))
|
||||
if (cp_getvar("moremode", CP_BOOL, NULL, 0))
|
||||
out_moremode = TRUE;
|
||||
else
|
||||
out_moremode = FALSE;
|
||||
|
|
@ -99,9 +99,9 @@ out_init(void)
|
|||
#endif
|
||||
|
||||
if (!xsize)
|
||||
(void) cp_getvar("width", CP_NUM, &xsize);
|
||||
(void) cp_getvar("width", CP_NUM, &xsize, 0);
|
||||
if (!ysize)
|
||||
(void) cp_getvar("height", CP_NUM, &ysize);
|
||||
(void) cp_getvar("height", CP_NUM, &ysize, 0);
|
||||
|
||||
if (!xsize)
|
||||
xsize = DEF_SCRWIDTH;
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ trnoise_state_gen(struct trnoise_state *this, CKTcircuit *ckt)
|
|||
{
|
||||
if (this->top == 0) {
|
||||
|
||||
if (cp_getvar("notrnoise", CP_BOOL, NULL))
|
||||
if (cp_getvar("notrnoise", CP_BOOL, NULL, 0))
|
||||
this -> NA = this -> TS = this -> NALPHA = this -> NAMP =
|
||||
this -> RTSAM = this -> RTSCAPT = this -> RTSEMT = 0.0;
|
||||
|
||||
|
|
|
|||
|
|
@ -509,7 +509,7 @@ cp_remvar(char *varname)
|
|||
/* Determine the value of a variable. Fail if the variable is unset,
|
||||
* and if the type doesn't match, try and make it work... */
|
||||
bool
|
||||
cp_getvar(char *name, enum cp_types type, void *retval)
|
||||
cp_getvar(char *name, enum cp_types type, void *retval, size_t rsize)
|
||||
{
|
||||
struct variable *v;
|
||||
struct variable *uv1;
|
||||
|
|
@ -563,7 +563,12 @@ cp_getvar(char *name, enum cp_types type, void *retval)
|
|||
case CP_STRING: { /* Gotta be careful to have room. */
|
||||
char *s = cp_unquote(v->va_string);
|
||||
cp_wstrip(s);
|
||||
strcpy((char*) retval, s);
|
||||
if (strlen(s) >= rsize - 1) {
|
||||
fprintf(stderr, "Internal Error: string length for variable %s is limited to %d chars\n", v->va_name, rsize);
|
||||
controlled_exit(EXIT_BAD);
|
||||
}
|
||||
else
|
||||
strcpy((char*) retval, s);
|
||||
tfree(s);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -169,7 +169,7 @@ extern char *span_var_expr(char *t);
|
|||
|
||||
/* var2.c */
|
||||
extern void cp_vprint(void);
|
||||
extern bool cp_getvar(char *name, enum cp_types type, void *retval);
|
||||
extern bool cp_getvar(char *name, enum cp_types type, void *retval, size_t rsize);
|
||||
|
||||
/* cpinterface.c etc -- stuff CP needs from FTE */
|
||||
|
||||
|
|
|
|||
|
|
@ -1177,7 +1177,7 @@ main(int argc, char **argv)
|
|||
#elif defined(WaGauss)
|
||||
{
|
||||
unsigned int rseed = 66;
|
||||
if (!cp_getvar("rndseed", CP_NUM, &rseed)) {
|
||||
if (!cp_getvar("rndseed", CP_NUM, &rseed, 0)) {
|
||||
time_t acttime = time(NULL);
|
||||
rseed = (unsigned int) acttime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -213,7 +213,7 @@ cx_interpolate(void *data, short int type, int length, int *newlength, short int
|
|||
*newlength = ns->v_length;
|
||||
d = alloc_d(ns->v_length);
|
||||
|
||||
if (!cp_getvar("polydegree", CP_NUM, °ree))
|
||||
if (!cp_getvar("polydegree", CP_NUM, °ree, 0))
|
||||
degree = 1;
|
||||
|
||||
for (base = 0; base < length; base += grouping) {
|
||||
|
|
@ -248,7 +248,7 @@ cx_deriv(void *data, short int type, int length, int *newlength, short int *newt
|
|||
return (NULL);
|
||||
}
|
||||
|
||||
if (!cp_getvar("dpolydegree", CP_NUM, °ree))
|
||||
if (!cp_getvar("dpolydegree", CP_NUM, °ree, 0))
|
||||
degree = 2; /* default quadratic */
|
||||
|
||||
n = degree + 1;
|
||||
|
|
@ -615,9 +615,9 @@ cx_fft(void *data, short int type, int length, int *newlength, short int *newtyp
|
|||
|
||||
win = TMALLOC(double, length);
|
||||
maxt = time[length-1];
|
||||
if (!cp_getvar("specwindow", CP_STRING, window))
|
||||
if (!cp_getvar("specwindow", CP_STRING, window, sizeof(window)))
|
||||
strcpy(window, "none");
|
||||
if (!cp_getvar("specwindoworder", CP_NUM, &order))
|
||||
if (!cp_getvar("specwindoworder", CP_NUM, &order, 0))
|
||||
order = 2;
|
||||
if (order < 2)
|
||||
order = 2;
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ void checkseed(void)
|
|||
int newseed;
|
||||
static int oldseed;
|
||||
/* printf("Enter checkseed()\n"); */
|
||||
if (cp_getvar("rndseed", CP_NUM, &newseed)) {
|
||||
if (cp_getvar("rndseed", CP_NUM, &newseed, 0)) {
|
||||
if ((newseed > 0) && (oldseed != newseed)) {
|
||||
srand((unsigned int)newseed);
|
||||
TausSeed();
|
||||
|
|
|
|||
|
|
@ -743,7 +743,7 @@ bot:
|
|||
#elif defined (WaGauss)
|
||||
{
|
||||
unsigned int rseed = 66;
|
||||
if (!cp_getvar("rndseed", CP_NUM, &rseed)) {
|
||||
if (!cp_getvar("rndseed", CP_NUM, &rseed, 0)) {
|
||||
time_t acttime = time(NULL);
|
||||
rseed = (unsigned int) acttime;
|
||||
}
|
||||
|
|
@ -1114,7 +1114,7 @@ sh_vfprintf(FILE *f, const char *fmt, va_list args)
|
|||
}
|
||||
|
||||
/* add / to escape characters, if 'set addescape' is called in .spiceinit */
|
||||
if (cp_getvar("addescape", CP_BOOL, NULL)) {
|
||||
if (cp_getvar("addescape", CP_BOOL, NULL, 0)) {
|
||||
size_t escapes;
|
||||
const char * const escape_chars = "$[]\"\\";
|
||||
char *s = p;
|
||||
|
|
|
|||
|
|
@ -79,7 +79,7 @@ CKTdoJob(CKTcircuit *ckt, int reset, TSKtask *task)
|
|||
may be overridden by 'set xtrtol=newval' */
|
||||
if (ckt->CKTadevFlag && (ckt->CKTtrtol > 1)) {
|
||||
int newtol;
|
||||
if (cp_getvar("xtrtol", CP_NUM, &newtol)) {
|
||||
if (cp_getvar("xtrtol", CP_NUM, &newtol, 0)) {
|
||||
printf("Override trtol to %d for xspice 'A' devices\n", newtol);
|
||||
ckt->CKTtrtol = newtol;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ CKTsetup(CKTcircuit *ckt)
|
|||
matrix = ckt->CKTmatrix;
|
||||
|
||||
#ifdef USE_OMP
|
||||
if (!cp_getvar("num_threads", CP_NUM, &nthreads))
|
||||
if (!cp_getvar("num_threads", CP_NUM, &nthreads, 0))
|
||||
nthreads = 2;
|
||||
|
||||
omp_set_num_threads(nthreads);
|
||||
|
|
|
|||
|
|
@ -123,7 +123,7 @@ NOISEan (CKTcircuit *ckt, int restart)
|
|||
data->freq = job->NstartFreq;
|
||||
data->outNoiz = 0.0;
|
||||
data->inNoise = 0.0;
|
||||
data->squared = cp_getvar("sqrnoise", CP_BOOL, NULL) ? 1 : 0;
|
||||
data->squared = cp_getvar("sqrnoise", CP_BOOL, NULL, 0) ? 1 : 0;
|
||||
|
||||
/* the current front-end needs the namelist to be fully
|
||||
declared before an OUTpBeginplot */
|
||||
|
|
|
|||
|
|
@ -28,7 +28,7 @@ IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param)
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ BSIM3v0param(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ BSIM3v1param(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param)
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ BSIM3v32param (int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param)
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param)
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param)
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ CAPparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ DIOparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param) {
|
||||
|
|
|
|||
|
|
@ -73,7 +73,7 @@ int HSM2param(
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch (param) {
|
||||
|
|
|
|||
|
|
@ -34,7 +34,7 @@ int HSMHVparam(
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch (param) {
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ int HSMHV2param(
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch (param) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ MOS1param(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param) {
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ MOS2param(int param, IFvalue *value, GENinstance *inst,
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ MOS3param(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param) {
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ RESparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param) {
|
||||
|
|
|
|||
|
|
@ -25,7 +25,7 @@ VDMOSparam(int param, IFvalue *value, GENinstance *inst, IFvalue *select)
|
|||
|
||||
NG_IGNORE(select);
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
switch(param) {
|
||||
|
|
|
|||
|
|
@ -226,7 +226,7 @@ INPgetModBin(CKTcircuit *ckt, char *name, INPmodel **model, INPtables *tab, char
|
|||
static char *model_tokens[] = { "lmin", "lmax", "wmin", "wmax" };
|
||||
double scale;
|
||||
|
||||
if (!cp_getvar("scale", CP_REAL, &scale))
|
||||
if (!cp_getvar("scale", CP_REAL, &scale, 0))
|
||||
scale = 1;
|
||||
|
||||
*model = NULL;
|
||||
|
|
|
|||
Loading…
Reference in New Issue