* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
static char sccsid
[] = "@(#)value.c 5.1 (Berkeley) 4/30/85";
static value_t
*vlookup();
for (p
= vtable
; p
->v_name
!= NULL
; p
++) {
if (cp
= getenv(p
->v_name
))
number(p
->v_value
) = *address(p
->v_value
);
* Read the .tiprc file in the HOME directory
strcpy(file
, value(HOME
));
if ((f
= fopen(file
, "r")) != NULL
) {
while (fgets(file
, sizeof(file
)-1, f
) != NULL
) {
if (tp
= rindex(file
, '\n'))
* To allow definition of exception prior to fork
vtable
[EXCEPTIONS
].v_access
&= ~(WRITE
<<PUBLIC
);
if (!vaccess(p
->v_access
, WRITE
)) {
printf("access denied\r\n");
switch (p
->v_type
&TMASK
) {
if (equal(p
->v_value
, v
))
if (!(p
->v_type
&(ENVIRON
|INIT
)))
if ((p
->v_value
= malloc(size(v
)+1)) == NOSTR
) {
printf("out of core\r\n");
p
->v_type
&= ~(ENVIRON
|INIT
);
if (number(p
->v_value
) == number(v
))
number(p
->v_value
) = number(v
);
if (boolean(p
->v_value
) == (*v
!= '!'))
boolean(p
->v_value
) = (*v
!= '!');
if (character(p
->v_value
) == *v
)
character(p
->v_value
) = *v
;
for (p
= vtable
; p
->v_name
; p
++)
if (vaccess(p
->v_access
, READ
))
if (cp
= vinterp(s
, ' '))
if (cp
= index(s
, '=')) {
if (strcmp(s
, "record") == 0)
} else if (cp
= index(s
, '?')) {
if ((p
= vlookup(s
)) && vaccess(p
->v_access
, READ
)) {
printf("%s: unknown variable\r\n", s
);
extern char *interp(), *ctrl();
if (col
> 0 && col
< MIDDLE
)
switch (p
->v_type
&TMASK
) {
if (boolean(p
->v_value
) == FALSE
) {
printf("%s=", p
->v_name
);
cp
= interp(p
->v_value
, NULL
);
printf("%s=%-5d", p
->v_name
, number(p
->v_value
));
printf("%s=", p
->v_name
);
cp
= ctrl(character(p
->v_value
));
register unsigned mode
, rw
;
if (mode
& (rw
<<PRIVATE
))
return ((mode
& (rw
<<ROOT
)) && getuid() == 0);
for (p
= vtable
; p
->v_name
; p
++)
if (equal(p
->v_name
, s
) || (p
->v_abrev
&& equal(p
->v_abrev
, s
)))
while ((c
= *s
++) && c
!= stop
)
if (c
>= '0' && c
<= '7')
register char *q
= "n\nr\rt\tb\bf\f";
if ((c
= *s
++) >= '0' && c
<= '7') {
if ((c
= *s
++) >= '0' && c
<= '7')
return (c
== stop
? s
-1 : NULL
);
* assign variable s with value v (for NUMBER or STRING or CHAR types)
if (strcmp(s
, "record") == 0)