shell compiler available

David Sherman dave at lsuc.UUCP
Thu Jan 17 11:12:25 AEST 1985


In article <285 at varian.UUCP> david at 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



More information about the Comp.unix mailing list