shell code compiler (shell script -> C code)

shell code compiler (shell script -> C code)

Post by Matthias Wark » Tue, 26 Jan 1999 04:00:00



It was the 24 Jan 1999 20:30:05 GMT...

Quote:> i'm looking for a shell code compiler
> capable of converting shell scripts to C code.

> preferably, any free|GPL ones?

Such a program would be hard to write. Shell scripts call external programs
all the time, and how could the translator possibly know what they do?

Yes, granted, the translator could use system(3) calls to execute these
shell commands untranslated, but what would be the use?

mawa
--

My Geek Code is no longer in my .signature. It's available on e-mail request.
It's sad to live in a world where knowing how to program your VCR actually
lowers your social status...

 
 
 

shell code compiler (shell script -> C code)

Post by Hemant Sha » Wed, 27 Jan 1999 04:00:00



:)In comp.unix.shell on Mon, 25 Jan 1999 00:10:05 +0100,

:)> > i'm looking for a shell code compiler
:)> > capable of converting shell scripts to C code.
:)>
:)> Such a program would be hard to write. Shell scripts call external programs
:)> all the time, and how could the translator possibly know what they do?

  Such program does exist. It is called shc.c, it is written by

  e-mail to the author. I have been using it for long time.

  It does not actually convert shell commands to system calls. It
  actually compress the shell script and includes it as a part
  of C code and compiles the C code built from the template (part of
  shc.c). When you execute the compiled code, it will uncompresses
  the shell script on the fly and execute it. Once you compile the
  program on one can see what commands are executed, not even with
  strings.

static char *abstract = "Abstract:

    This tool obtains a striped binary executable version of the script
    specified at command line.

    Binary version will be named with .x extension, and will usually be
    shorter than ascii one.

    You can specify expiration date [-e] too, after which binary will
    refuse to be executed, displaying \"Contact with [-m]\" instead.

    You can compile whatever interpreted script, but valid [-i], [-x]
    and [-l] options must be given.
";
static char *usage =
"Usage: -f script [-e date] [-m addr] [-i iopt] [-x cmnd] [-l lopt] [-vCAh]";
static char *help = "
    -e %s  Expiration date in mm/dd/yy format [NO]
    -m %s  e-Mail address to contact with at expiration [your provider]
    -f %s  File name of the script to compile
    -i %s  Inline option for this interpreter i.e: -e

    -l %s  Last option i.e: --
    -v     Verbose
    -C     Copying
    -A     Abstract
    -h     Help
";

    The version I have (2.4) supports following languages;

    perl, rc, sh, bash, bsh, Rsh, ksh, tsh, ash, csh, tcsh.

    more shells are easy to add.

:) such programs do exist... but as you may imagine, i ask
:) as i haven't came across any lately...
:)
:)> Yes, granted, the translator could use system(3) calls to execute these
:)> shell commands untranslated, but what would be the use?

:)from my point of view, i wish to translate some rather
:)simple shell scripts to help learn C (amongst other things)

:)--
:)Darren Wyn Rees       The Welsh Verb Emporium
:)http://www.netlink.co.uk/users/merlin/berfau/

--
Hemant Shah                           /-------------------\    ^~~~~^

                                      |No place for wimps |   o|-OO-|o
TO REPLY, REMOVE NoJunkMail           |          -Dilbert |--- | () |
FROM MY E-MAIL ADDRESS.               \-------------------/    |    |
-----------------[DO NOT SEND UNSOLICITED BULK E-MAIL]------------------
I haven't lost my mind,                Above opinions are mine only.
it's backed up on tape somewhere.      Others can have their own.

 
 
 

1. Code Beautifier For Shell Scripts <sec>

I have a question... where can I find a code-beautifier for shell
scripts?
I have located a number of 'em, but they only deal with other languages
such
as C/C++, Perl, HTML, etc.  Arachnophilia came close with its beautify
tool
for CGI scripts (I think it expects Perl), but gagged on 'case'
statements;
only one')' there.  Any suggestions?  Thanks.

2. Broken Java on Redhat Beta 4.9.1 (Mustang)

3. >> SHELL ESCAPE CODES WANTED <<

4. VT-100 Scrolling problem

5. PD Shell compilers (was: Shell compilers)

6. specs for a minimum web browsing linux machine

7. equivalent of Burn shell 2>&1 directly from C code

8. Help: Firewall Password Hacked or Forgiven ?

9. FREE CODE: shell-script line editor

10. Compiling C code with shell script.

11. Any coding standards for shell scripts?

12. Compiling C code with a shell script.

13. debug shell scripts with sourced code included.