[net.unix] converting sh scripts to C code

brunner@sdsioa.UUCP (Rob Brunner X2830) (06/19/86)

Has anyone out there written anything to convert sh scripts to 
C code??  We have quite a few sh scripts around here and they
could run *far*quicker* if converted to C, but before I sit down
and crank them out by hand, I was wondering if anyone else had
encountered this before and had written some sort of something to
do it.

Any help is appreciated, thanks.
-- 
Rob Brunner                              email:
Scripps Institution of Oceanography      brunner@sdsioa.UUCP
Mail Code A-010, UC San Diego            sdsioa!brunner@sdcsvax
San Diego, CA 92093                      {backbone}!sdcsvax!sdsioa!brunner
Phone: (619) 534-2040 (work)             (619) 452-7656 (home)

henry@utzoo.UUCP (Henry Spencer) (06/25/86)

> Has anyone out there written anything to convert sh scripts to 
> C code??  We have quite a few sh scripts around here and they
> could run *far*quicker* if converted to C...

There's at least one such commercial product, although it's probably
not worth the cost if it's only a few scripts.  However...  if you
have a modern shell (the ancient Bourne shell that comes with 4BSD
does not qualify), you may not see all that much improvement.  Once
things like "echo" become builtins, it's not clear that you save
much by avoiding the fork/exec.  Real improvement would come from
having the C program do the things that are done by sed or awk in
shell programs, and *that* conversion would be far more complex.

If you are not running the SVR2 sh or equivalent, you need to upgrade
your shell.  Only after that is accomplished is it worth considering
conversion to C, in my opinion.
-- 
Usenet(n): AT&T scheme to earn
revenue from otherwise-unused	Henry Spencer @ U of Toronto Zoology
late-night phone capacity.	{allegra,ihnp4,decvax,pyramid}!utzoo!henry

jpn@teddy.UUCP (John P. Nelson) (06/27/86)

In article <6854@utzoo.UUCP> henry@utzoo.UUCP (Henry Spencer) writes:
>if you have a modern shell (the ancient Bourne shell that comes with 4BSD
>does not qualify), you may not see all that much improvement.
>
> ...
>
>If you are not running the SVR2 sh or equivalent, you need to upgrade
>your shell.  Only after that is accomplished is it worth considering
>conversion to C, in my opinion.

