xref: /titanic_41/usr/src/lib/libshell/common/data/variables.c (revision 3e14f97f673e8a630f076077de35afdd43dc1587)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1982-2010 AT&T Intellectual Property          *
5 *                      and is licensed under the                       *
6 *                  Common Public License, Version 1.0                  *
7 *                    by AT&T Intellectual Property                     *
8 *                                                                      *
9 *                A copy of the License is available at                 *
10 *            http://www.opensource.org/licenses/cpl1.0.txt             *
11 *         (with md5 checksum 059e8cd6165cb4c31e351f2b69388fd9)         *
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 #include	<ast.h>
23 #include	"FEATURE/options"
24 #include	"FEATURE/dynamic"
25 #include	<shell.h>
26 #include	"shtable.h"
27 #include	"name.h"
28 #include	"defs.h"
29 #include	"variables.h"
30 
31 /*
32  * This is the list of built-in shell variables and default values
33  * and default attributes.
34  */
35 
36 const struct shtable2 shtab_variables[] =
37 {
38 	"PATH",		0,				(char*)0,
39 	"PS1",		0,				(char*)0,
40 	"PS2",		NV_NOFREE, 			"> ",
41 	"IFS",		NV_NOFREE, 			" \t\n",
42 	"PWD",		0,				(char*)0,
43 	"HOME",		0,				(char*)0,
44 	"MAIL",		0,				(char*)0,
45 	"REPLY",	0,				(char*)0,
46 	"SHELL",	NV_NOFREE,			"/bin/" SH_STD,
47 	"EDITOR",	0,				(char*)0,
48 	"MAILCHECK",	NV_NOFREE|NV_INTEGER,		(char*)0,
49 	"RANDOM",	NV_NOFREE|NV_INTEGER,		(char*)0,
50 	"ENV",		NV_NOFREE,			(char*)0,
51 	"HISTFILE",	0,				(char*)0,
52 	"HISTSIZE",	0,				(char*)0,
53 	"HISTEDIT",	NV_NOFREE,			(char*)0,
54 	"HISTCMD",	NV_NOFREE|NV_INTEGER,		(char*)0,
55 	"FCEDIT",	NV_NOFREE,			"/bin/ed",
56 	"CDPATH",	0,				(char*)0,
57 	"MAILPATH",	0,				(char*)0,
58 	"PS3",		NV_NOFREE, 			"#? ",
59 	"OLDPWD",	0,				(char*)0,
60 	"VISUAL",	0,				(char*)0,
61 	"COLUMNS",	0,				(char*)0,
62 	"LINES",	0,				(char*)0,
63 	"PPID",		NV_NOFREE|NV_INTEGER,		(char*)0,
64 	"_",		NV_EXPORT,			(char*)0,
65 	"TMOUT",	NV_NOFREE|NV_INTEGER,		(char*)0,
66 	"SECONDS",	NV_NOFREE|NV_INTEGER|NV_DOUBLE,	(char*)0,
67 	"LINENO",	NV_NOFREE|NV_INTEGER,		(char*)0,
68 	"OPTARG",	0,				(char*)0,
69 	"OPTIND",	NV_NOFREE|NV_INTEGER,		(char*)0,
70 	"PS4",		0,				(char*)0,
71 	"FPATH",	0,				(char*)0,
72 	"LANG",		0,				(char*)0,
73 	"LC_ALL",	0,				(char*)0,
74 	"LC_COLLATE",	0,				(char*)0,
75 	"LC_CTYPE",	0,				(char*)0,
76 	"LC_MESSAGES",	0,				(char*)0,
77 	"LC_NUMERIC",	0,				(char*)0,
78 	"FIGNORE",	0,				(char*)0,
79 	"KSH_VERSION",	0,				(char*)0,
80 	"JOBMAX",	NV_NOFREE|NV_INTEGER,		(char*)0,
81 	".sh",		NV_TABLE|NV_RDONLY|NV_NOFREE|NV_NOPRINT,(char*)0,
82 	".sh.edchar",	0,				(char*)0,
83 	".sh.edcol",	0,				(char*)0,
84 	".sh.edtext",	0,				(char*)0,
85 	".sh.edmode",	0,				(char*)0,
86 	".sh.name",	0,				(char*)0,
87 	".sh.subscript",0,				(char*)0,
88 	".sh.value",	0,				(char*)0,
89 	".sh.version",	NV_NOFREE,			(char*)(&e_version[10]),
90 	".sh.dollar",	0,				(char*)0,
91 	".sh.match",	0,				(char*)0,
92 	".sh.command",	0,				(char*)0,
93 	".sh.file",	0,				(char*)0,
94 	".sh.fun",	0,				(char*)0,
95 	".sh.subshell",	NV_INTEGER|NV_SHORT|NV_NOFREE,	(char*)0,
96 	".sh.level",	0,				(char*)0,
97 	".sh.lineno",	NV_INTEGER|NV_RDONLY,		(char*)0,
98 	".sh.stats",	NV_RDONLY,			(char*)0,
99 	"SHLVL",	NV_INTEGER|NV_NOFREE|NV_EXPORT,	(char*)0,
100 #if SHOPT_FS_3D
101 	"VPATH",	0,				(char*)0,
102 #endif /* SHOPT_FS_3D */
103 #if SHOPT_MULTIBYTE
104 	"CSWIDTH",	0,				(char*)0,
105 #endif /* SHOPT_MULTIBYTE */
106 #ifdef apollo
107 	"SYSTYPE",	0,				(char*)0,
108 #endif /* apollo */
109 	"",	0,					(char*)0
110 };
111 
112 const char *nv_discnames[] = { "get", "set", "append", "unset", "getn", 0 };
113 
114 #ifdef SHOPT_STATS
115 const Shtable_t shtab_stats[] =
116 {
117 	"arg_cachehits",	STAT_ARGHITS,
118 	"arg_expands",		STAT_ARGEXPAND,
119 	"comsubs",		STAT_COMSUB,
120 	"forks",		STAT_FORKS,
121 	"funcalls",		STAT_FUNCT,
122 	"globs",		STAT_GLOBS,
123 	"linesread",		STAT_READS,
124 	"nv_cachehit",		STAT_NVHITS,
125 	"nv_opens",		STAT_NVOPEN,
126 	"pathsearch",		STAT_PATHS,
127 	"posixfuncall",		STAT_SVFUNCT,
128 	"simplecmds",		STAT_SCMDS,
129 	"spawns",		STAT_SPAWN,
130 	"subshell",		STAT_SUBSHELL
131 };
132 #endif /* SHOPT_STATS */
133 
134