1 /* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License, Version 1.0 only 6 * (the "License"). You may not use this file except in compliance 7 * with the License. 8 * 9 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 10 * or http://www.opensolaris.org/os/licensing. 11 * See the License for the specific language governing permissions 12 * and limitations under the License. 13 * 14 * When distributing Covered Code, include this CDDL HEADER in each 15 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 16 * If applicable, add the following below this CDDL HEADER, with the 17 * fields enclosed by brackets "[]" replaced with your own identifying 18 * information: Portions Copyright [yyyy] [name of copyright owner] 19 * 20 * CDDL HEADER END 21 */ 22 /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 23 /* All Rights Reserved */ 24 25 26 /* 27 * Copyright 2003 Sun Microsystems, Inc. All rights reserved. 28 * Use is subject to license terms. 29 */ 30 31 /* 32 * Portions Copyright (c) 2005 Gunnar Ritter, Freiburg i. Br., Germany 33 * 34 * Sccsid @(#)msg.c 1.11 (gritter) 7/3/05 35 */ 36 /* from OpenSolaris "msg.c 1.13 05/06/08 SMI" */ 37 /* 38 * UNIX shell 39 */ 40 41 42 #include "defs.h" 43 #include "sym.h" 44 45 /* 46 * error messages 47 */ 48 49 const char badopt[] = "bad option(s)"; 50 const char badargs[] = "missing argument"; 51 const char badumask[] = "bad umask"; 52 const char mailmsg[] = "you have mail\n"; 53 const char nospace[] = "no space"; 54 const char nostack[] = "no stack space"; 55 const char synmsg[] = "syntax error"; 56 57 const char badnum[] = "bad number"; 58 const char badsig[] = "bad signal"; 59 const char badid[] = "invalid id"; 60 const char badparam[] = "parameter null or not set"; 61 const char unset[] = "parameter not set"; 62 const char badsub[] = "bad substitution"; 63 const char badcreate[] = "cannot create"; 64 const char nofork[] = "fork failed - too many processes"; 65 const char noswap[] = "cannot fork: no swap space"; 66 const char restricted[] = "restricted"; 67 const char piperr[] = "cannot make pipe"; 68 const char badopen[] = "cannot open"; 69 const char coredump[] = " - core dumped"; 70 const char arglist[] = "arg list too long"; 71 const char txtbsy[] = "text busy"; 72 const char toobig[] = "too big"; 73 const char badexec[] = "cannot execute"; 74 const char notfound[] = "not found"; 75 const char badfile[] = "bad file number"; 76 const char badshift[] = "cannot shift"; 77 const char baddir[] = "bad directory"; 78 const char badtrap[] = "bad trap"; 79 const char wtfailed[] = "is read only"; 80 const char notid[] = "is not an identifier"; 81 const char badulimit[] = "bad ulimit"; 82 const char badresource[] = "no such resource"; 83 const char badreturn[] = "cannot return when not in function"; 84 const char badexport[] = "cannot export functions"; 85 const char badunset[] = "cannot unset"; 86 const char nohome[] = "no home directory"; 87 const char badperm[] = "execute permission denied"; 88 const char longpwd[] = "sh error: pwd too long"; 89 const char mssgargn[] = "missing arguments"; 90 const char libacc[] = "can't access a needed shared library"; 91 const char libbad[] = "accessing a corrupted shared library"; 92 const char libscn[] = ".lib section in a.out corrupted"; 93 const char libmax[] = "attempting to link in too many libs"; 94 const char emultihop[] = "Multihop attempted"; 95 const char nulldir[] = "null directory"; 96 const char enotdir[] = "not a directory"; 97 const char enoent[] = "does not exist"; 98 const char eacces[] = "permission denied"; 99 const char enolink[] = "remote link inactive"; 100 const char badscale[] = "bad scaling"; 101 const char exited[] = "Done"; 102 const char running[] = "Running"; 103 const char ambiguous[] = "ambiguous"; 104 const char usage[] = "usage"; 105 const char nojc[] = "no job control"; 106 const char stopuse[] = "stop id ..."; 107 const char ulimuse[] = "ulimit [ -HSacdfnstv ] [ limit ]"; 108 const char killuse[] = "kill [ [ -sig ] id ... | -l ]"; 109 const char jobsuse[] = "jobs [ [ -l | -p ] [ id ... ] | -x cmd ]"; 110 const char nosuchjob[] = "no such job"; 111 const char nosuchpid[] = "no such process"; 112 const char nosuchpgid[] = "no such process group"; 113 const char nocurjob[] = "no current job"; 114 const char jobsstopped[] = "there are stopped jobs"; 115 const char jobsrunning[] = "there are running jobs"; 116 const char loginsh[] = "cannot stop login shell"; 117 118 /* 119 * messages for 'builtin' functions 120 */ 121 const char btest[] = "test"; 122 const char badop[] = "unknown operator "; 123 /* 124 * built in names 125 */ 126 const char pathname[] = "PATH"; 127 const char cdpname[] = "CDPATH"; 128 const char homename[] = "HOME"; 129 const char mailname[] = "MAIL"; 130 const char ifsname[] = "IFS"; 131 const char ps1name[] = "PS1"; 132 const char ps2name[] = "PS2"; 133 const char mchkname[] = "MAILCHECK"; 134 const char acctname[] = "SHACCT"; 135 const char mailpname[] = "MAILPATH"; 136 const char timeoutname[] = "TIMEOUT"; 137 138 /* 139 * string constants 140 */ 141 const char nullstr[] = ""; 142 const char sptbnl[] = " \t\n"; 143 const char defpath[] = "/usr/5bin:/bin:/usr/bin:"; 144 const char colon[] = ": "; 145 const char minus[] = "-"; 146 const char endoffile[] = "end of file"; 147 const char unexpected[] = " unexpected"; 148 const char atline[] = " at line "; 149 const char devnull[] = "/dev/null"; 150 const char execpmsg[] = "+ "; 151 const char readmsg[] = "> "; 152 const char stdprompt[] = "$ "; 153 const char supprompt[] = "# "; 154 const char profile[] = ".profile"; 155 const char sysprofile[] = "/etc/profile"; 156 157 /* 158 * tables 159 */ 160 161 const struct sysnod reserved[] = 162 { 163 { "case", CASYM }, 164 { "do", DOSYM }, 165 { "done", ODSYM }, 166 { "elif", EFSYM }, 167 { "else", ELSYM }, 168 { "esac", ESSYM }, 169 { "fi", FISYM }, 170 { "for", FORSYM }, 171 { "if", IFSYM }, 172 { "in", INSYM }, 173 { "then", THSYM }, 174 { "until", UNSYM }, 175 { "while", WHSYM }, 176 { "{", BRSYM }, 177 { "}", KTSYM } 178 }; 179 180 const int no_reserved = sizeof(reserved)/sizeof(struct sysnod); 181 182 const char *sysmsg[] = 183 { 184 0, 185 "Hangup", 186 0, /* Interrupt */ 187 "Quit", 188 "Illegal instruction", 189 "Trace/BPT trap", 190 "abort", 191 "EMT trap", 192 "Floating exception", 193 "Killed", 194 "Bus error", 195 "Memory fault", 196 "Bad system call", 197 0, /* Broken pipe */ 198 "Alarm call", 199 "Terminated", 200 "Signal 16", 201 "Signal 17", 202 "Child death", 203 "Power Fail" 204 }; 205 206 const char export[] = "export"; 207 const char duperr[] = "cannot dup"; 208 const char readonly[] = "readonly"; 209 210 211 const struct sysnod commands[] = 212 { 213 { ".", SYSDOT }, 214 { ":", SYSNULL }, 215 216 #ifndef RES 217 { "[", SYSTST }, 218 #endif 219 { "bg", SYSFGBG }, 220 { "break", SYSBREAK }, 221 { "cd", SYSCD }, 222 { "chdir", SYSCD }, 223 { "continue", SYSCONT }, 224 { "echo", SYSECHO }, 225 { "eval", SYSEVAL }, 226 { "exec", SYSEXEC }, 227 { "exit", SYSEXIT }, 228 { "export", SYSXPORT }, 229 { "fg", SYSFGBG }, 230 { "getopts", SYSGETOPT }, 231 { "hash", SYSHASH }, 232 { "jobs", SYSJOBS }, 233 { "kill", SYSKILL }, 234 #ifdef RES 235 { "login", SYSLOGIN }, 236 { "newgrp", SYSLOGIN }, 237 #else 238 { "newgrp", SYSNEWGRP }, 239 #endif 240 241 { "pwd", SYSPWD }, 242 { "read", SYSREAD }, 243 { "readonly", SYSRDONLY }, 244 { "return", SYSRETURN }, 245 { "set", SYSSET }, 246 { "shift", SYSSHFT }, 247 { "stop", SYSSTOP }, 248 { "suspend", SYSSUSP}, 249 { "test", SYSTST }, 250 { "times", SYSTIMES }, 251 { "trap", SYSTRAP }, 252 { "type", SYSTYPE }, 253 254 255 #ifndef RES 256 { "ulimit", SYSULIMIT }, 257 { "umask", SYSUMASK }, 258 #endif 259 260 { "unset", SYSUNS }, 261 { "wait", SYSWAIT } 262 }; 263 264 const int no_commands = sizeof(commands)/sizeof(struct sysnod); 265 266