[net.unix] shell compiler available

david@varian.UUCP (David Brown) (01/15/85)

Several times in the past folks have asked if there was anything 
that could translate a shell script into C code so that it would run
faster.  The answer has usually been that you write shell scripts 
when you want to get an application going quickly; if you are concerned
about speed, then you write in C.  In the latest issue of CommUNIXation
(the publication of /usr/group), there is a press release about a
product that translates Bourne shell scripts to C.  I have no idea
how well it works, cost, availability, etc. (and no connection to the
company), but I thought folks might be interested in hearing that it
was available (i.e. this is an announcement, not an ad).   I would
be interested in hearing comments from anyone who has used it, or
has investigated the approach in the past and come up with some major
pitfalls.

It's called shacc (shell accelerator). From the release: "Features of
shacc included resistance to piracy, efficient use of shared text and
the sticky bit, and effective code use with setuid files".  Available
from:
	Concentric Associates Inc.
	One Harmon Plaza
	Secaucus, NJ 07094
	(201) 866-2880

-- 
	David Brown	 (415) 945-2199
	Varian Instruments 2700 Mitchell Dr.  Walnut Creek, Ca. 94598
	{zehntel,amd,fortune,resonex}!varian!david

dave@lsuc.UUCP (David Sherman) (01/17/85)

In article <285@varian.UUCP> david@varian.UUCP (David Brown) writes:
||		In the latest issue of CommUNIXation
||(the publication of /usr/group), there is a press release about a
||product that translates Bourne shell scripts to C...
||
||It's called shacc (shell accelerator). From the release: "Features of
||shacc included resistance to piracy, efficient use of shared text and
||the sticky bit, and effective code use with setuid files". 

Not to malign this particular product, since I'm not familiar with it,
but think a bit about what's needed to give you all those features....
a one-line C program that exec's sh on the shell file which you are
"translating". Presto, you have setUID that works, resistance to piracy
because users need no longer be allowed to read the shell file, and
(if you stretch the meaning slightly) shared text and sticky-bit working.

As I say, I haven't seen this product. I note that they don't claim
speed as a feature. Presumably, then, at best what shacc does is do
what the shell does, line by line - exec the processes with the
arguments requested. In other words,

: shell file				/* C program */ main() {
echo hello				system("echo hello");
for i in *				system("for i in *;do tail $i;done");
do					}
	tail $i
done

Of course, with some smarts you can replace the <system("for...")>
with a real for-loop, and so on with other keywords. You could even
do globbing (wildcard expansion). To make a really good product out
of this, you should also do the C equivalents of many programs, e.g.

echo hi					printf("hi\n");
rm -f junk				unlink("junk");

and so on for the most common UNIX programs. Now THAT would give you speed.

Dave Sherman
-- 
{utzoo pesnta nrcaero utcs}!lsuc!dave
{allegra decvax ihnp4 linus}!utcsrgv!lsuc!dave