1/*********************************************************************** 2* * 3* This software is part of the ast package * 4* Copyright (c) 1982-2012 AT&T Intellectual Property * 5* and is licensed under the * 6* Eclipse Public License, Version 1.0 * 7* by AT&T Intellectual Property * 8* * 9* A copy of the License is available at * 10* http://www.eclipse.org/org/documents/epl-v10.html * 11* (with md5 checksum b35adb5213ca9657e911e9befb180842) * 12* * 13* Information and Software Systems Research * 14* AT&T Research * 15* Florham Park NJ * 16* * 17* David Korn <dgk@research.att.com> * 18* * 19***********************************************************************/ 20#pragma prototyped 21/* 22 * UNIX shell 23 * David Korn 24 * 25 */ 26 27#include <ast.h> 28#include <sfio.h> 29 30#ifndef IOBSIZE 31# define IOBSIZE (SF_BUFSIZE*sizeof(char*)) 32#endif /* IOBSIZE */ 33#define IOMAXTRY 20 34 35#ifndef SF_CLOSING 36#define SF_CLOSING SF_CLOSE 37#endif 38#ifndef SF_APPENDWR 39#define SF_APPENDWR SF_APPEND 40#endif 41 42/* used for output of shell errors */ 43#define ERRIO 2 44 45#define IOREAD 001 46#define IOWRITE 002 47#define IODUP 004 48#define IOSEEK 010 49#define IONOSEEK 020 50#define IOTTY 040 51#define IOCLEX 0100 52#define IOCLOSE (IOSEEK|IONOSEEK) 53 54#define IOSUBSHELL 0x8000 /* must be larger than any file descriptor */ 55#define IOPICKFD 0x10000 /* file descriptor number was selected automatically */ 56#define IOHERESTRING 0x20000 /* allow here documents to be string streams */ 57 58/* 59 * The remainder of this file is only used when compiled with shell 60 */ 61 62#if KSHELL 63 64#ifndef ARG_RAW 65 struct ionod; 66#endif /* !ARG_RAW */ 67 68extern int sh_iocheckfd(Shell_t*,int); 69extern void sh_ioinit(Shell_t*); 70extern int sh_iomovefd(int); 71extern int sh_iorenumber(Shell_t*,int,int); 72extern void sh_pclose(int[]); 73extern int sh_rpipe(int[]); 74extern void sh_iorestore(Shell_t*,int,int); 75#if defined(__EXPORT__) && defined(_BLD_DLL) && defined(_BLD_shell) 76 __EXPORT__ 77#endif 78extern Sfio_t *sh_iostream(Shell_t*,int); 79extern int sh_redirect(Shell_t*,struct ionod*,int); 80extern void sh_iosave(Shell_t *, int,int,char*); 81extern int sh_iovalidfd(Shell_t*, int); 82extern int sh_inuse(Shell_t*, int); 83extern void sh_iounsave(Shell_t*); 84extern int sh_chkopen(const char*); 85extern int sh_ioaccess(int,int); 86extern int sh_devtofd(const char*); 87extern int sh_isdevfd(const char*); 88extern int sh_source(Shell_t*, Sfio_t*, const char*); 89 90/* the following are readonly */ 91extern const char e_pexists[]; 92extern const char e_query[]; 93extern const char e_history[]; 94extern const char e_argtype[]; 95extern const char e_create[]; 96extern const char e_tmpcreate[]; 97extern const char e_exists[]; 98extern const char e_file[]; 99extern const char e_redirect[]; 100extern const char e_formspec[]; 101extern const char e_badregexp[]; 102extern const char e_open[]; 103extern const char e_notseek[]; 104extern const char e_noread[]; 105extern const char e_badseek[]; 106extern const char e_badwrite[]; 107extern const char e_badpattern[]; 108extern const char e_toomany[]; 109extern const char e_pipe[]; 110extern const char e_unknown[]; 111extern const char e_devnull[]; 112extern const char e_profile[]; 113extern const char e_sysprofile[]; 114#if SHOPT_SYSRC 115extern const char e_sysrc[]; 116#endif 117#if SHOPT_BASH 118#if SHOPT_SYSRC 119extern const char e_bash_sysrc[]; 120#endif 121extern const char e_bash_rc[]; 122extern const char e_bash_login[]; 123extern const char e_bash_logout[]; 124extern const char e_bash_profile[]; 125#endif 126extern const char e_stdprompt[]; 127extern const char e_supprompt[]; 128extern const char e_ambiguous[]; 129#endif /* KSHELL */ 130