xref: /titanic_44/usr/src/lib/libshell/common/data/variables.c (revision 2d6b5ea734bb47d251c82670646fde46af15fd69)
1 /***********************************************************************
2 *                                                                      *
3 *               This software is part of the ast package               *
4 *          Copyright (c) 1982-2008 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,			"$HOME/.kshrc",
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 	".sh",		NV_TABLE|NV_RDONLY|NV_NOFREE|NV_NOPRINT,(char*)0,
81 	".sh.edchar",	0,				(char*)0,
82 	".sh.edcol",	0,				(char*)0,
83 	".sh.edtext",	0,				(char*)0,
84 	".sh.edmode",	0,				(char*)0,
85 	".sh.name",	0,				(char*)0,
86 	".sh.subscript",0,				(char*)0,
87 	".sh.value",	0,				(char*)0,
88 	".sh.version",	NV_NOFREE,			(char*)(&e_version[10]),
89 	".sh.dollar",	0,				(char*)0,
90 	".sh.match",	0,				(char*)0,
91 	".sh.command",	0,				(char*)0,
92 	".sh.file",	0,				(char*)0,
93 	".sh.fun",	0,				(char*)0,
94 	".sh.subshell",	NV_INTEGER|NV_SHORT|NV_NOFREE,	(char*)0,
95 	".sh.level",	0,				(char*)0,
96 	".sh.lineno",	NV_INTEGER|NV_RDONLY,		(char*)0,
97 	".sh.stats",	NV_RDONLY,			(char*)0,
98 	"SHLVL",	NV_INTEGER|NV_NOFREE|NV_EXPORT,	(char*)0,
99 #if SHOPT_FS_3D
100 	"VPATH",	0,				(char*)0,
101 #endif /* SHOPT_FS_3D */
102 #if SHOPT_MULTIBYTE
103 	"CSWIDTH",	0,				(char*)0,
104 #endif /* SHOPT_MULTIBYTE */
105 #ifdef apollo
106 	"SYSTYPE",	0,				(char*)0,
107 #endif /* apollo */
108 	"",	0,					(char*)0
109 };
110 
111 const char *nv_discnames[] = { "get", "set", "append", "unset", 0 };
112 
113 #ifdef SHOPT_STATS
114 const Shtable_t shtab_stats[] =
115 {
116 	"arg_cachehits",	STAT_ARGHITS,
117 	"arg_expands",		STAT_ARGEXPAND,
118 	"comsubs",		STAT_COMSUB,
119 	"forks",		STAT_FORKS,
120 	"funcalls",		STAT_FUNCT,
121 	"globs",		STAT_GLOBS,
122 	"linesread",		STAT_READS,
123 	"nv_cachehit",		STAT_NVHITS,
124 	"nv_opens",		STAT_NVOPEN,
125 	"pathsearch",		STAT_PATHS,
126 	"posixfuncall",		STAT_SVFUNCT,
127 	"simplecmds",		STAT_SCMDS,
128 	"spawns",		STAT_SPAWN,
129 	"subshell",		STAT_SUBSHELL
130 };
131 #endif /* SHOPT_STATS */
132 
133