evstr.c revision 7c478bd95313f5f23a4c958a745db2134aa03244
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 1993 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
#pragma ident "%Z%%M% %I% %E% SMI"
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <signal.h>
#include "wish.h"
#include "token.h"
#include "fm_mn_par.h"
#include "var_arrays.h"
#include "terror.h"
#include "eval.h"
#include "moremacros.h"
#include "interrupt.h"
char *pline();
char **parselist();
extern int EV_retcode;
extern int EV_backquotes;
extern int Lasttok;
/*
* EVAL_STRING sets up calls to the evaluator (eval) given the
* expected descriptor type
*/
extern void intr_handler();
char *
char *defstring;
int *flags;
{
char *retval;
int savecode;
int savequotes;
int savetok;
int tmpflags;
/*
* Save globals used in "eval" (in case eval_string is
* called while "eval" function is still active ... this
*/
/* If interrupts are suppose to be enabled,
* set up the interrupt handler.
*/
case RET_BOOL:
}
break;
case RET_INT:
case RET_STR:
break;
case RET_ARGS:
case RET_LIST:
break;
}
{
}
/*
* Restore globals used in "eval"
*/
return(retval);
}
/*
** Calls eval() repeatedly to generate one string.
*/
char *
char *line;
int *pflags;
{
char *ret;
int firstime;
if (!line)
return(NULL);
/* could be useful in future */
/* if (strcspn(line, "'\"`$\\") == strlen(line)) */
/* return(strsave(line)); */
{
/* for booleans, return code has precidence over the string generated: */
{
break;
}
if (firstime)
{
char *str;
{
/* if (*pflags & EVAL_ONCE)
** *pflags = (*pflags & (RETS | FREEIT)) | EVAL_SOMETIMES;
** abs k15 */
}
{
/** if (*pflags & EVAL_SOMETIMES) abs k15 */
}
else
}
if (!firstime)
}
/* remove trailing space */
if (!firstime)
if (ret)
return(ret);
}
/*
** Repeatedly calls "eval" to get a list of tokens.
*/
char **
char *list;
register int *pflags;
char beg;
char end;
{
register char **hold;
char *str;
int squig_flag;
return(hold);
/* flag to tell eval whether `{' and `}' have special meaning */
}
/* if (*pflags & EVAL_ONCE)
** *pflags = (*pflags & (RETS | FREEIT)) | EVAL_SOMETIMES;
abs k15 */
}
/** if (*pflags & EVAL_SOMETIMES) abs k15 */
}
return(NULL);
}
char *p;
}
return(hold);
}
if (!beg) {
char *p, *q;
q = strsave(p);
}
}
else
}
if (EV_retcode != 0) {
break;
}
else if (str)
}
}
return(hold);
}