/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (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 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
/* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* UNIX shell
*/
#include "defs.h"
#include "dup.h"
#include <stdio.h>
#include <fcntl.h>
#include <errno.h>
short topfd;
/* ======== input output and file copying ======== */
void
{
f->feval = 0;
f->flin = 1;
}
int
estabf(unsigned char *s)
{
struct fileblk *f;
f->nxtoff = 0;
f->flin = 1;
return (f->feof = (s == 0));
}
void
{
struct fileblk *f;
f->feof = 0;
f->feval = 0;
standin = f;
}
int
pop(void)
{
struct fileblk *f;
if (f->fdes >= 0)
return (TRUE);
} else
return (FALSE);
}
void
{
}
int
poptemp(void)
{
if (tmpfptr) {
return (TRUE);
} else
return (FALSE);
}
void
{
}
int
{
int rc;
else
return (rc);
}
/*
* Make f2 be a synonym (including the close-on-exec flag) for f1, which is
* then closed. If f2 is descriptor 0, modify the global ioset variable
* accordingly.
*/
void
{
#ifdef RES
if (f2 == 0)
ioset |= 1;
}
#else
int fs;
if (fs == 1)
if (f2 == 0)
ioset |= 1;
}
#endif
}
int
create(unsigned char *s)
{
int rc;
else
return (rc);
}
int
{
int fd;
int len;
/* make sure tmp file does not already exist. */
do {
"%u", serial);
serial++;
/*
* We've already cycled through all the possible
* numbers or the tmp file name is being
* truncated anyway (although TMPOUTSZ should be
* big enough), so start over.
*/
serial = 0;
break;
}
if (fd != -1) {
return (fd);
}
else
}
/*
* set by trim
*/
void
{
unsigned char *cline;
unsigned char *clinep;
unsigned int c;
unsigned char *ends;
unsigned char *start;
int fd;
int i;
int stripflg;
unsigned char *pc;
if (nosubst)
if (fndef)
else
if (stripflg) {
while (*ends == '\t')
ends++;
}
for (;;) {
chkpr();
if (nosubst) {
c = readwc();
if (stripflg)
while (c == '\t')
c = readwc();
while (!eolchar(c)) {
while (*pc) {
}
c = readwc();
}
} else {
c = nextwc();
if (stripflg)
while (c == '\t')
c = nextwc();
while (!eolchar(c)) {
while (*pc) {
}
if (c == '\\') {
/* *pc might be NULL */
/* BEGIN CSTYLED */
if (*pc) {
while (*pc) {
}
} else {
}
/* END CSTYLED */
}
c = nextwc();
}
}
*clinep = 0;
break;
} else {
}
else
{
}
}
/*
* Pushed in tmpfil -- bug fix for problem
* deleting in-line script.
*/
poptemp();
}
}
void
{
int r;
int len;
while (i) {
/* make sure tmp file does not already exist. */
do {
serial++;
/*
* We've already cycled through all the possible
* numbers or the tmp file name is being
* truncated anyway, so start over.
*/
serial = 0;
break;
}
if (r != -1) {
i = i->iolst;
} else
}
}
void
{
while (i) {
i->iolink = 0;
i = i->iolst;
}
}
int
{
int f;
/* this saved fd should not be found in an exec'ed cmd */
return (f);
}
void
{
int i;
int dupfd;
else
}
}