io.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) 1984, 1986, 1987, 1988, 1989 AT&T */
/* All Rights Reserved */
/*
* Copyright (c) 1996, 2001 by Sun Microsystems, Inc.
* All rights reserved.
*/
#ident "%Z%%M% %I% %E% SMI" /* SVr4.0 1.10.2.1 */
/*
* UNIX shell
*/
#include "defs.h"
#include "dup.h"
#include <fcntl.h>
#include <errno.h>
short topfd;
/* ======== input output and file copying ======== */
int fd;
{
f->feval = 0;
f->flin = 1;
}
estabf(s)
register unsigned char *s;
{
register struct fileblk *f;
f->nxtoff = 0;
f->flin = 1;
return (f->feof = (s == 0));
}
{
register struct fileblk *f;
f->feof = 0;
f->feval = 0;
standin = f;
}
pop()
{
register struct fileblk *f;
{
if (f->fdes >= 0)
return (TRUE);
}else
return (FALSE);
}
int fd;
{
}
poptemp()
{
if (tmpfptr){
return (TRUE);
}else
return (FALSE);
}
int *pv;
{
}
unsigned char *idf;
int mode;
{
register 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.
*/
{
#ifdef RES
{
if (f2 == 0)
ioset |= 1;
}
#else
int fs;
{
if (fs == 1)
if (f2 == 0)
ioset |= 1;
}
#endif
}
create(s)
unsigned char *s;
{
register int rc;
else
return (rc);
}
{
int fd;
/* make sure tmp file does not already exist. */
do {
if (fd != -1) {
return (fd);
}
else
}
/*
* set by trim
*/
#define CPYSIZ 512
{
register unsigned char *cline;
register 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 */
if (*pc) {
while (*pc) {
}
} else {
}
}
c = nextwc();
}
}
*clinep = 0;
{
break;
}else{
}
else
{
}
}
poptemp(); /*
* pushed in tmpfil -- bug fix for problem
* deleting in-line scripts
*/
}
}
link_iodocs(i)
struct ionod *i;
{
int r;
while (i)
{
/* make sure tmp file does not already exist. */
do {
if (r != -1) {
i = i->iolst;
} else
}
}
struct ionod *i;
{
while (i)
{
i->iolink = 0;
i = i->iolst;
}
}
int fd;
{
register int f;
return (f);
}
register int last;
{
register int i;
register int dupfd;
{
else
}
}