1*7c478bd9Sstevel@tonic-gate /* 2*7c478bd9Sstevel@tonic-gate * Copyright 2000 by Sun Microsystems, Inc. All rights reserved. 3*7c478bd9Sstevel@tonic-gate * Use is subject to license terms. 4*7c478bd9Sstevel@tonic-gate */ 5*7c478bd9Sstevel@tonic-gate 6*7c478bd9Sstevel@tonic-gate /* Copyright (c) 1983, 1984, 1985, 1986, 1987, 1988, 1989 AT&T */ 7*7c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 8*7c478bd9Sstevel@tonic-gate 9*7c478bd9Sstevel@tonic-gate /* 10*7c478bd9Sstevel@tonic-gate * Copyright (c) 1980 Regents of the University of California. 11*7c478bd9Sstevel@tonic-gate * All rights reserved. The Berkeley Software License Agreement 12*7c478bd9Sstevel@tonic-gate * specifies the terms and conditions for redistribution. 13*7c478bd9Sstevel@tonic-gate */ 14*7c478bd9Sstevel@tonic-gate 15*7c478bd9Sstevel@tonic-gate #pragma ident "%Z%%M% %I% %E% SMI" 16*7c478bd9Sstevel@tonic-gate 17*7c478bd9Sstevel@tonic-gate /* 18*7c478bd9Sstevel@tonic-gate * C shell 19*7c478bd9Sstevel@tonic-gate */ 20*7c478bd9Sstevel@tonic-gate 21*7c478bd9Sstevel@tonic-gate /* 22*7c478bd9Sstevel@tonic-gate * These tchar constants used to be defined as 23*7c478bd9Sstevel@tonic-gate * character string constants. 24*7c478bd9Sstevel@tonic-gate */ 25*7c478bd9Sstevel@tonic-gate 26*7c478bd9Sstevel@tonic-gate #include "sh.h" 27*7c478bd9Sstevel@tonic-gate 28*7c478bd9Sstevel@tonic-gate tchar S_[] = {0}; 29*7c478bd9Sstevel@tonic-gate tchar S_0[]={'0', 0}; 30*7c478bd9Sstevel@tonic-gate tchar S_1[]={'1', 0}; 31*7c478bd9Sstevel@tonic-gate tchar S_AND[] = {'&', 0}; /* & */ 32*7c478bd9Sstevel@tonic-gate tchar S_ANDAND[] = {'&', '&', 0}; /* && */ 33*7c478bd9Sstevel@tonic-gate tchar S_AST[]={'*', 0}; 34*7c478bd9Sstevel@tonic-gate tchar S_AT[] = { '@', 0 }; 35*7c478bd9Sstevel@tonic-gate tchar S_BAR[] = {'|', 0}; /* | */ 36*7c478bd9Sstevel@tonic-gate tchar S_BARBAR[] = {'|','|', 0}; /* || */ 37*7c478bd9Sstevel@tonic-gate tchar S_BRABRA[] = {'{', '}', 0}; /* {} */ 38*7c478bd9Sstevel@tonic-gate tchar S_BRAPPPBRA[] = {'{', ' ', '.', '.', '.', ' ', '}', 0}; /* { ... } */ 39*7c478bd9Sstevel@tonic-gate tchar S_COLON[] = {':', 0}; /*:*/ 40*7c478bd9Sstevel@tonic-gate tchar S_DASHl[] = {'-', 'l', 0}; /*-l */ 41*7c478bd9Sstevel@tonic-gate tchar S_DELIM[] = {' ','\'','"','\t',';','&','<','>','(',')','|','`',0}; 42*7c478bd9Sstevel@tonic-gate tchar S_DOT[] = {'.', 0}; 43*7c478bd9Sstevel@tonic-gate tchar S_DOTDOTSLA[]={'.', '.', '/', 0}; 44*7c478bd9Sstevel@tonic-gate tchar S_DOTSLA[]={'.', '/', 0}; 45*7c478bd9Sstevel@tonic-gate tchar S_EQ[] = {'=', 0}; /*=*/ 46*7c478bd9Sstevel@tonic-gate tchar S_EXAS[] = {'!', 0}; /* ! */ 47*7c478bd9Sstevel@tonic-gate tchar S_HAT[] = {'^', 0}; /* ^ */ 48*7c478bd9Sstevel@tonic-gate tchar S_HOME[] = {'H','O','M','E',0};/*HOME*/ 49*7c478bd9Sstevel@tonic-gate tchar S_IOT[] = {'I', 'O', 'T', 0}; /*IOT*/ 50*7c478bd9Sstevel@tonic-gate tchar S_LANG[]={'L', 'A', 'N', 'G', 0}; /*LANG*/ 51*7c478bd9Sstevel@tonic-gate tchar S_LBRA[] = {'{', 0}; /* { */ 52*7c478bd9Sstevel@tonic-gate tchar S_LBRASP[] = {'(', ' ', 0}; /*( */ 53*7c478bd9Sstevel@tonic-gate tchar S_LC_ALL[]={'L', 'C', '_', 'A', 'L', 'L', 0}; /*LC_ALL*/ 54*7c478bd9Sstevel@tonic-gate tchar S_LC_CTYPE[]={'L', 'C', '_', 'C', 'T', 'Y', 'P', 'E', 0}; /*LC_CTYPE*/ 55*7c478bd9Sstevel@tonic-gate tchar S_LC_MESSAGES[]={'L', 'C', '_', 56*7c478bd9Sstevel@tonic-gate 'M', 'E', 'S', 'S', 'A', 'G', 'E', 'S', 0}; /*LC_MESSAGES*/ 57*7c478bd9Sstevel@tonic-gate tchar S_LESLES[]={'<', '<', 0}; 58*7c478bd9Sstevel@tonic-gate tchar S_LPAR[] = {'(', 0}; /* ( */ 59*7c478bd9Sstevel@tonic-gate tchar S_MINUS[] = {'-',0};/*"-"*/ 60*7c478bd9Sstevel@tonic-gate tchar S_MINl[]={'-', 'l', 0}; 61*7c478bd9Sstevel@tonic-gate tchar S_NDOThistory[] = {'~','/','.','h','i','s','t','o','r','y',0}; 62*7c478bd9Sstevel@tonic-gate tchar S_OTHERSH[] = {'/','b','i','n','/','s','h',0}; 63*7c478bd9Sstevel@tonic-gate tchar S_PARCENTMINUS[] = {'%', '-', 0}; /*%-*/ 64*7c478bd9Sstevel@tonic-gate tchar S_PARCENTPARCENT[] = {'%', '%', 0}; /*%%*/ 65*7c478bd9Sstevel@tonic-gate tchar S_PARCENTPLUS[] = {'%', '+', 0}; /*%+*/ 66*7c478bd9Sstevel@tonic-gate tchar S_PARCENTSHARP[] = {'%', '#', 0}; /*%#*/ 67*7c478bd9Sstevel@tonic-gate tchar S_PATH[] = {'P','A','T','H',0};/*"PATH"*/ 68*7c478bd9Sstevel@tonic-gate tchar S_PERSENTSP[] = {'%',' ',0}; 69*7c478bd9Sstevel@tonic-gate tchar S_PWD[]={'P', 'W', 'D', 0}; 70*7c478bd9Sstevel@tonic-gate tchar S_Pjob[] = {'%','j','o','b', 0}; /*"%job"*/ 71*7c478bd9Sstevel@tonic-gate tchar S_PjobAND[] = {'%','j','o','b',' ','&',0}; /*"%job &"*/ 72*7c478bd9Sstevel@tonic-gate tchar S_QPPPQ[] = {'`', ' ', '.', '.', '.', ' ', '`', 0}; /*` ... `*/ 73*7c478bd9Sstevel@tonic-gate tchar S_RBRA[] = {'}', 0}; /* } */ 74*7c478bd9Sstevel@tonic-gate tchar S_RPAR[] = {')', 0}; /*)*/ 75*7c478bd9Sstevel@tonic-gate tchar S_SEMICOLONSP[] = {';', ' ', 0}; /* | */ 76*7c478bd9Sstevel@tonic-gate tchar S_SHARPSP[] = {'#',' ',0}; 77*7c478bd9Sstevel@tonic-gate tchar S_SHELLPATH[] = {'/','b','i','n','/','c','s','h',0}; 78*7c478bd9Sstevel@tonic-gate tchar S_SLADOTcshrc[] = {'/','.','c','s','h','r','c', 0}; 79*7c478bd9Sstevel@tonic-gate tchar S_SLADOThistory[] = {'/','.','h','i','s','t','o','r','y', 0}; 80*7c478bd9Sstevel@tonic-gate tchar S_SLADOTlogin[] = {'/','.','l','o','g','i','n', 0}; 81*7c478bd9Sstevel@tonic-gate tchar S_SLADOTlogout[] = {'/','.','l','o','g','o','u','t', 0}; 82*7c478bd9Sstevel@tonic-gate tchar S_SLASH[] = {'/', 0}; /* "/" */ 83*7c478bd9Sstevel@tonic-gate tchar S_SP[] = {' ', 0}; /* */ 84*7c478bd9Sstevel@tonic-gate tchar S_SPANDANDSP[] = {' ', '&', '&', ' ', 0}; /* && */ 85*7c478bd9Sstevel@tonic-gate tchar S_SPBARBARSP[] = {' ', '|', '|', ' ', 0}; /* || */ 86*7c478bd9Sstevel@tonic-gate tchar S_SPBARSP[] = {' ', '|', ' ', 0}; /* | */ 87*7c478bd9Sstevel@tonic-gate tchar S_SPGTRGTRSP[] = {' ', '>', '>', ' ', 0}; /* >> */ 88*7c478bd9Sstevel@tonic-gate tchar S_SPGTR[] = {' ', '>',0}; /* > */ 89*7c478bd9Sstevel@tonic-gate tchar S_SPLESLESSP[] = {' ', '<', '<', ' ', 0}; /* << */ 90*7c478bd9Sstevel@tonic-gate tchar S_SPLESSP[] = {' ', '<', ' ', 0}; /* < */ 91*7c478bd9Sstevel@tonic-gate tchar S_SPPPP[] = {' ', '.', '.', '.', 0}; /* ... */ 92*7c478bd9Sstevel@tonic-gate tchar S_SPRBRA[] = {' ', ')', 0}; /* )*/ 93*7c478bd9Sstevel@tonic-gate tchar S_TERM[] = {'T','E','R','M',0};/*TERM*/ 94*7c478bd9Sstevel@tonic-gate tchar S_TIL[] = {'~', 0}; /* ~ */ 95*7c478bd9Sstevel@tonic-gate tchar S_TOPBIT[] = {(tchar)QUOTE, 0}; /* Was "\200". A hack! */ 96*7c478bd9Sstevel@tonic-gate tchar S_USAGEFORMAT[] = {'%','U','u',' ','%','S','s',' ','%','E',' ','%','P', ' ','%','X','+','%','D','k',' ','%','I','+','%','O','i','o',' ','%','F','p','f','+', '%','W','w',0}; 97*7c478bd9Sstevel@tonic-gate tchar S_USER[] = {'U','S','E','R',0};/*USER*/ 98*7c478bd9Sstevel@tonic-gate tchar S_alias[] = { 'a','l','i','a','s', 0 }; 99*7c478bd9Sstevel@tonic-gate tchar S_alloc[] = { 'a','l','l','o','c', 0}; 100*7c478bd9Sstevel@tonic-gate tchar S_aout[] = {'a','.','o','u','t',0}; 101*7c478bd9Sstevel@tonic-gate tchar S_argv[]={'a', 'r', 'g', 'v', 0}; 102*7c478bd9Sstevel@tonic-gate tchar S_bg[] = { 'b','g', 0}; 103*7c478bd9Sstevel@tonic-gate tchar S_bin[] = {'/','b','i','n',0}; 104*7c478bd9Sstevel@tonic-gate tchar S_break[] = { 'b','r','e','a','k', 0}; 105*7c478bd9Sstevel@tonic-gate tchar S_breaksw[] = { 'b','r','e','a','k','s','w', 0}; 106*7c478bd9Sstevel@tonic-gate tchar S_bye[] = { 'b','y','e', 0}; 107*7c478bd9Sstevel@tonic-gate tchar S_case[] = { 'c','a','s','e', 0}; 108*7c478bd9Sstevel@tonic-gate tchar S_cd[] = { 'c','d', 0}; 109*7c478bd9Sstevel@tonic-gate tchar S_cdpath[]={'c', 'd', 'p', 'a', 't', 'h', 0}; 110*7c478bd9Sstevel@tonic-gate tchar S_chdir[] = { 'c','h','d','i','r', 0}; 111*7c478bd9Sstevel@tonic-gate tchar S_child[] = {'c', 'h', 'i', 'l', 'd', 0}; /*child */ 112*7c478bd9Sstevel@tonic-gate tchar S_continue[] = { 'c','o','n','t','i','n','u','e', 0}; 113*7c478bd9Sstevel@tonic-gate tchar S_coredumpsize[] = {'c','o','r','e','d','u','m','p','s','i','z','e',0};/*"coredumpsize"*/ 114*7c478bd9Sstevel@tonic-gate tchar S_cputime[] = {'c','p','u','t','i','m','e',0};/*"cputime"*/ 115*7c478bd9Sstevel@tonic-gate tchar S_csh[]={'c', 's', 'h', 0}; 116*7c478bd9Sstevel@tonic-gate tchar S_cwd[]={'c', 'w', 'd', 0}; 117*7c478bd9Sstevel@tonic-gate tchar S_datasize[] = {'d','a','t','a','s','i','z','e',0};/*"datasize"*/ 118*7c478bd9Sstevel@tonic-gate tchar S_default[] = { 'd','e','f','a','u','l','t', 0 }; 119*7c478bd9Sstevel@tonic-gate tchar S_descriptors[] = {'d', 'e', 's', 'c', 'r', 'i', 'p', 't', 'o', 'r', 's', 0}; 120*7c478bd9Sstevel@tonic-gate tchar S_dirs[] = { 'd','i','r','s', 0 }; 121*7c478bd9Sstevel@tonic-gate tchar S_echo[] = {'e','c','h','o', 0}; 122*7c478bd9Sstevel@tonic-gate tchar S_else[] = { 'e','l','s','e', 0 }; 123*7c478bd9Sstevel@tonic-gate tchar S_end[] = { 'e','n','d', 0 }; 124*7c478bd9Sstevel@tonic-gate tchar S_endif[] = { 'e','n','d','i','f', 0 }; 125*7c478bd9Sstevel@tonic-gate tchar S_endsw[] = { 'e','n','d','s','w', 0 }; 126*7c478bd9Sstevel@tonic-gate tchar S_erwxfdzo[] = {'e', 'r', 'w', 'x', 'f', 'd', 'z', 'o', 0}; /* erwxfdzo */ 127*7c478bd9Sstevel@tonic-gate tchar S_eval[] = { 'e','v','a','l', 0 }; 128*7c478bd9Sstevel@tonic-gate tchar S_exec[] = { 'e','x','e','c', 0 }; 129*7c478bd9Sstevel@tonic-gate tchar S_exit[] = { 'e','x','i','t', 0 }; 130*7c478bd9Sstevel@tonic-gate tchar S_fg[] = { 'f','g', 0 }; 131*7c478bd9Sstevel@tonic-gate tchar S_fignore[] = {'f','i','g','n','o','r','e',0}; 132*7c478bd9Sstevel@tonic-gate tchar S_filec[] = {'f','i','l','e','c',0};/*filec*/ 133*7c478bd9Sstevel@tonic-gate tchar S_filesize[] = {'f','i','l','e','s','i','z','e',0};/*"filesize"*/ 134*7c478bd9Sstevel@tonic-gate tchar S_foreach[] = { 'f','o','r','e','a','c','h', 0 }; 135*7c478bd9Sstevel@tonic-gate tchar S_gd[] = { 'g','d', 0 }; 136*7c478bd9Sstevel@tonic-gate tchar S_glob[] = { 'g','l','o','b', 0 }; 137*7c478bd9Sstevel@tonic-gate tchar S_goto[] = { 'g','o','t','o', 0 }; 138*7c478bd9Sstevel@tonic-gate tchar S_h[] = {'-','h',0}; 139*7c478bd9Sstevel@tonic-gate tchar S_hardpaths[]={'h', 'a', 'r', 'd', 'p', 'a', 't', 'h', 's', 0}; 140*7c478bd9Sstevel@tonic-gate tchar S_hashstat[] = { 'h','a','s','h','s','t','a','t', 0 }; 141*7c478bd9Sstevel@tonic-gate tchar S_histchars[] = {'h','i','s','t','c','h','a','r','s',0}; /*histchars*/ 142*7c478bd9Sstevel@tonic-gate tchar S_history[] = {'h','i','s','t','o','r','y',0}; 143*7c478bd9Sstevel@tonic-gate tchar S_home[]={'h', 'o', 'm', 'e', 0}; 144*7c478bd9Sstevel@tonic-gate tchar S_hours[] = {'h','o','u','r','s',0};/*"hours"*/ 145*7c478bd9Sstevel@tonic-gate tchar S_htrqxe[]={'h', 't', 'r', 'q', 'x', 'e', 0}; 146*7c478bd9Sstevel@tonic-gate tchar S_if[] = { 'i','f', 0 }; 147*7c478bd9Sstevel@tonic-gate tchar S_ignoreeof[] = {'i','g','n','o','r','e','e','o','f',0}; /*"ignoreeof"*/ 148*7c478bd9Sstevel@tonic-gate tchar S_jobs[] = {'j','o','b','s', 0}; 149*7c478bd9Sstevel@tonic-gate tchar S_kbytes[] = {'k','b','y','t','e','s',0};/*"kbytes"*/ 150*7c478bd9Sstevel@tonic-gate tchar S_kill[] = { 'k','i','l','l', 0 }; 151*7c478bd9Sstevel@tonic-gate tchar S_label[] = { 'l','a','b','e','l', 0 }; 152*7c478bd9Sstevel@tonic-gate tchar S_limit[] = { 'l','i','m','i','t', 0 }; 153*7c478bd9Sstevel@tonic-gate tchar S_login[] = { 'l','o','g','i','n', 0 }; 154*7c478bd9Sstevel@tonic-gate tchar S_logout[] = { 'l','o','g','o','u','t', 0 }; 155*7c478bd9Sstevel@tonic-gate tchar S_mail[] = {'m','a','i','l', 0}; 156*7c478bd9Sstevel@tonic-gate tchar S_megabytes[] = {'m','e','g','a','b','y','t','e','s',0};/*"megabytes"*/ 157*7c478bd9Sstevel@tonic-gate tchar S_memorysize[] = {'m','e','m','o','r','y','s','i','z','e',0};/*"memorysize"*/ 158*7c478bd9Sstevel@tonic-gate tchar S_minutes[]={'m','i','n','u','t','e','s',0};/*"minutes"*/ 159*7c478bd9Sstevel@tonic-gate tchar S_n[] = {'-','n',0};/*"-n"*/ 160*7c478bd9Sstevel@tonic-gate tchar S_newgrp[] = { 'n','e','w','g','r','p', 0 }; 161*7c478bd9Sstevel@tonic-gate tchar S_nice[] = { 'n','i','c','e', 0 }; 162*7c478bd9Sstevel@tonic-gate tchar S_nobeep[] = {'n', 'o', 'b', 'e', 'e', 'p', 0}; 163*7c478bd9Sstevel@tonic-gate tchar S_noclobber[] = {'n','o','c','l','o','b','b','e','r',0};/*noclobber*/ 164*7c478bd9Sstevel@tonic-gate tchar S_noglob[] = {'n', 'o', 'g', 'l', 'o', 'b', 0}; /*noglob */ 165*7c478bd9Sstevel@tonic-gate tchar S_nohup[] = {'n', 'o', 'h', 'u', 'p', 0}; /*nohup */ 166*7c478bd9Sstevel@tonic-gate tchar S_nonomatch[] = {'n', 'o', 'n', 'o', 'm', 'a', 't', 'c', 'h', 0}; /*nonomatch */ 167*7c478bd9Sstevel@tonic-gate tchar S_notify[] = {'n', 'o', 't', 'i', 'f', 'y', 0}; /*nofify */ 168*7c478bd9Sstevel@tonic-gate tchar S_onintr[] = { 'o','n','i','n','t','r', 0 }; 169*7c478bd9Sstevel@tonic-gate tchar S_path[] = {'p','a','t','h', 0}; /*path*/ 170*7c478bd9Sstevel@tonic-gate tchar S_popd[] = { 'p','o','p','d', 0 }; 171*7c478bd9Sstevel@tonic-gate tchar S_prompt[] = {'p','r','o','m','p','t', 0}; 172*7c478bd9Sstevel@tonic-gate tchar S_pushd[] = { 'p','u','s','h','d', 0 }; 173*7c478bd9Sstevel@tonic-gate tchar S_rd[] = { 'r','d', 0 }; 174*7c478bd9Sstevel@tonic-gate tchar S_rehash[] = { 'r','e','h','a','s','h', 0 }; 175*7c478bd9Sstevel@tonic-gate tchar S_repeat[] = { 'r','e','p','e','a','t', 0 }; 176*7c478bd9Sstevel@tonic-gate tchar S_savehist[] = {'s','a','v','e','h','i','s','t', 0}; 177*7c478bd9Sstevel@tonic-gate tchar S_seconds[] = {'s','e','c','o','n','d','s',0};/*"seconds"*/ 178*7c478bd9Sstevel@tonic-gate tchar S_set[] = { 's','e','t', 0 }; 179*7c478bd9Sstevel@tonic-gate tchar S_setenv[] = { 's','e','t','e','n','v', 0 }; 180*7c478bd9Sstevel@tonic-gate tchar S_shell[] = {'s','h','e','l','l', 0}; 181*7c478bd9Sstevel@tonic-gate tchar S_shift[] = { 's','h','i','f','t', 0 }; 182*7c478bd9Sstevel@tonic-gate tchar S_source[] = {'s','o','u','r','c','e',0}; 183*7c478bd9Sstevel@tonic-gate tchar S_stacksize[] = {'s','t','a','c','k','s','i','z','e',0};/*"stacksize"*/ 184*7c478bd9Sstevel@tonic-gate tchar S_status[]={'s', 't', 'a', 't', 'u', 's', 0}; 185*7c478bd9Sstevel@tonic-gate tchar S_stop[] = { 's','t','o','p', 0 }; 186*7c478bd9Sstevel@tonic-gate tchar S_suspend[] = { 's','u','s','p','e','n','d', 0 }; 187*7c478bd9Sstevel@tonic-gate tchar S_switch[] = { 's','w','i','t','c','h', 0 }; 188*7c478bd9Sstevel@tonic-gate tchar S_term[] = {'t','e','r','m', 0}; 189*7c478bd9Sstevel@tonic-gate tchar S_then[] = {'t','h','e','n',0}; /*"then"*/ 190*7c478bd9Sstevel@tonic-gate tchar S_time[] = {'t', 'i', 'm', 'e', 0}; /*time*/ 191*7c478bd9Sstevel@tonic-gate tchar S_umask[] = { 'u','m','a','s','k', 0 }; 192*7c478bd9Sstevel@tonic-gate tchar S_unalias[] = { 'u','n','a','l','i','a','s', 0 }; 193*7c478bd9Sstevel@tonic-gate tchar S_unhash[] = { 'u','n','h','a','s','h', 0 }; 194*7c478bd9Sstevel@tonic-gate tchar S_unlimit[] = { 'u','n','l','i','m','i','t', 0 }; 195*7c478bd9Sstevel@tonic-gate tchar S_unlimited[] = {'u','n','l','i','m','i','t','e','d',0};/*"unlimited"*/ 196*7c478bd9Sstevel@tonic-gate tchar S_unset[] = { 'u','n','s','e','t', 0 }; 197*7c478bd9Sstevel@tonic-gate tchar S_unsetenv[] = { 'u','n','s','e','t','e','n','v', 0 }; 198*7c478bd9Sstevel@tonic-gate tchar S_user[] = {'u','s','e','r', 0}; 199*7c478bd9Sstevel@tonic-gate tchar S_usrbin[] = {'/','u','s','r','/','b','i','n',0}; 200*7c478bd9Sstevel@tonic-gate tchar S_usrucb[] = {'/','u','s','r','/','u','c','b',0}; 201*7c478bd9Sstevel@tonic-gate tchar S_verbose[] = {'v','e','r','b','o','s','e', 0}; 202*7c478bd9Sstevel@tonic-gate tchar S_wait[] = { 'w','a','i','t', 0 }; 203*7c478bd9Sstevel@tonic-gate tchar S_while[] = { 'w','h','i','l','e', 0 }; 204*7c478bd9Sstevel@tonic-gate /* Dummy search path for just absolute search when no path */ 205*7c478bd9Sstevel@tonic-gate tchar *justabs[] = { S_ /* "" */, 0 }; 206