source.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 (c) 1994, by Sun Microsytems, Inc.
*/
#pragma ident "%Z%%M% %I% %E% SMI"
/*
* Includes
*/
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <string.h>
#include <libintl.h>
#include "new.h"
#include "queue.h"
#include "source.h"
/*
* Typedefs
*/
typedef struct source {
char *path;
int linenum;
} source_t;
/*
* Defines
*/
#define HOME "HOME"
#define PREXRC ".prexrc"
/*
* Globals
*/
static queue_node_t stack;
/*
* source_init() - initializes the source stack
*/
void
source_init(void)
{
char *home;
int retval;
/* initialize the stack queue head */
queue_init(&stack);
/* stick the standard input on the bottom of the stack */
/*
* since we are pushing onto a stack, we invert the search order *
* and push the prexrc in the current directory on next.
*/
if (retval != -1) {
}
if (home) {
char path[MAXPATHLEN];
if (retval != -1) {
}
}
}
} /* end source_init */
/*
* source_file() - pushes a new source onto the stack
*/
void
source_file(char *path)
{
if (!newfile) {
return;
}
} /* end source_file */
/*
* source_input() - lexical analyzer input routine
*/
int
source_input(void)
{
int c;
if (!top)
return (0);
if (c == EOF) {
/*
* If we get an EOF at the top level, we quit if we are *
* non-interactive, pretend we saw a new-line if we are *
* interactive.
*/
source_output('\n');
return ('\n');
} else
}
/* we've exhausted the current stream, pop it, delete it ... */
/* point to the new top level i/o stream */
if (!top)
return (0);
/* trigger a prompt if neccessary */
prompt();
return (source_input());
}
return (c);
} /* end source_input */
/*
* source_unput() - lexical analyzer unput routine
*/
void
source_unput(int c)
{
if (top)
} /* end source_unput */
/*
* source_output() - lexical analyzer output routine
*/
void
source_output(int c)
{
} /* end source_output */
/*
* source_nl() - increment the line counter
*/
void
source_nl(void)
{
if (top)
} /* end source_nl */
/*
* yyerror() -
*/
extern char yytext[];
extern int g_linenum;
void
yyerror(char *s)
{
gettext("\"%s\", line %d: %s on or before \"%s\"\n"),
}
/*
* yywrap() -
*/
int
yywrap()
{
return (1);
} /* end yywrap */
/*
* prompt() -
*/
extern char **g_argv;
void
prompt(void)
{
} /* end g_prompt */
/*
* semantic_err() - reports a semantic error
*/
void
semantic_err(char *format, ...)
{
if (!top)
return;
} /* end semantic_err */