add fourth parameter to cp_getvar(), in functions missing so far
This commit is contained in:
parent
af70c2e8f0
commit
8fbcb16a57
|
|
@ -87,7 +87,7 @@ static int hcopygraphid;
|
|||
|
||||
int GL_Init(void)
|
||||
{
|
||||
if (!cp_getvar("hcopyscale", CP_STRING, psscale, 32)) {
|
||||
if (!cp_getvar("hcopyscale", CP_STRING, psscale, sizeof(psscale))) {
|
||||
scale = 1.0;
|
||||
} else {
|
||||
sscanf(psscale, "%lf", &scale);
|
||||
|
|
|
|||
|
|
@ -1357,7 +1357,7 @@ doedit(char *filename)
|
|||
{
|
||||
char buf[BSIZE_SP], buf2[BSIZE_SP], *editor;
|
||||
|
||||
if (cp_getvar("editor", CP_STRING, buf2, 512)) {
|
||||
if (cp_getvar("editor", CP_STRING, buf2, sizeof(buf2))) {
|
||||
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, 80)) {
|
||||
if (cp_getvar("ngbehavior", CP_STRING, behaviour, sizeof(behaviour))) {
|
||||
if (strcasecmp(behaviour, "all") == 0)
|
||||
return COMPATMODE_ALL;
|
||||
if (strcasecmp(behaviour, "hs") == 0)
|
||||
|
|
@ -1512,7 +1512,7 @@ inp_add_control_section(struct card *deck, int *line_number)
|
|||
found_run = TRUE;
|
||||
}
|
||||
|
||||
if (cp_getvar("rawfile", CP_STRING, rawfile, 1000)) {
|
||||
if (cp_getvar("rawfile", CP_STRING, rawfile, sizeof(rawfile))) {
|
||||
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, 1000)) {
|
||||
if (cp_getvar("rawfile", CP_STRING, rawfile, sizeof(rawfile))) {
|
||||
line = tprintf("write %s", rawfile);
|
||||
deck = insert_new_line(deck, line, (*line_number)++, 0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -132,7 +132,7 @@ X11_Init(void)
|
|||
char *argv[2];
|
||||
int argc = 2;
|
||||
|
||||
if (cp_getvar("display", CP_STRING, buf)) {
|
||||
if (cp_getvar("display", CP_STRING, buf, sizeof(buf))) {
|
||||
displayname = buf;
|
||||
} else if (!(displayname = getenv("DISPLAY"))) {
|
||||
internalerror("Can't open X display.");
|
||||
|
|
@ -233,7 +233,7 @@ initcolors(GRAPH *graph)
|
|||
|
||||
for (i = 0; i < xmaxcolors; i++) {
|
||||
(void) sprintf(buf, "color%d", i);
|
||||
if (!cp_getvar(buf, CP_STRING, colorstring))
|
||||
if (!cp_getvar(buf, CP_STRING, colorstring, sizeof(colorstring)))
|
||||
(void) strcpy(colorstring, colornames[i]);
|
||||
if (!XAllocNamedColor(display,
|
||||
DefaultColormap(display, DefaultScreen(display)),
|
||||
|
|
@ -425,7 +425,7 @@ X11_NewViewport(GRAPH *graph)
|
|||
XtAddCallback(DEVDEP(graph).buttons[1], XtNcallback, hardcopy, graph);
|
||||
|
||||
/* set up fonts */
|
||||
if (!cp_getvar("xfont", CP_STRING, fontname))
|
||||
if (!cp_getvar("xfont", CP_STRING, fontname, sizeof(fontname)))
|
||||
(void) strcpy(fontname, DEF_FONT);
|
||||
|
||||
for (p = fontname; *p && *p <= ' '; p++)
|
||||
|
|
@ -529,7 +529,7 @@ X11_Arc(int x0, int y0, int radius, double theta, double delta_theta)
|
|||
{
|
||||
int t1, t2;
|
||||
|
||||
if (0 && !cp_getvar("x11lineararcs", CP_BOOL, NULL))
|
||||
if (0 && !cp_getvar("x11lineararcs", CP_BOOL, NULL, 0))
|
||||
linear_arc(x0, y0, radius, theta, delta_theta);
|
||||
|
||||
if (DEVDEP(currentgraph).isopen) {
|
||||
|
|
@ -837,7 +837,7 @@ zoomin(GRAPH *graph)
|
|||
|
||||
/* hack for Gordon Jacobs */
|
||||
/* add to history list if plothistory is set */
|
||||
if (cp_getvar("plothistory", CP_BOOL, NULL)) {
|
||||
if (cp_getvar("plothistory", CP_BOOL, NULL, 0)) {
|
||||
wl = cp_parse(buf);
|
||||
(void) cp_addhistent(cp_event++, wl);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -121,11 +121,11 @@ WIN_Init(void)
|
|||
/* always, user may have set color0 to white */
|
||||
/* get background color information from spinit, only "white"
|
||||
is recognized as a suitable option! */
|
||||
if (cp_getvar("color0", CP_STRING, colorstring))
|
||||
if (cp_getvar("color0", CP_STRING, colorstring, sizeof(colorstring)))
|
||||
isblack = !cieq(colorstring, "white");
|
||||
|
||||
/* get linewidth information from spinit */
|
||||
if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth))
|
||||
if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth, 0))
|
||||
linewidth = 0;
|
||||
if (linewidth < 0)
|
||||
linewidth = 0;
|
||||
|
|
@ -136,7 +136,7 @@ WIN_Init(void)
|
|||
isblackold = isblack;
|
||||
|
||||
/* get linewidth information from spinit
|
||||
* if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth))
|
||||
* if (!cp_getvar("xbrushwidth", CP_NUM, &linewidth, 0))
|
||||
* linewidth = 0;
|
||||
* if (linewidth < 0)
|
||||
* linewidth = 0;
|
||||
|
|
@ -265,7 +265,7 @@ HcpyPlotBW(HWND hwnd)
|
|||
{
|
||||
int bgcolor;
|
||||
NG_IGNORE(hwnd);
|
||||
if (cp_getvar("hcopypscolor", CP_NUM, &bgcolor))
|
||||
if (cp_getvar("hcopypscolor", CP_NUM, &bgcolor, 0))
|
||||
cp_remvar("hcopypscolor");
|
||||
com_hardcopy(NULL);
|
||||
return 0;
|
||||
|
|
@ -889,10 +889,10 @@ WIN_Text(char *text, int x, int y)
|
|||
lf.lfPitchAndFamily = 0;
|
||||
|
||||
/* set up fonts */
|
||||
if (!cp_getvar("wfont", CP_STRING, lf.lfFaceName))
|
||||
if (!cp_getvar("wfont", CP_STRING, lf.lfFaceName, sizeof(lf.lfFaceName)))
|
||||
(void) lstrcpy(lf.lfFaceName, DEF_FONTW);
|
||||
|
||||
if (!cp_getvar("wfont_size", CP_NUM, &(lf.lfHeight)))
|
||||
if (!cp_getvar("wfont_size", CP_NUM, &(lf.lfHeight), 0))
|
||||
lf.lfHeight = (int) (1.1 * currentgraph->fontheight);
|
||||
|
||||
// lstrcpy (lf.lfFaceName, "Courier"/*"Times New Roman"*/);
|
||||
|
|
|
|||
|
|
@ -1167,7 +1167,7 @@ main(int argc, char **argv)
|
|||
{
|
||||
unsigned int rseed = 66;
|
||||
initnorm(0, 0);
|
||||
if (!cp_getvar("rndseed", CP_NUM, &rseed)) {
|
||||
if (!cp_getvar("rndseed", CP_NUM, &rseed, 0)) {
|
||||
time_t acttime = time(NULL);
|
||||
rseed = (unsigned int) acttime;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,7 +57,7 @@ main(int ac, char **av)
|
|||
|
||||
#ifndef X_DISPLAY_MISSING
|
||||
|
||||
if (cp_getvar("display", CP_STRING, buf)) {
|
||||
if (cp_getvar("display", CP_STRING, buf, sizeof(buf))) {
|
||||
displayname = buf;
|
||||
} else if (!(displayname = getenv("DISPLAY"))) {
|
||||
fprintf(stderr, "Can't open X display.");
|
||||
|
|
@ -111,7 +111,7 @@ cp_printword(s)
|
|||
*/
|
||||
|
||||
bool
|
||||
cp_getvar(char *n, enum cp_types type, void *r)
|
||||
cp_getvar(char *n, enum cp_types type, void *r, size_t rs)
|
||||
{
|
||||
return (FALSE);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -733,7 +733,7 @@ bot:
|
|||
{
|
||||
unsigned int rseed = 66;
|
||||
initnorm (0, 0);
|
||||
if (!cp_getvar("rndseed", CP_NUM, &rseed)) {
|
||||
if (!cp_getvar("rndseed", CP_NUM, &rseed, 0)) {
|
||||
time_t acttime = time(NULL);
|
||||
rseed = (unsigned int) acttime;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue