| 1 | 
– | 
/* Copyright (c) 1995 Regents of the University of California */ | 
| 2 | 
– | 
 | 
| 1 | 
  | 
#ifndef lint | 
| 2 | 
< | 
static char SCCSid[] = "$SunId$ LBL"; | 
| 2 | 
> | 
static const char       RCSid[] = "$Id$"; | 
| 3 | 
  | 
#endif | 
| 6 | 
– | 
 | 
| 4 | 
  | 
/* | 
| 5 | 
  | 
 *  Routines for loading and checking variables from file. | 
| 6 | 
  | 
 */ | 
| 7 | 
  | 
 | 
| 8 | 
+ | 
#include "copyright.h" | 
| 9 | 
+ | 
 | 
| 10 | 
  | 
#include <stdio.h> | 
| 11 | 
+ | 
#include <stdlib.h> | 
| 12 | 
  | 
#include <ctype.h> | 
| 13 | 
+ | 
 | 
| 14 | 
+ | 
#include "standard.h" | 
| 15 | 
  | 
#include "vars.h" | 
| 16 | 
  | 
 | 
| 17 | 
  | 
#define NOCHAR  127             /* constant for character to delete */ | 
| 18 | 
  | 
 | 
| 17 | 
– | 
#ifndef malloc | 
| 18 | 
– | 
extern char  *malloc(), *realloc(); | 
| 19 | 
– | 
#endif | 
| 20 | 
– | 
 | 
| 19 | 
  | 
extern char  *fgetline(); | 
| 20 | 
  | 
 | 
| 21 | 
  | 
 | 
| 22 | 
+ | 
void | 
| 23 | 
  | 
loadvars(rfname)                /* load variables into vv from file */ | 
| 24 | 
  | 
char    *rfname; | 
| 25 | 
  | 
{ | 
| 90 | 
  | 
        if (vp == NULL) | 
| 91 | 
  | 
                return(-1); | 
| 92 | 
  | 
                                        /* assign new value */ | 
| 93 | 
< | 
        if (i = vp->nass) { | 
| 93 | 
> | 
        if ( (i = vp->nass) ) { | 
| 94 | 
  | 
                cp = vp->value; | 
| 95 | 
  | 
                while (i--) | 
| 96 | 
  | 
                        while (*cp++) | 
| 97 | 
  | 
                                ; | 
| 98 | 
  | 
                i = cp - vp->value; | 
| 99 | 
< | 
                vp->value = realloc(vp->value, i+n+1); | 
| 99 | 
> | 
                vp->value = (char *)realloc((void *)vp->value, i+n+1); | 
| 100 | 
  | 
        } else | 
| 101 | 
< | 
                vp->value = malloc(n+1); | 
| 101 | 
> | 
                vp->value = (char *)malloc(n+1); | 
| 102 | 
  | 
        if (vp->value == NULL) { | 
| 103 | 
  | 
                perror(progname); | 
| 104 | 
  | 
                quit(1); | 
| 140 | 
  | 
{ | 
| 141 | 
  | 
        register char   *cp; | 
| 142 | 
  | 
 | 
| 143 | 
< | 
        if (vval(vn) == NULL | n < 0 | n >= vdef(vn)) | 
| 143 | 
> | 
        if ((vval(vn) == NULL) | (n < 0) | (n >= vdef(vn))) | 
| 144 | 
  | 
                return(NULL); | 
| 145 | 
  | 
        cp = vval(vn); | 
| 146 | 
  | 
        while (n--) | 
| 150 | 
  | 
} | 
| 151 | 
  | 
 | 
| 152 | 
  | 
 | 
| 153 | 
+ | 
void | 
| 154 | 
  | 
checkvalues()                   /* check assignments */ | 
| 155 | 
  | 
{ | 
| 156 | 
  | 
        register int    i; | 
| 161 | 
  | 
} | 
| 162 | 
  | 
 | 
| 163 | 
  | 
 | 
| 164 | 
+ | 
void | 
| 165 | 
  | 
onevalue(vp)                    /* only one assignment for this variable */ | 
| 166 | 
  | 
register VARIABLE       *vp; | 
| 167 | 
  | 
{ | 
| 177 | 
  | 
} | 
| 178 | 
  | 
 | 
| 179 | 
  | 
 | 
| 180 | 
+ | 
void | 
| 181 | 
  | 
catvalues(vp)                   /* concatenate variable values */ | 
| 182 | 
  | 
register VARIABLE       *vp; | 
| 183 | 
  | 
{ | 
| 206 | 
  | 
} | 
| 207 | 
  | 
 | 
| 208 | 
  | 
 | 
| 209 | 
+ | 
void | 
| 210 | 
  | 
boolvalue(vp)                   /* check boolean for legal values */ | 
| 211 | 
  | 
register VARIABLE       *vp; | 
| 212 | 
  | 
{ | 
| 226 | 
  | 
} | 
| 227 | 
  | 
 | 
| 228 | 
  | 
 | 
| 229 | 
+ | 
void | 
| 230 | 
  | 
qualvalue(vp)                   /* check qualitative var. for legal values */ | 
| 231 | 
  | 
register VARIABLE       *vp; | 
| 232 | 
  | 
{ | 
| 249 | 
  | 
} | 
| 250 | 
  | 
 | 
| 251 | 
  | 
 | 
| 252 | 
+ | 
void | 
| 253 | 
  | 
intvalue(vp)                    /* check integer variable for legal values */ | 
| 254 | 
  | 
register VARIABLE       *vp; | 
| 255 | 
  | 
{ | 
| 262 | 
  | 
} | 
| 263 | 
  | 
 | 
| 264 | 
  | 
 | 
| 265 | 
+ | 
void | 
| 266 | 
  | 
fltvalue(vp)                    /* check float variable for legal values */ | 
| 267 | 
  | 
register VARIABLE       *vp; | 
| 268 | 
  | 
{ | 
| 275 | 
  | 
} | 
| 276 | 
  | 
 | 
| 277 | 
  | 
 | 
| 278 | 
+ | 
void | 
| 279 | 
  | 
printvars(fp)                   /* print variable values */ | 
| 280 | 
  | 
register FILE   *fp; | 
| 281 | 
  | 
{ |