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 #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 #include "builtins.h" 31 32 /* 33 * This is the list of built-in shell variables and default values 34 * and default attributes. 35 */ 36 37 const struct shtable2 shtab_variables[] = 38 { 39 "PATH", 0, (char*)0, 40 "PS1", 0, (char*)0, 41 "PS2", NV_NOFREE, "> ", 42 "IFS", NV_NOFREE, " \t\n", 43 "PWD", 0, (char*)0, 44 "HOME", 0, (char*)0, 45 "MAIL", 0, (char*)0, 46 "REPLY", 0, (char*)0, 47 "SHELL", NV_NOFREE, "/bin/" SH_STD, 48 "EDITOR", 0, (char*)0, 49 "MAILCHECK", NV_NOFREE|NV_INTEGER, (char*)0, 50 "RANDOM", NV_NOFREE|NV_INTEGER, (char*)0, 51 "ENV", NV_NOFREE, (char*)0, 52 "HISTFILE", 0, (char*)0, 53 "HISTSIZE", 0, (char*)0, 54 "HISTEDIT", NV_NOFREE, (char*)0, 55 "HISTCMD", NV_NOFREE|NV_INTEGER, (char*)0, 56 "FCEDIT", NV_NOFREE, &e_defedit[0], 57 "CDPATH", 0, (char*)0, 58 "MAILPATH", 0, (char*)0, 59 "PS3", NV_NOFREE, "#? ", 60 "OLDPWD", 0, (char*)0, 61 "VISUAL", 0, (char*)0, 62 "COLUMNS", 0, (char*)0, 63 "LINES", 0, (char*)0, 64 "PPID", NV_NOFREE|NV_INTEGER, (char*)0, 65 "_", NV_EXPORT, (char*)0, 66 "TMOUT", NV_NOFREE|NV_INTEGER, (char*)0, 67 "SECONDS", NV_NOFREE|NV_INTEGER|NV_DOUBLE, (char*)0, 68 "LINENO", NV_NOFREE|NV_INTEGER, (char*)0, 69 "OPTARG", 0, (char*)0, 70 "OPTIND", NV_NOFREE|NV_INTEGER, (char*)0, 71 "PS4", 0, (char*)0, 72 "FPATH", 0, (char*)0, 73 "LANG", 0, (char*)0, 74 "LC_ALL", 0, (char*)0, 75 "LC_COLLATE", 0, (char*)0, 76 "LC_CTYPE", 0, (char*)0, 77 "LC_MESSAGES", 0, (char*)0, 78 "LC_NUMERIC", 0, (char*)0, 79 "FIGNORE", 0, (char*)0, 80 "KSH_VERSION", 0, (char*)0, 81 "JOBMAX", NV_NOFREE|NV_INTEGER, (char*)0, 82 ".sh", NV_TABLE|NV_NOFREE|NV_NOPRINT, (char*)0, 83 ".sh.edchar", 0, (char*)0, 84 ".sh.edcol", 0, (char*)0, 85 ".sh.edtext", 0, (char*)0, 86 ".sh.edmode", 0, (char*)0, 87 ".sh.name", 0, (char*)0, 88 ".sh.subscript",0, (char*)0, 89 ".sh.value", 0, (char*)0, 90 ".sh.version", NV_NOFREE, (char*)(&e_version[10]), 91 ".sh.dollar", 0, (char*)0, 92 ".sh.match", 0, (char*)0, 93 ".sh.command", 0, (char*)0, 94 ".sh.file", 0, (char*)0, 95 ".sh.fun", 0, (char*)0, 96 ".sh.subshell", NV_INTEGER|NV_SHORT|NV_NOFREE, (char*)0, 97 ".sh.level", 0, (char*)0, 98 ".sh.lineno", NV_INTEGER, (char*)0, 99 ".sh.stats", 0, (char*)0, 100 ".sh.math", 0, (char*)0, 101 ".sh.pool", 0, (char*)0, 102 "SHLVL", NV_INTEGER|NV_NOFREE|NV_EXPORT, (char*)0, 103 #if SHOPT_FS_3D 104 "VPATH", 0, (char*)0, 105 #endif /* SHOPT_FS_3D */ 106 #if SHOPT_MULTIBYTE 107 "CSWIDTH", 0, (char*)0, 108 #endif /* SHOPT_MULTIBYTE */ 109 #ifdef apollo 110 "SYSTYPE", 0, (char*)0, 111 #endif /* apollo */ 112 "", 0, (char*)0 113 }; 114 115 const char *nv_discnames[] = { "get", "set", "append", "unset", "getn", 0 }; 116 117 #ifdef SHOPT_STATS 118 const Shtable_t shtab_stats[] = 119 { 120 "arg_cachehits", STAT_ARGHITS, 121 "arg_expands", STAT_ARGEXPAND, 122 "comsubs", STAT_COMSUB, 123 "forks", STAT_FORKS, 124 "funcalls", STAT_FUNCT, 125 "globs", STAT_GLOBS, 126 "linesread", STAT_READS, 127 "nv_cachehit", STAT_NVHITS, 128 "nv_opens", STAT_NVOPEN, 129 "pathsearch", STAT_PATHS, 130 "posixfuncall", STAT_SVFUNCT, 131 "simplecmds", STAT_SCMDS, 132 "spawns", STAT_SPAWN, 133 "subshell", STAT_SUBSHELL 134 }; 135 #endif /* SHOPT_STATS */ 136 137