/***********************************************************************
* *
* This software is part of the ast package *
* Copyright (c) 1982-2011 AT&T Intellectual Property *
* and is licensed under the *
* Eclipse Public License, Version 1.0 *
* by AT&T Intellectual Property *
* *
* A copy of the License is available at *
* (with md5 checksum b35adb5213ca9657e911e9befb180842) *
* *
* Information and Software Systems Research *
* AT&T Research *
* Florham Park NJ *
* *
* David Korn <dgk@research.att.com> *
* *
***********************************************************************/
#pragma prototyped
/*
* David Korn
* AT&T Labs
*
* shell script to shell binary converter
*
*/
static const char usage[] =
"[-?\n@(#)$Id: shcomp (AT&T Research) 2003-03-02 $\n]"
"[+NAME?shcomp - compile a shell script]"
"[+DESCRIPTION?Unless \b-D\b is specified, \bshcomp\b takes a shell script, "
"\ainfile\a, and creates a binary format file, \aoutfile\a, that "
"\bksh\b can read and execute with the same effect as the original "
"script.]"
"[+?Since aliases are processed as the script is read, alias definitions "
"whose value requires variable expansion will not work correctly.]"
"[+?If \b-D\b is specified, all double quoted strings that are preceded by "
"\b$\b are output. These are the messages that need to be "
"translated to locale specific versions for internationalization.]"
"[+?If \aoutfile\a is omitted, then the results will be written to "
"standard output. If \ainfile\a is also omitted, the shell script "
"will be read from standard input.]"
"[D:dictionary?Generate a list of strings that need to be placed in a message "
"catalog for internationalization.]"
"[n:noexec?Displays warning messages for obsolete or non-conforming "
"constructs.] "
"[v:verbose?Displays input from \ainfile\a onto standard error as it "
"reads it.]"
"\n"
"\n[infile [outfile]]\n"
"\n"
"[+EXIT STATUS?]{"
"[+0?Successful completion.]"
"[+>0?An error occurred.]"
"}"
"[+SEE ALSO?\bksh\b(1)]"
;
#include <shell.h>
#include "defs.h"
#include "shnodes.h"
{
Shnode_t *t;
char *cp;
{
case 'D':
dflag=1;
break;
case 'v':
vflag=1;
break;
case 'n':
nflag=1;
break;
case ':':
break;
case '?':
break;
}
{
argv++;
}
else
{
}
else
if(dflag)
{
}
if(nflag)
if(vflag)
if(!dflag)
#if SHOPT_BRACEPAT
#endif
while(1)
{
stakset((char*)0,0);
{
if((t->tre.tretyp&(COMMSK|COMSCAN))==0 && t->com.comnamp && strcmp(nv_name((Namval_t*)t->com.comnamp),"alias")==0)
sh_exec(t,0);
}
break;
{
break;
/* check for exec of a command */
{
{
break;
}
else
{
break;
}
}
}
}
/* copy any remaining input */
return(0);
}