Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
att
GitHub Repository: att/ast
Path: blob/master/src/cmd/ksh93/include/io.h
1810 views
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 <[email protected]> *
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
68
extern int sh_iocheckfd(Shell_t*,int);
69
extern void sh_ioinit(Shell_t*);
70
extern int sh_iomovefd(int);
71
extern int sh_iorenumber(Shell_t*,int,int);
72
extern void sh_pclose(int[]);
73
extern int sh_rpipe(int[]);
74
extern void sh_iorestore(Shell_t*,int,int);
75
#if defined(__EXPORT__) && defined(_BLD_DLL) && defined(_BLD_shell)
76
__EXPORT__
77
#endif
78
extern Sfio_t *sh_iostream(Shell_t*,int);
79
extern int sh_redirect(Shell_t*,struct ionod*,int);
80
extern void sh_iosave(Shell_t *, int,int,char*);
81
extern int sh_iovalidfd(Shell_t*, int);
82
extern int sh_inuse(Shell_t*, int);
83
extern void sh_iounsave(Shell_t*);
84
extern int sh_chkopen(const char*);
85
extern int sh_ioaccess(int,int);
86
extern int sh_devtofd(const char*);
87
extern int sh_isdevfd(const char*);
88
extern int sh_source(Shell_t*, Sfio_t*, const char*);
89
90
/* the following are readonly */
91
extern const char e_pexists[];
92
extern const char e_query[];
93
extern const char e_history[];
94
extern const char e_argtype[];
95
extern const char e_create[];
96
extern const char e_tmpcreate[];
97
extern const char e_exists[];
98
extern const char e_file[];
99
extern const char e_redirect[];
100
extern const char e_formspec[];
101
extern const char e_badregexp[];
102
extern const char e_open[];
103
extern const char e_notseek[];
104
extern const char e_noread[];
105
extern const char e_badseek[];
106
extern const char e_badwrite[];
107
extern const char e_badpattern[];
108
extern const char e_toomany[];
109
extern const char e_pipe[];
110
extern const char e_unknown[];
111
extern const char e_devnull[];
112
extern const char e_profile[];
113
extern const char e_sysprofile[];
114
#if SHOPT_SYSRC
115
extern const char e_sysrc[];
116
#endif
117
#if SHOPT_BASH
118
#if SHOPT_SYSRC
119
extern const char e_bash_sysrc[];
120
#endif
121
extern const char e_bash_rc[];
122
extern const char e_bash_login[];
123
extern const char e_bash_logout[];
124
extern const char e_bash_profile[];
125
#endif
126
extern const char e_stdprompt[];
127
extern const char e_supprompt[];
128
extern const char e_ambiguous[];
129
#endif /* KSHELL */
130
131