Well if you want easy, then use a shell script - it's just one line
Code:
#!/bin/sh
/usr/bin/tclsh hello.tcl $*
But if you want a C program, try this
Code:
#include <stdio.h>
#include <stdlib.h>
/*
* Given the invocation
* ./a.out a b c
* argc is 4, and the number of elements in argv is 5 (argv[argc] is NULL)
* we need to stretch this out by 1 parameter
* /usr/bin/tclsh hello.tcl a b c
*/
int main ( int argc, char *argv[] ) {
char **newargv;
int i, j;
/* space for an expanded argv */
newargv = malloc( (argc+2) * sizeof *newargv );
/* create a new argv */
newargv[0] = "/usr/bin/tclsh";
newargv[1] = "hello.tcl";
for ( i = 2, j = 1 ; j < argc ; i++, j++ ) {
newargv[i] = argv[j];
}
newargv[i] = NULL;
/* run the new program, with the existing args */
execv(newargv[0], newargv);
return 0;
}