/*
 * $Copyright:	$
 * Copyright (c) 1984, 1985, 1986, 1987, 1988, 1989, 1990 
 * Sequent Computer Systems, Inc.   All rights reserved.
 *  
 * This software is furnished under a license and may be used
 * only in accordance with the terms of that license and with the
 * inclusion of the above copyright notice.   This software may not
 * be provided or otherwise made available to, or used by, any
 * other person.  No title to or ownership of the software is
 * hereby transferred.
 *
 */

/*	Copyright (c) 1984 AT&T	*/
/*	  All Rights Reserved  	*/

/*	THIS IS UNPUBLISHED PROPRIETARY SOURCE CODE OF AT&T	*/
/*	The copyright notice above does not evidence any   	*/
/*	actual or intended publication of such source code.	*/

#ident	"$Header: msg.c 1.4 89/10/10 $@(#)sh:msg.c	1.15"
/*
 *	UNIX shell
 */


#include	"defs.h"
#include	"sym.h"

/*
 * error messages
 */
unsigned char	badopt[]	= "bad option(s)";
unsigned char	mailmsg[]	= "you have mail\n";
unsigned char	nospace[]	= "no space";
unsigned char	nostack[]	= "no stack space";
unsigned char	synmsg[]	= "syntax error";

unsigned char	badnum[]	= "bad number";
unsigned char	badparam[]	= "parameter null or not set";
unsigned char	unset[]		= "parameter not set";
unsigned char	badsub[]	= "bad substitution";
unsigned char	badcreate[]	= "cannot create";
unsigned char	nofork[]	= "fork failed - too many processes";
unsigned char	noswap[]	= "cannot fork: no swap space";
unsigned char	restricted[]	= "restricted";
unsigned char	piperr[]	= "cannot make pipe";
unsigned char	badopen[]	= "cannot open";
unsigned char	coredump[]	= " - core dumped";
unsigned char	arglist[]	= "arg list too long";
unsigned char	txtbsy[]	= "text busy";
unsigned char	toobig[]	= "too big";
unsigned char	badexec[]	= "cannot execute";
unsigned char	notfound[]	= "not found";
unsigned char	badfile[]	= "bad file number";
unsigned char	badshift[]	= "cannot shift";
unsigned char	baddir[]	= "bad directory";
unsigned char	badtrap[]	= "bad trap";
unsigned char	wtfailed[]	= "is read only";
unsigned char	notid[]		= "is not an identifier";
unsigned char 	badulimit[]	= "Bad ulimit";
unsigned char	badreturn[] 	= "cannot return when not in function";
unsigned char	badexport[] 	= "cannot export functions";
unsigned char	badunset[] 	= "cannot unset";
unsigned char	nohome[]	= "no home directory";
unsigned char 	badperm[]	= "execute permission denied";
unsigned char	longpwd[]	= "sh error: pwd too long";
unsigned char	mssgargn[]	= "missing arguments";
unsigned char	libacc[] 	= "can't access a needed shared library";
unsigned char	libbad[]	= "accessing a corrupted shared library";
unsigned char	libscn[]	= ".lib section in a.out corrupted";
unsigned char	libmax[]	= "attempting to link in too many libs";
unsigned char    emultihop[]     = "Multihop attempted";
unsigned char    nulldir[]       = "null directory";
unsigned char    enotdir[]       = "not a directory";
unsigned char    enoent[]        = "does not exist";
unsigned char    eacces[]        = "permission denied";
unsigned char    enolink[]       = "remote link inactive";

/*
 * messages for 'builtin' functions
 */
unsigned char	btest[]		= "test";
unsigned char	badop[]		= "unknown operator ";
/*
 * built in names
 */
unsigned char	pathname[]	= "PATH";
unsigned char	cdpname[]	= "CDPATH";
unsigned char	homename[]	= "HOME";
unsigned char	mailname[]	= "MAIL";
unsigned char	ifsname[]	= "IFS";
unsigned char	ps1name[]	= "PS1";
unsigned char	ps2name[]	= "PS2";
unsigned char	mchkname[]	= "MAILCHECK";
unsigned char	acctname[]  	= "SHACCT";
unsigned char	mailpname[]	= "MAILPATH";
unsigned char	tmpname[]	= "PARALLEL";

/*
 * string constants
 */