No problem, I just plunk down $40000 dollars for a SVR2 source licence
(I can't buy a binary, the binary won't run on my machine), figure out
how to extract the source for sh from the distribution tape (My system
doesn't HAVE cpio, yet that is how AT&T insists on distributing), then
throw the rest of the tape away.  SURE.  I am also in need of a bridge
in brooklyn.

At least an sh to C converter program is AVAILABLE at a sane price.

I sure wish AT&T had a more lenient licensing/upgrade policy.

levy@ttrdc.UUCP (Daniel R. Levy) (06/29/86)

In article <2801@teddy.UUCP>, jpn@teddy.UUCP (John P. Nelson) writes:

>In article <6854@utzoo.UUCP> henry@utzoo.UUCP (Henry Spencer) writes:
>>if you have a modern shell (the ancient Bourne shell that comes with 4BSD
>>does not qualify), you may not see all that much improvement.
>> ...
>>If you are not running the SVR2 sh or equivalent, you need to upgrade
>>your shell.  Only after that is accomplished is it worth considering
>>conversion to C, in my opinion.
>No problem, I just plunk down $40000 dollars for a SVR2 source licence
>(I can't buy a binary, the binary won't run on my machine), figure out
>how to extract the source for sh from the distribution tape (My system
>doesn't HAVE cpio, yet that is how AT&T insists on distributing), then
>throw the rest of the tape away.  SURE.  I am also in need of a bridge
>in brooklyn.
>At least an sh to C converter program is AVAILABLE at a sane price.
>I sure wish AT&T had a more lenient licensing/upgrade policy.

I cannot speak for /bin/sh but however ksh (superset of Bourne, many bells
and whistles, almost as efficient as SysV Bourne) is available as source
for approximately $2000 (non AT&T sites) and will compile under a number of
BSD variants as well as SysV.  It was authored by David Korn of Bell Labor-
atories (ulysses!dgk).  Korn himself posted a notice to this effect in 
net.unix-wizards [I think] some time ago.

gwyn@brl-smoke.ARPA (Doug Gwyn ) (06/29/86)

In article <2801@teddy.UUCP> jpn@teddy.UUCP (John P. Nelson) writes:
>No problem, I just plunk down $40000 dollars for a SVR2 source licence
>(I can't buy a binary, the binary won't run on my machine), figure out
>how to extract the source for sh from the distribution tape (My system
>doesn't HAVE cpio, yet that is how AT&T insists on distributing), then
>throw the rest of the tape away.  SURE.  I am also in need of a bridge
>in brooklyn.

Don't be silly.  If you already have some UNIX source license, the
upgrade cost to SVR2 was typically much less than the $43,000 initial
source CPU license-from-scratch fee.  If you are running a UNIX box
that is binary-sublicensed by some vendor, then get the vendor to
supply the newer shell; many vendors (e.g., Sun) are doing this.
VARs are likely to find UNIX System V sublicensing terms more favorable
than whatever they might have started out with (UNIX 32/V, whatever);
I don't know of any major UNIX system vendors that aren't licensed
for UNIX System V (I have copies of their licenses!).

As to cpio, if you're source-licensed for it, I could send you the
source code so you could read the distribution tapes.

It isn't AT&T's fault that you chose to run a weak, obsolete,
poorly supported implementation of UNIX.

jpn@teddy.UUCP (John P. Nelson) (06/30/86)

>>>If you are not running the SVR2 sh or equivalent, you need to upgrade
>>>your shell.

>>No problem, I just plunk down $40000 dollars for a SVR2 source licence

>I cannot speak for /bin/sh but however ksh (superset of Bourne, many bells
>and whistles, almost as efficient as SysV Bourne) is available as source
>for approximately $2000 (non AT&T sites)

My understanding is that you STILL need a System V source licence to obtain
ksh source for $2000 additional.  Thanks for nothing, AT&T.

 John Nelson
.
.
.
. (2.10.3 inews insists on more new lines than quoted lines!  GRRRRR!)
.
.

dyer@spdcc.UUCP (Steve Dyer) (07/01/86)

My understanding is that "ksh" is available for $2000 via electronic UUCP
distribution from the AT&T Toolchest.  You need to sign an
agreement/sort-of-P.O.-type form, but to the best of my knowledge,
no System V license is needed.
-- 
Steve Dyer
dyer@harvard.HARVARD.EDU
{linus,wanginst,bbncca,bbnccv,harvard,ima,ihnp4}!spdcc!dyer

john@frog.UUCP (John Woods, Software) (07/02/86)

> >>>If you are not running the SVR2 sh or equivalent, you need to upgrade
> >>>your shell.
> >>No problem, I just plunk down $40000 dollars for a SVR2 source licence
> >I cannot speak for /bin/sh but however ksh (superset of Bourne, many bells
> >and whistles, almost as efficient as SysV Bourne) is available as source
> >for approximately $2000 (non AT&T sites)
> My understanding is that you STILL need a System V source licence to obtain
> ksh source for $2000 additional.  Thanks for nothing, AT&T.
> 
>  John Nelson

I have here in front of me the "A Browser's Guide to the UNIX System
Toolchest", a piece of marketing handed out at a recent USENIX.  They don't
explicitly mention needing a System V source license, but they mention that
if you have a System V license (type unspecified), they'll waive the $100
registration fee -- therefore, I take it that no System V license of any kind
is needed to register to use the Toolchest, or to get tools.

ksh-i (the new International ksh, with 8-bit characters and zillions of bug
fixes) was made available a short time ago and it arrived here at CRDS
yesterday.  Cost for the new ksh-i is $3000.  They also have New Make for
$1200 (I believe, that is from memory).

The Toolchest seems to me to be a wonderful idea (though I wish they'd fix
their buggy display program...).

--
John Woods, Charles River Data Systems, Framingham MA, (617) 626-1101
...!decvax!frog!john, ...!mit-eddie!jfw, jfw%mit-ccc@MIT-XX.ARPA

"Imagine if every Thursday your shoes exploded if you tied them the usual way.
This happens to us all the time with computers, and nobody thinks of
complaining."
			Jeff Raskin, interviewed in Doctor Dobb's Journal