/*
* Copyright 2000 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/*
* Copyright (c) 1983 Regents of the University of California.
* All rights reserved. The Berkeley software License Agreement
* specifies the terms and conditions for redistribution.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
#include "tip.h"
static int col = 0;
extern char *interp(char *);
static void vtoken(char *);
static int vaccess(unsigned, unsigned);
/*
* Variable manipulation
*/
void
vinit(void)
{
value_t *p;
char *cp;
FILE *f;
}
/*
* Read the .tiprc file in the HOME directory
* for sets
*/
cp = "";
char *tp;
if (file[0] == '#')
continue;
if (vflag)
*tp = '\0';
}
(void) fclose(f);
}
/*
* To allow definition of exception prior to fork
*/
}
/*VARARGS1*/
void
{
(void) printf("access denied\r\n");
return;
}
case STRING:
return;
}
(void) printf("out of core\r\n");
return;
}
break;
case NUMBER:
return;
break;
case BOOL:
return;
break;
case CHAR:
return;
}
}
void
vlex(char *s)
{
value_t *p;
if (equal(s, "all")) {
vprint(p);
} else {
char *cp;
do {
cp++;
vtoken(s);
s = cp;
} while (s);
}
if (col > 0) {
(void) printf("\r\n");
col = 0;
}
}
static void
vtoken(char *s)
{
value_t *p;
*cp = '\0';
if (p = vlookup(s)) {
cp++;
else {
if (strcmp(s, "record") == 0)
}
return;
}
*cp = '\0';
vprint(p);
return;
}
} else {
if (*s != '!')
p = vlookup(s);
else
p = vlookup(s+1);
if (p != NOVAL) {
vassign(p, s);
else
(void) printf("%s: no value specified\r\n", s);
return;
}
}
(void) printf("%s: unknown variable\r\n", s);
}
static void
{
char *cp;
(void) putchar(' ');
case BOOL:
col++;
(void) putchar('!');
}
break;
case STRING:
col++;
if (p->v_value) {
}
break;
case NUMBER:
col += 6;
break;
case CHAR:
col++;
if (p->v_value) {
}
break;
}
col = 0;
(void) printf("\r\n");
return;
}
}
static int
{
return (1);
return (1);
}
static value_t *
vlookup(char *s)
{
value_t *p;
return (p);
return (NULL);
}
char *
{
char *p = s, c;
int num;
while ((c = *s++) != 0 && c != stop)
switch (c) {
case '^':
if (*s)
*p++ = *s++ - 0100;
else
*p++ = c;
break;
case '\\':
num = 0;
c = *s++;
if (c >= '0' && c <= '7')
else {
char *q = "n\nr\rt\tb\bf\f";
for (; *q; q++)
if (c == *q++) {
*p++ = *q;
goto cont;
}
*p++ = c;
cont:
break;
}
if ((c = *s++) >= '0' && c <= '7') {
if ((c = *s++) >= '0' && c <= '7')
else
s--;
} else
s--;
*p++ = num;
break;
default:
*p++ = c;
}
*p = '\0';
}
/*
* assign variable s with value v (for NUMBER or STRING or CHAR types)
*/
int
vstring(char *s, char *v)
{
value_t *p;
char *v2;
p = vlookup(s);
if (p == 0)
return (1);
else {
if (strcmp(s, "record") == 0)
v = v2;
vassign(p, v);
}
return (0);
}