unsigned char	nullstr[]	= "";
unsigned char	sptbnl[]	= " \t\n";
unsigned char	defpath[]	= ":/bin:/usr/bin";
unsigned char	colon[]		= ": ";
unsigned char	minus[]		= "-";
unsigned char	endoffile[]	= "end of file";
unsigned char	unexpected[] 	= " unexpected";
unsigned char	atline[]	= " at line ";
unsigned char	devnull[]	= "/dev/null";
unsigned char	execpmsg[]	= "+ ";
unsigned char	readmsg[]	= "> ";
unsigned char	stdprompt[]	= "$ ";
unsigned char	supprompt[]	= "# ";
unsigned char	profile[]	= ".profile";
unsigned char	sysprofile[]	= "/etc/profile";

/*
 * tables
 */

struct sysnod reserved[] =
{
	{ (unsigned char *)"case",	CASYM	},
	{ (unsigned char *)"do",		DOSYM	},
	{ (unsigned char *)"done",	ODSYM	},
	{ (unsigned char *)"elif",	EFSYM	},
	{ (unsigned char *)"else",	ELSYM	},
	{ (unsigned char *)"esac",	ESSYM	},
	{ (unsigned char *)"fi",		FISYM	},
	{ (unsigned char *)"for",	FORSYM	},
	{ (unsigned char *)"if",		IFSYM	},
	{ (unsigned char *)"in",		INSYM	},
	{ (unsigned char *)"then",	THSYM	},
	{ (unsigned char *)"until",	UNSYM	},
	{ (unsigned char *)"while",	WHSYM	},
	{ (unsigned char *)"{",		BRSYM	},
	{ (unsigned char *)"}",		KTSYM	}
};

int no_reserved = 15;

unsigned char	*sysmsg[] =
{
	0,
	(unsigned char *)"Hangup",
	0,	/* Interrupt */
	(unsigned char *)"Quit",
	(unsigned char *)"Illegal instruction",
	(unsigned char *)"Trace/BPT trap",
	(unsigned char *)"abort",
	(unsigned char *)"EMT trap",
	(unsigned char *)"Floating exception",
	(unsigned char *)"Killed",
	(unsigned char *)"Bus error",
	(unsigned char *)"Memory fault",
	(unsigned char *)"Bad system call",
	0,	/* Broken pipe */
	(unsigned char *)"Alarm call",
	(unsigned char *)"Terminated",
	(unsigned char *)"Signal 16",
	(unsigned char *)"Signal 17",
	(unsigned char *)"Child death",
	(unsigned char *)"Power Fail"
};

unsigned char	export[] = "export";
unsigned char	duperr[] = "cannot dup";
unsigned char	readonly[] = "readonly";


struct sysnod commands[] =
{
	{ (unsigned char *)".",		SYSDOT	},
	{ (unsigned char *)":",		SYSNULL	},

#ifndef RES
	{ (unsigned char *)"[",		SYSTST },
#endif

	{ (unsigned char *)"break",	SYSBREAK },
	{ (unsigned char *)"cd",		SYSCD	},
	{ (unsigned char *)"continue",	SYSCONT	},
	{ (unsigned char *)"echo",	SYSECHO },
	{ (unsigned char *)"eval",	SYSEVAL	},
	{ (unsigned char *)"exec",	SYSEXEC	},
	{ (unsigned char *)"exit",	SYSEXIT	},
	{ (unsigned char *)"export",	SYSXPORT },
	{ (unsigned char *)"getopts",	SYSGETOPT },
	{ (unsigned char *)"hash",	SYSHASH	},

#ifdef RES
	{ (unsigned char *)"login",	SYSLOGIN },
	{ (unsigned char *)"newgrp",	SYSLOGIN },
#else
	{ (unsigned char *)"newgrp",	SYSNEWGRP },
#endif

	{ (unsigned char *)"pwd",	SYSPWD },
	{ (unsigned char *)"read",	SYSREAD	},
	{ (unsigned char *)"readonly",	SYSRDONLY },
	{ (unsigned char *)"return",	SYSRETURN },
	{ (unsigned char *)"set",	SYSSET	},
	{ (unsigned char *)"shift",	SYSSHFT	},
	{ (unsigned char *)"test",	SYSTST },
	{ (unsigned char *)"times",	SYSTIMES },
	{ (unsigned char *)"trap",	SYSTRAP	},
	{ (unsigned char *)"type",	SYSTYPE },


#ifndef RES		
	{ (unsigned char *)"ulimit",	SYSULIMIT },
	{ (unsigned char *)"umask",	SYSUMASK },
#endif

	{ (unsigned char *)"unset", 	SYSUNS },
	{ (unsigned char *)"wait",	SYSWAIT	}
};

#ifdef RES
	int no_commands = 26;
#else
	int no_commands = 28;
#endif

/* parallel support */
int		maxkids;
int		nkids;
